fixed bugs in dist-check.

This commit is contained in:
Yichun Zhang (agentzh) 2018-11-01 21:23:39 -07:00
parent 71b9f46595
commit 2d5699cfe5
1 changed files with 17 additions and 9 deletions

View File

@ -6,7 +6,7 @@ use warnings;
use Getopt::Std qw(getopts); use Getopt::Std qw(getopts);
use Cwd qw/cwd/; use Cwd qw/cwd/;
sub sh ($); sub sh ($@);
sub cleanup (); sub cleanup ();
sub write_config_file ($); sub write_config_file ($);
@ -110,6 +110,8 @@ sh "curl -si localhost/cjson|grep 'json.safe: '";
sh qq{$prefix/bin/resty -e 'ngx.say("Hello World!")'|grep 'Hello World'}; sh qq{$prefix/bin/resty -e 'ngx.say("Hello World!")'|grep 'Hello World'};
sh "sudo $prefix/nginx/sbin/nginx -sstop"; sh "sudo $prefix/nginx/sbin/nginx -sstop";
}
warn "\n=== --without-stream + dtrace static probes ===\n"; warn "\n=== --without-stream + dtrace static probes ===\n";
$prefix = "/usr/local/openresty-nostream-usdt"; $prefix = "/usr/local/openresty-nostream-usdt";
cleanup(); cleanup();
@ -119,19 +121,17 @@ unless ($opts{f}) {
sh "$make -j$jobs"; sh "$make -j$jobs";
sh "sudo $make install"; sh "sudo $make install";
sh "sudo cp /tmp/nginx.conf $prefix/nginx/conf/nginx.conf"; sh "sudo cp /tmp/nginx.conf $prefix/nginx/conf/nginx.conf";
sh "$prefix/nginx/sbin/nginx -V 2>&1", $ver; sh "$prefix/nginx/sbin/nginx -V 2>\&1", $ver;
sh "$prefix/nginx/sbin/nginx -V 2>&1", "--with-stream"; sh "$prefix/nginx/sbin/nginx -V 2>\&1", "--with-stream", 1;
sh "$prefix/nginx/sbin/nginx -V 2>&1", "--with-dtrace-probes"; sh "$prefix/nginx/sbin/nginx -V 2>\&1", "--with-dtrace-probes";
system "sudo killall nginx > /dev/null 2>&1"; system "sudo killall nginx > /dev/null 2>&1";
sh "sudo $prefix/nginx/sbin/nginx"; sh "sudo $prefix/nginx/sbin/nginx";
sh "curl -si localhost/lua|grep $lua"; sh "curl -si localhost/lua|grep $lua";
sh "curl -si localhost/lua|grep $ver"; sh "curl -si localhost/lua|grep $ver";
sh "curl -si localhost/cjson|grep 'json.safe: '"; sh "curl -si localhost/cjson|grep 'json.safe: '";
sh qq{$prefix/bin/resty -e 'ngx.say("Hello World!")'|grep 'Hello World'}; sh qq{$prefix/bin/resty -e 'ngx.say("Hello World!")'}, 'Hello World';
sh "sudo $prefix/nginx/sbin/nginx -sstop"; sh "sudo $prefix/nginx/sbin/nginx -sstop";
}
warn "\n=== Without Gzip/SSL/PCRE ===\n"; warn "\n=== Without Gzip/SSL/PCRE ===\n";
$prefix = "/usr/local/openresty-nogzip"; $prefix = "/usr/local/openresty-nogzip";
cleanup(); cleanup();
@ -268,19 +268,27 @@ sh "sudo $prefix/nginx/sbin/nginx -sstop";
sub sh ($@) { sub sh ($@) {
my $cmd = shift; my $cmd = shift;
my $pat = shift; my $pat = shift;
my $neg = shift;
open my $in, "$cmd|" open my $in, "$cmd|"
or die "Command \"$cmd\" failed"; or die "Command \"$cmd\" failed";
my $out = ''; my $out = '';
my $found; my $found;
while (<$in>) { while (<$in>) {
if (defined $pat && index($_, $pat) >= 0) { if (defined $pat) {
$found = 1; if ($neg && index($_, $pat) < 0) {
$found = 1;
} elsif (!$neg && index($_, $pat) >= 0) {
$found = 1;
}
} }
$out .= $_; $out .= $_;
} }
close $in close $in
or die "Failed to run command \"$cmd\": $out"; or die "Failed to run command \"$cmd\": $out";
if (!defined $found && defined $pat) { if (!defined $found && defined $pat) {
if ($neg) {
die "unexpectedly found pattern '$pat' in the output of command \"$cmd\": $out";
}
die "failed find pattern '$pat' in the output of command \"$cmd\": $out"; die "failed find pattern '$pat' in the output of command \"$cmd\": $out";
} }
if (length $out < 1024) { if (length $out < 1024) {