added the --dry-run option for testing.
This commit is contained in:
parent
23f8304136
commit
37fbb6441e
|
@ -147,3 +147,5 @@ Options directly inherited from nginx
|
||||||
|
|
||||||
--with-openssl=DIR set path to OpenSSL library sources
|
--with-openssl=DIR set path to OpenSSL library sources
|
||||||
--with-openssl-opt=OPTIONS set additional options for OpenSSL building
|
--with-openssl-opt=OPTIONS set additional options for OpenSSL building
|
||||||
|
|
||||||
|
--dry-run dry running the configure, for testing only
|
||||||
|
|
36
t/sanity.t
36
t/sanity.t
|
@ -1,7 +1,7 @@
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Test::More tests => 1;
|
use Test::More tests => 2;
|
||||||
use Text::Diff;
|
use Text::Diff;
|
||||||
|
|
||||||
sub shell (@);
|
sub shell (@);
|
||||||
|
@ -13,19 +13,37 @@ chomp $ver;
|
||||||
#shell "make";
|
#shell "make";
|
||||||
|
|
||||||
cd "ngx_openresty-$ver";
|
cd "ngx_openresty-$ver";
|
||||||
shell "./configure --help > help.txt";
|
|
||||||
|
|
||||||
open my $in, "help.txt" or
|
{
|
||||||
|
shell "./configure --help > help.txt 2>&1";
|
||||||
|
|
||||||
|
open my $in, "help.txt" or
|
||||||
die "Cannot open help.txt for reading: $!\n";
|
die "Cannot open help.txt for reading: $!\n";
|
||||||
my $got = do { local $/; <$in> };
|
my $got = do { local $/; <$in> };
|
||||||
close $in;
|
close $in;
|
||||||
|
|
||||||
open $in, "../t/help.txt" or
|
open $in, "../t/help.txt" or
|
||||||
die "Cannot open ../t/help.txt for reading: $!\n";
|
die "Cannot open ../t/help.txt for reading: $!\n";
|
||||||
my $expected = do { local $/; <$in> };
|
my $expected = do { local $/; <$in> };
|
||||||
close $in;
|
close $in;
|
||||||
|
|
||||||
is_diff($got, $expected, "--help ok");
|
is_diff($got, $expected, "--help ok");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
shell "./configure --dry-run > default.txt 2>&1";
|
||||||
|
open my $in, "default.txt" or
|
||||||
|
die "Cannot open default.txt for reading: $!\n";
|
||||||
|
my $got = do { local $/; <$in> };
|
||||||
|
close $in;
|
||||||
|
|
||||||
|
open $in, "../t/default.txt" or
|
||||||
|
die "Cannot open ../t/default.txt for reading: $!\n";
|
||||||
|
my $expected = do { local $/; <$in> };
|
||||||
|
close $in;
|
||||||
|
|
||||||
|
is_diff($got, $expected, "default configure ok");
|
||||||
|
}
|
||||||
|
|
||||||
sub shell (@) {
|
sub shell (@) {
|
||||||
print "@_\n";
|
print "@_\n";
|
||||||
|
|
|
@ -62,9 +62,15 @@ my $with_resty_mods_regex;
|
||||||
|
|
||||||
my $prefix = '/usr/local/openresty';
|
my $prefix = '/usr/local/openresty';
|
||||||
my %resty_opts;
|
my %resty_opts;
|
||||||
|
my $dry_run;
|
||||||
|
|
||||||
my @ngx_opts;
|
my @ngx_opts;
|
||||||
for my $opt (@ARGV) {
|
for my $opt (@ARGV) {
|
||||||
|
if ($opt eq '--dry-run') {
|
||||||
|
$dry_run = 1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
if ($opt =~ /^--prefix=(.*)/) {
|
if ($opt =~ /^--prefix=(.*)/) {
|
||||||
$prefix = $1;
|
$prefix = $1;
|
||||||
|
|
||||||
|
@ -119,12 +125,13 @@ my $ngx_prefix = "$prefix/nginx";
|
||||||
my $cmd = "./configure --prefix=$ngx_prefix"
|
my $cmd = "./configure --prefix=$ngx_prefix"
|
||||||
. " --with-ld-opt='-Wl,-rpath=$ngx_prefix/lib'"
|
. " --with-ld-opt='-Wl,-rpath=$ngx_prefix/lib'"
|
||||||
. build_resty_opts(\%resty_opts)
|
. build_resty_opts(\%resty_opts)
|
||||||
. " " . join(" ", @ngx_opts);
|
. (@ngx_opts ? " " . join(" ", @ngx_opts) : "");
|
||||||
;
|
;
|
||||||
|
|
||||||
warn $cmd;
|
if ($dry_run) {
|
||||||
|
print "$cmd\n";
|
||||||
exit 0;
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
shell $cmd;
|
shell $cmd;
|
||||||
|
|
||||||
|
@ -183,6 +190,8 @@ sub build_resty_opts {
|
||||||
} else {
|
} else {
|
||||||
$opts_line .= " --with-cc-opt='-O2'";
|
$opts_line .= " --with-cc-opt='-O2'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $opts_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub usage ($) {
|
sub usage ($) {
|
||||||
|
@ -370,6 +379,8 @@ Options directly inherited from nginx
|
||||||
|
|
||||||
--with-openssl=DIR set path to OpenSSL library sources
|
--with-openssl=DIR set path to OpenSSL library sources
|
||||||
--with-openssl-opt=OPTIONS set additional options for OpenSSL building
|
--with-openssl-opt=OPTIONS set additional options for OpenSSL building
|
||||||
|
|
||||||
|
--dry-run dry running the configure, for testing only
|
||||||
_EOC_
|
_EOC_
|
||||||
|
|
||||||
if ($retval == 0) {
|
if ($retval == 0) {
|
||||||
|
|
Loading…
Reference in New Issue