diff --git a/util/dist-check b/util/dist-check index ed2d22c..4f705b4 100755 --- a/util/dist-check +++ b/util/dist-check @@ -7,6 +7,7 @@ use Getopt::Std qw(getopts); use Cwd qw/cwd/; sub sh ($); +sub cleanup (); sub write_config_file ($); my %opts; @@ -69,7 +70,7 @@ write_config_file "/tmp/nginx.conf"; warn "=== Without FFI ===\n"; $prefix = "/usr/local/openresty-noffi"; -sh "sudo rm -rf $prefix/lualib $prefix/luajit $prefix/bin $prefix/lua $prefix/nginx/sbin $prefix/nginx/html"; +cleanup(); unless ($opts{f}) { sh "./configure $cfg_opts --with-cc-opt='-DNGX_LUA_NO_FFI_API' --prefix=$prefix -j$jobs > /dev/null"; } @@ -87,7 +88,7 @@ sh "sudo $prefix/nginx/sbin/nginx -sstop"; warn "=== --with-stream ===\n"; $prefix = "/usr/local/openresty-stream"; -sh "sudo rm -rf $prefix/lualib $prefix/luajit $prefix/bin $prefix/lua $prefix/nginx/sbin $prefix/nginx/html"; +cleanup(); unless ($opts{f}) { sh "./configure $cfg_opts --with-stream --prefix=$prefix -j$jobs > /dev/null"; } @@ -106,7 +107,7 @@ sh "sudo $prefix/nginx/sbin/nginx -sstop"; warn "=== --with-stream + dtrace static probes ===\n"; $prefix = "/usr/local/openresty-stream-usdt"; -sh "sudo rm -rf $prefix/lualib $prefix/luajit $prefix/bin $prefix/lua $prefix/nginx/sbin $prefix/nginx/html"; +cleanup(); unless ($opts{f}) { sh "./configure $cfg_opts --with-dtrace-probes --with-stream --prefix=$prefix -j$jobs > /dev/null"; } @@ -126,7 +127,7 @@ sh "sudo $prefix/nginx/sbin/nginx -sstop"; warn "=== Without Gzip/SSL/PCRE ===\n"; $prefix = "/usr/local/openresty-nogzip"; -sh "sudo rm -rf $prefix/lualib $prefix/luajit $prefix/bin $prefix/lua $prefix/nginx/sbin $prefix/nginx/html"; +cleanup(); unless ($opts{f}) { sh "./configure $cfg_opts --without-http_rewrite_module --without-http_ssl_module --without-pcre --without-http_gzip_module --prefix=$prefix -j$jobs > /dev/null"; } @@ -149,7 +150,7 @@ $cfg_opts .= " --with-http_iconv_module"; warn "\n=== --with-threads ===\n"; $prefix = "/usr/local/openresty-threads"; -sh "sudo rm -rf $prefix/lualib $prefix/luajit $prefix/bin $prefix/lua $prefix/nginx/sbin $prefix/nginx/html"; +cleanup(); unless ($opts{f}) { sh "./configure $cfg_opts --with-threads --prefix=$prefix -j$jobs > /dev/null"; } @@ -168,7 +169,7 @@ sh "sudo $prefix/nginx/sbin/nginx -sstop"; warn "\n=== No Pool Build ===\n"; $prefix = "/usr/local/openresty-nopool"; -sh "sudo rm -rf $prefix/lualib $prefix/luajit $prefix/bin $prefix/lua $prefix/nginx/sbin $prefix/nginx/html"; +cleanup(); unless ($opts{f}) { sh "./configure --with-no-pool-patch $cfg_opts --prefix=$prefix -j$jobs > /dev/null"; } @@ -188,7 +189,7 @@ sh "sudo $prefix/nginx/sbin/nginx -sstop"; warn "\n=== Normal Build ===\n"; $prefix = "/usr/local/openresty"; -sh "sudo rm -rf $prefix/lualib $prefix/luajit $prefix/bin $prefix/lua $prefix/nginx/sbin $prefix/nginx/html"; +cleanup(); unless ($opts{f}) { sh "./configure $cfg_opts -j$jobs > /dev/null"; } @@ -202,11 +203,13 @@ sh "curl -si localhost/lua|grep $lua"; sh "curl -si localhost/lua|grep $ver"; 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/restydoc -s listen | grep 'configures the port to accept HTTP/2'}; +sh qq{$prefix/bin/restydoc opm | grep -E '^Status\$'}; sh "sudo $prefix/nginx/sbin/nginx -sstop"; warn "\n=== Debug Build ===\n"; $prefix = "/usr/local/openresty-debug"; -sh "sudo rm -rf $prefix/lualib $prefix/luajit $prefix/bin $prefix/lua $prefix/nginx/sbin $prefix/nginx/html"; +cleanup(); unless ($opts{f}) { my $more_cfg_opts = ''; if ($lua eq 'LuaJIT') { @@ -229,7 +232,7 @@ sh "sudo $prefix/nginx/sbin/nginx -sstop"; warn "\n=== DTrace Build ===\n"; $prefix = "/usr/local/openresty-dtrace"; -sh "sudo rm -rf $prefix/lualib $prefix/luajit $prefix/bin $prefix/lua $prefix/nginx/sbin $prefix/nginx/html"; +cleanup(); unless ($opts{f}) { sh "./configure $cfg_opts --with-dtrace-probes --prefix=$prefix -j$jobs > /dev/null"; } @@ -258,6 +261,11 @@ sub sh ($) { system($cmd) == 0 or die "Command \"$cmd\" failed"; } +sub cleanup () { + sh "sudo rm -rf $prefix/lualib $prefix/luajit $prefix/bin $prefix/lua $prefix/nginx/sbin $prefix/nginx/html" + . " $prefix/site $prefix/pod $prefix/resty.index"; +} + __DATA__ user nobody;