From 8cf95e5b0d2210aeddfa36882384c0712df95dd1 Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Sat, 4 Nov 2023 10:09:18 -0700 Subject: [PATCH] chore(util) add a patch for tcp_listen in HUP mode And reorder patches from bottom to top of the file. --- util/setup_dev.sh | 61 ++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/util/setup_dev.sh b/util/setup_dev.sh index fdfea85ed..427116b38 100755 --- a/util/setup_dev.sh +++ b/util/setup_dev.sh @@ -41,23 +41,27 @@ pushd $DIR_CPANM set +e patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF' - @@ -484,6 +484,7 @@ sub master_process_enabled (@) { - } + @@ -2783,7 +2783,7 @@ END { - our @EXPORT = qw( - + gen_rand_port - use_http2 - use_http3 - env_to_nginx + check_prev_block_shutdown_error_log(); + + - if ($Randomize) { + + if ($Randomize && !$ENV{TEST_NGINX_NO_CLEAN}) { + if (defined $ServRoot && -d $ServRoot && $ServRoot =~ m{/t/servroot_\d+}) { + system("rm -rf $ServRoot"); + } EOF + # Fix tcp_listen block in HUP reload mode skipped tests. + # > failed to create the tcp listening socket: No such file or directory patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF' - @@ -960,5 +960,5 @@ sub write_config_file ($$$) { - bail_out "Can't open $ConfFile for writing: $!\n"; - + print $out "daemon $DaemonEnabled;" if ($DaemonEnabled eq 'off'); - print $out <<_EOC_; - worker_processes $Workers; - -daemon $DaemonEnabled; - master_process $MasterProcessEnabled; + @@ -2256,7 +2256,7 @@ request: + } + + my ($tcp_socket, $tcp_query_file); + - if (!($CheckLeak || $Benchmark) && defined $block->tcp_listen) { + + if (!($CheckLeak || $Benchmark) && defined $block->tcp_listen && -e $ServRoot) { + + my $target = $block->tcp_listen; EOF patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF' @@ -2123,7 +2123,7 @@ RUN_AGAIN: @@ -69,17 +73,6 @@ EOF "$name - die with the expected exit code") } else { -EOF - patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF' - @@ -2783,7 +2783,7 @@ END { - - check_prev_block_shutdown_error_log(); - - - if ($Randomize) { - + if ($Randomize && !$ENV{TEST_NGINX_NO_CLEAN}) { - if (defined $ServRoot && -d $ServRoot && $ServRoot =~ m{/t/servroot_\d+}) { - system("rm -rf $ServRoot"); - } EOF patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF' @@ -1953,10 +1953,14 @@ @@ -107,6 +100,15 @@ EOF + $opts = "$UseValgrind $opts"; $cmd = "valgrind -q $opts $cmd"; } +EOF + patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF' + @@ -960,5 +960,5 @@ sub write_config_file ($$$) { + bail_out "Can't open $ConfFile for writing: $!\n"; + + print $out "daemon $DaemonEnabled;" if ($DaemonEnabled eq 'off'); + print $out <<_EOC_; + worker_processes $Workers; + -daemon $DaemonEnabled; + master_process $MasterProcessEnabled; EOF patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Socket.pm <<'EOF' @@ -813,6 +813,10 @@ again: @@ -121,7 +123,16 @@ EOF if (!defined $block->ignore_response) { EOF + patch --forward --ignore-whitespace lib/perl5/Test/Nginx/Util.pm <<'EOF' + @@ -484,6 +484,7 @@ sub master_process_enabled (@) { + } + our @EXPORT = qw( + + gen_rand_port + use_http2 + use_http3 + env_to_nginx +EOF set -e popd