1
0
mirror of https://github.com/openresty/openresty synced 2024-11-09 18:35:51 +01:00

added the util/dist-check script for checking the basic sanity of a tarball distribution.

This commit is contained in:
agentzh (Yichun Zhang) 2013-04-16 17:19:26 -07:00
parent e91766c012
commit 6063956a1a

88
util/dist-check Executable file

@ -0,0 +1,88 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Std qw(getopts);
use Cwd qw/cwd/;
sub sh ($);
my %opts;
getopts("f:", \%opts) or die "Usage: $0 [-f] <cores>\n";
my $jobs = shift || 4;
my $cwd = cwd();
if ($cwd !~ /ngx_openresty-(\d+(?:\.\d+)+)$/) {
die "Bad current working directory: $cwd\n";
}
my $ver = $1;
my ($make);
if ($^O eq 'freebsd' || $^O eq 'solaris') {
$make = 'gmake';
} else {
$make = 'make';
}
my $prefix;
warn "=== Normal Build ===\n";
$prefix = "/usr/local/openresty";
unless ($opts{f}) {
sh "./configure --with-luajit -j$jobs > /dev/null";
}
sh "$make -j$jobs > /dev/null";
sh "sudo $make install > /dev/null";
sh "$prefix/nginx/sbin/nginx -V 2>&1 |grep $ver";
system "sudo killall nginx";
sh "sudo $prefix/nginx/sbin/nginx";
sh "curl -si localhost/lua|grep LuaJIT";
sh "curl -si localhost/lua|grep $ver";
sh "sudo $prefix/nginx/sbin/nginx -sstop";
warn "\n=== Debug Build ===\n";
$prefix = "/usr/local/openresty-debug";
unless ($opts{f}) {
sh "./configure --with-debug --prefix=$prefix --with-luajit -j$jobs > /dev/null";
}
sh "$make -j$jobs > /dev/null";
sh "sudo $make install > /dev/null";
sh "$prefix/nginx/sbin/nginx -V 2>&1 |grep $ver";
sh "$prefix/nginx/sbin/nginx -V 2>&1 |grep '\\--with-debug'";
system "sudo killall nginx";
sh "sudo $prefix/nginx/sbin/nginx";
sh "curl -si localhost/lua|grep LuaJIT";
sh "curl -si localhost/lua|grep $ver";
sh "sudo $prefix/nginx/sbin/nginx -sstop";
warn "\n=== DTrace Build ===\n";
$prefix = "/usr/local/openresty-dtrace";
unless ($opts{f}) {
sh "./configure --with-dtrace-probes --prefix=$prefix --with-luajit -j$jobs > /dev/null";
}
sh "$make -j$jobs > /dev/null";
sh "sudo $make install > /dev/null";
sh "$prefix/nginx/sbin/nginx -V 2>&1 |grep $ver";
sh "$prefix/nginx/sbin/nginx -V 2>&1 |grep '\\--with-dtrace-probes'";
system "sudo killall nginx";
sh "sudo $prefix/nginx/sbin/nginx";
sh "curl -si localhost/lua|grep LuaJIT";
sh "curl -si localhost/lua|grep $ver";
if ($^O eq 'linux') {
sh "stap -L 'process(\"$prefix/nginx/sbin/nginx\").mark(\"*\")'|grep http__lua__coroutine__done";
} elsif ($^O eq 'freebsd' || $^O eq 'macosx') {
sh "sudo dtrace -l|grep http-lua-coroutine-done";
}
sh "sudo $prefix/nginx/sbin/nginx -sstop";
sub sh ($) {
my $cmd = shift;
system($cmd) == 0 or die "Command \"$cmd\" failed";
}