Skip to content

Commit d6d04b9

Browse files
committed
chore(util) add a patch for tcp_listen in HUP mode
And reorder patches from bottom to top of the file.
1 parent 67f295b commit d6d04b9

File tree

1 file changed

+36
-25
lines changed

1 file changed

+36
-25
lines changed

util/setup_dev.sh

+36-25
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,27 @@ pushd $DIR_CPANM
4141

4242
set +e
4343
patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF'
44-
@@ -484,6 +484,7 @@ sub master_process_enabled (@) {
45-
}
44+
@@ -2783,7 +2783,7 @@ END {
4645
47-
our @EXPORT = qw(
48-
+ gen_rand_port
49-
use_http2
50-
use_http3
51-
env_to_nginx
46+
check_prev_block_shutdown_error_log();
47+
48+
- if ($Randomize) {
49+
+ if ($Randomize && !$ENV{TEST_NGINX_NO_CLEAN}) {
50+
if (defined $ServRoot && -d $ServRoot && $ServRoot =~ m{/t/servroot_\d+}) {
51+
system("rm -rf $ServRoot");
52+
}
5253
EOF
54+
# Fix tcp_listen block in HUP reload mode skipped tests.
55+
# > failed to create the tcp listening socket: No such file or directory
5356
patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF'
54-
@@ -960,5 +960,5 @@ sub write_config_file ($$$) {
55-
bail_out "Can't open $ConfFile for writing: $!\n";
56-
+ print $out "daemon $DaemonEnabled;" if ($DaemonEnabled eq 'off');
57-
print $out <<_EOC_;
58-
worker_processes $Workers;
59-
-daemon $DaemonEnabled;
60-
master_process $MasterProcessEnabled;
57+
@@ -2256,7 +2256,7 @@ request:
58+
}
59+
60+
my ($tcp_socket, $tcp_query_file);
61+
- if (!($CheckLeak || $Benchmark) && defined $block->tcp_listen) {
62+
+ if (!($CheckLeak || $Benchmark) && defined $block->tcp_listen && -e $ServRoot) {
63+
64+
my $target = $block->tcp_listen;
6165
EOF
6266
patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF'
6367
@@ -2123,7 +2123,7 @@ RUN_AGAIN:
@@ -69,17 +73,6 @@ EOF
6973
"$name - die with the expected exit code")
7074
7175
} else {
72-
EOF
73-
patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF'
74-
@@ -2783,7 +2783,7 @@ END {
75-
76-
check_prev_block_shutdown_error_log();
77-
78-
- if ($Randomize) {
79-
+ if ($Randomize && !$ENV{TEST_NGINX_NO_CLEAN}) {
80-
if (defined $ServRoot && -d $ServRoot && $ServRoot =~ m{/t/servroot_\d+}) {
81-
system("rm -rf $ServRoot");
82-
}
8376
EOF
8477
patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF'
8578
@@ -1953,10 +1953,14 @@
@@ -107,6 +100,15 @@ EOF
107100
+ $opts = "$UseValgrind $opts";
108101
$cmd = "valgrind -q $opts $cmd";
109102
}
103+
EOF
104+
patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF'
105+
@@ -960,5 +960,5 @@ sub write_config_file ($$$) {
106+
bail_out "Can't open $ConfFile for writing: $!\n";
107+
+ print $out "daemon $DaemonEnabled;" if ($DaemonEnabled eq 'off');
108+
print $out <<_EOC_;
109+
worker_processes $Workers;
110+
-daemon $DaemonEnabled;
111+
master_process $MasterProcessEnabled;
110112
EOF
111113
patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Socket.pm <<'EOF'
112114
@@ -813,6 +813,10 @@ again:
@@ -121,7 +123,16 @@ EOF
121123
122124
if (!defined $block->ignore_response) {
123125
EOF
126+
patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF'
127+
@@ -484,6 +484,7 @@ sub master_process_enabled (@) {
128+
}
124129
130+
our @EXPORT = qw(
131+
+ gen_rand_port
132+
use_http2
133+
use_http3
134+
env_to_nginx
135+
EOF
125136
set -e
126137
popd
127138

0 commit comments

Comments
 (0)