diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ea8a44ef..4e682681a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,7 +147,7 @@ jobs: strategy: fail-fast: false matrix: - label: [""] + label: ["wasmer_full"] os: [ubuntu-22.04] cc: [gcc-12] ngx: [1.25.3] @@ -160,31 +160,56 @@ jobs: debug: [debug] include: # Wasmtime - - runtime: wasmtime + - label: wasmtime + runtime: wasmtime wasmtime: 14.0.3 os: ubuntu-22.04 cc: gcc-12 ngx: 1.25.3 hup: no_hup debug: debug + path: t/01-wasm # V8 - - runtime: v8 + - label: v8 + runtime: v8 v8: 11.4.183.23 os: ubuntu-22.04 cc: gcc-12 ngx: 1.25.3 debug: debug hup: no_hup + path: t/01-wasm # OpenResty - label: openresty + runtime: wasmer + wasmer: 3.1.1 os: ubuntu-22.04 cc: gcc-12 openresty: 1.21.4.2 ngx: + debug: debug + hup: no_hup + path: t/04-openresty + # Wasmtime hfuncs + - label: wasmtime_hfuncs + runtime: wasmtime + wasmtime: 14.0.3 + os: ubuntu-22.04 + cc: gcc-12 + ngx: 1.25.3 + hup: no_hup + debug: debug + path: t/03-proxy_wasm/hfuncs + # Wasmer hfuncs + - label: wasmer_hfuncs runtime: wasmer wasmer: 3.1.1 - debug: debug + os: ubuntu-22.04 + cc: gcc-12 + ngx: 1.25.3 hup: no_hup + debug: debug + path: t/03-proxy_wasm/hfuncs uses: ./.github/workflows/job-valgrind-tests.yml with: os: ${{ matrix.os }} diff --git a/.github/workflows/job-valgrind-tests.yml b/.github/workflows/job-valgrind-tests.yml index 759ba350d..df8005818 100644 --- a/.github/workflows/job-valgrind-tests.yml +++ b/.github/workflows/job-valgrind-tests.yml @@ -33,6 +33,9 @@ on: hup: required: true type: string + path: + required: false + type: string defaults: run: @@ -46,6 +49,7 @@ env: NGX_BUILD_CC_OPT: '-O2' NGX_BUILD_NOPOOL: 1 TEST_NGINX_USE_VALGRIND: 1 + TEST_NGINX_USE_VALGRIND_ALL: ${{ inputs.path == '' && 0 || 1 }} TEST_NGINX_USE_HUP: ${{ inputs.hup == 'hup' && 1 || 0 }} TEST_NGINX_RANDOMIZE: 1 TEST_NGINX_NO_CLEAN: 1 @@ -101,7 +105,10 @@ jobs: ghcr_password: ${{ secrets.TOKEN_GITHUB }} - run: make setup - run: make - - run: make test 2>&1 | tee valgrind.out + #- run: make test 2>&1 | tee valgrind.out + - run: | + IN_PATH="${{ inputs.path }}" + ./util/test.sh ${IN_PATH:-t/} 2>&1 | tee valgrind.out - run: | awk -f ./util/parse-valgrind.awk valgrind.out > valgrind.log if [[ -s valgrind.log ]]; then diff --git a/t/01-wasm/002-shm_queue_sanity.t b/t/01-wasm/002-shm_queue_sanity.t index 7182f48ed..0acedb318 100644 --- a/t/01-wasm/002-shm_queue_sanity.t +++ b/t/01-wasm/002-shm_queue_sanity.t @@ -6,7 +6,7 @@ use t::TestWasm; workers(2); master_on(); -skip_valgrind(); +#skip_valgrind(); plan tests => repeat_each() * (blocks() * 5); diff --git a/t/01-wasm/003-shm_kv_sanity.t b/t/01-wasm/003-shm_kv_sanity.t index 19c7600e6..d890d6479 100644 --- a/t/01-wasm/003-shm_kv_sanity.t +++ b/t/01-wasm/003-shm_kv_sanity.t @@ -6,7 +6,7 @@ use t::TestWasm; workers(2); master_on(); -skip_valgrind(); +#skip_valgrind(); plan tests => repeat_each() * (blocks() * 5); diff --git a/t/01-wasm/directives/001-module_directive.t b/t/01-wasm/directives/001-module_directive.t index 0946d01f2..15bafdb71 100644 --- a/t/01-wasm/directives/001-module_directive.t +++ b/t/01-wasm/directives/001-module_directive.t @@ -8,13 +8,12 @@ our $nginxV = $t::TestWasm::nginxV; plan tests => repeat_each() * (blocks() * 4); +no_shuffle(); run_tests(); __DATA__ === TEST 1: module directive - valid .wasm module -Too slow for Valgrind ---- skip_valgrind: 4 --- main_config eval qq{ wasm { @@ -67,6 +66,7 @@ qr/\[debug\] .*? wasm loading "b" module bytes from ".*?a\.wat"/] === TEST 4: module directive - invalid arguments +--- skip_valgrind: 4 --- main_config wasm { module $TEST_NGINX_HTML_DIR/a.wat; @@ -81,6 +81,7 @@ qr/\[emerg\] .*? invalid number of arguments in "module" directive/ === TEST 5: module directive - bad name +--- skip_valgrind: 4 --- main_config wasm { module '' $TEST_NGINX_HTML_DIR/a.wat; @@ -95,6 +96,7 @@ qr/\[emerg\] .*? invalid module name ""/ === TEST 6: module directive - bad path +--- skip_valgrind: 4 --- main_config wasm { module a ''; @@ -109,6 +111,7 @@ qr/\[emerg\] .*? invalid module path ""/ === TEST 7: module directive - already defined +--- skip_valgrind: 4 --- main_config wasm { module a $TEST_NGINX_HTML_DIR/a.wat; @@ -127,6 +130,7 @@ qr/\[emerg\] .*? "a" module already defined/ === TEST 8: module directive - no such path +--- skip_valgrind: 4 --- main_config wasm { module a $TEST_NGINX_HTML_DIR/none.wat; @@ -141,6 +145,7 @@ qr/\[emerg\] .*? \[wasm\] open\(\) ".*?none\.wat" failed \(2: No such file or di === TEST 9: module directive - no .wat bytes - wasmtime, wasmer +--- skip_valgrind: 4 --- skip_eval: 4: !( $::nginxV =~ m/wasmtime/ || $::nginxV =~ m/wasmer/ ) --- main_config wasm { @@ -160,6 +165,7 @@ qr/\[emerg\] .*? \[wasm\] open\(\) ".*?none\.wat" failed \(2: No such file or di === TEST 10: module directive - no .wat bytes - v8 +--- skip_valgrind: 4 --- skip_eval: 4: $::nginxV !~ m/v8/ --- main_config wasm { @@ -179,6 +185,7 @@ qr/\[emerg\] .*? \[wasm\] open\(\) ".*?none\.wat" failed \(2: No such file or di === TEST 11: module directive - no .wasm bytes +--- skip_valgrind: 4 --- main_config wasm { module a $TEST_NGINX_HTML_DIR/a.wasm; @@ -197,6 +204,7 @@ qr/\[emerg\] .*? \[wasm\] open\(\) ".*?none\.wat" failed \(2: No such file or di === TEST 12: module directive - invalid .wat module - wasmtime, wasmer +--- skip_valgrind: 4 --- skip_eval: 4: !( $::nginxV =~ m/wasmtime/ || $::nginxV =~ m/wasmer/ ) --- main_config wasm { @@ -219,6 +227,7 @@ qr/\[emerg\] .*? \[wasm\] open\(\) ".*?none\.wat" failed \(2: No such file or di === TEST 13: module directive - invalid .wat module - v8 +--- skip_valgrind: 4 --- skip_eval: 4: $::nginxV !~ m/v8/ --- main_config wasm { diff --git a/t/01-wasm/directives/002-compiler_directive.t b/t/01-wasm/directives/002-compiler_directive.t index dfffff79e..ad0fe43a2 100644 --- a/t/01-wasm/directives/002-compiler_directive.t +++ b/t/01-wasm/directives/002-compiler_directive.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind(); +skip_valgrind('always'); our $nginxV = $t::TestWasm::nginxV; diff --git a/t/01-wasm/directives/003-shm_directives.t b/t/01-wasm/directives/003-shm_directives.t index 2ac92e75e..9563034e6 100644 --- a/t/01-wasm/directives/003-shm_directives.t +++ b/t/01-wasm/directives/003-shm_directives.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind(); +#skip_valgrind('always'); plan tests => repeat_each() * (blocks() * 5); diff --git a/t/01-wasm/directives/004-resolver_directive.t b/t/01-wasm/directives/004-resolver_directive.t index 041540592..c367f8dc8 100644 --- a/t/01-wasm/directives/004-resolver_directive.t +++ b/t/01-wasm/directives/004-resolver_directive.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind(); +#skip_valgrind(); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/01-wasm/directives/005-socket_directives.t b/t/01-wasm/directives/005-socket_directives.t index 9376ad4c0..dd42fbaf4 100644 --- a/t/01-wasm/directives/005-socket_directives.t +++ b/t/01-wasm/directives/005-socket_directives.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind(); +#skip_valgrind(); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/01-wasm/directives/006-backtraces_directive.t b/t/01-wasm/directives/006-backtraces_directive.t index 9fa2a6cb7..40c63135b 100644 --- a/t/01-wasm/directives/006-backtraces_directive.t +++ b/t/01-wasm/directives/006-backtraces_directive.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind('wasmtime'); +#skip_valgrind('wasmtime'); our $nginxV = $t::TestWasm::nginxV; diff --git a/t/01-wasm/directives/008-flag_directive_wasmtime.t b/t/01-wasm/directives/008-flag_directive_wasmtime.t index 89c4259bb..8af43951c 100644 --- a/t/01-wasm/directives/008-flag_directive_wasmtime.t +++ b/t/01-wasm/directives/008-flag_directive_wasmtime.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind(); +skip_valgrind('always'); our $nginxV = $t::TestWasm::nginxV; our $osname = $t::TestWasm::osname; diff --git a/t/01-wasm/directives/009-flag_directive_wasmer.t b/t/01-wasm/directives/009-flag_directive_wasmer.t index f393152f6..c9a4d5c8f 100644 --- a/t/01-wasm/directives/009-flag_directive_wasmer.t +++ b/t/01-wasm/directives/009-flag_directive_wasmer.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind(); +skip_valgrind('always'); our $nginxV = $t::TestWasm::nginxV; diff --git a/t/01-wasm/directives/010-flag_directive_v8.t b/t/01-wasm/directives/010-flag_directive_v8.t index 8659bd001..ae0ef8830 100644 --- a/t/01-wasm/directives/010-flag_directive_v8.t +++ b/t/01-wasm/directives/010-flag_directive_v8.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind(); +skip_valgrind('always'); our $nginxV = $t::TestWasm::nginxV; diff --git a/t/01-wasm/hfuncs/001-log.t b/t/01-wasm/hfuncs/001-log.t index 5ead7563a..3e3b21e14 100644 --- a/t/01-wasm/hfuncs/001-log.t +++ b/t/01-wasm/hfuncs/001-log.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind(); +skip_valgrind('always'); plan tests => repeat_each() * (blocks() * 3); diff --git a/t/02-http/002-wasm_oob.t b/t/02-http/002-wasm_oob.t index cc5a5b2f8..7ab536933 100644 --- a/t/02-http/002-wasm_oob.t +++ b/t/02-http/002-wasm_oob.t @@ -4,8 +4,6 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind(); - plan tests => repeat_each() * (blocks() * 4); run_tests(); @@ -13,6 +11,7 @@ run_tests(); __DATA__ === TEST 1: wasm - oob memory read +--- skip_valgrind: 4 --- main_config wasm { module a $TEST_NGINX_HTML_DIR/a.wat; @@ -41,6 +40,7 @@ qr/(\[error\] .*? out of bounds|wasm trap: out of bounds memory access|Uncaught === TEST 2: wasm - oob memory write +--- skip_valgrind: 4 --- main_config wasm { module a $TEST_NGINX_HTML_DIR/a.wat; diff --git a/t/03-proxy_wasm/hfuncs/106-proxy_get_http_response_header.t b/t/03-proxy_wasm/hfuncs/106-proxy_get_http_response_header.t index 36c8ba5c8..8b5496ec8 100644 --- a/t/03-proxy_wasm/hfuncs/106-proxy_get_http_response_header.t +++ b/t/03-proxy_wasm/hfuncs/106-proxy_get_http_response_header.t @@ -301,6 +301,7 @@ resp header "connection: close".*/ === TEST 10: proxy_wasm - get_http_response_header() get Connection header (keep-alive) +--- skip_valgrind: 5 --- timeout_expected: 5 --- abort --- load_nginx_modules: ngx_http_echo_module @@ -379,6 +380,7 @@ resp header "connection: upgrade".*/ === TEST 12: proxy_wasm - get_http_response_header() get Keep-Alive header +--- skip_valgrind: 5 --- timeout_expected: 5 --- abort --- load_nginx_modules: ngx_http_echo_module diff --git a/t/03-proxy_wasm/hfuncs/111-proxy_set_http_request_header.t b/t/03-proxy_wasm/hfuncs/111-proxy_set_http_request_header.t index 8c7a05bb5..8521ece21 100644 --- a/t/03-proxy_wasm/hfuncs/111-proxy_set_http_request_header.t +++ b/t/03-proxy_wasm/hfuncs/111-proxy_set_http_request_header.t @@ -160,6 +160,7 @@ qr/.*? on_request_headers, 22 headers.* === TEST 7: proxy_wasm - set_http_request_header() sets Connection header (keep-alive) +--- skip_valgrind: 5 --- timeout_expected: 5 --- abort --- wasm_modules: hostcalls diff --git a/t/03-proxy_wasm/hfuncs/112-proxy_set_http_response_header.t b/t/03-proxy_wasm/hfuncs/112-proxy_set_http_response_header.t index 37d107ab7..23ac5f603 100644 --- a/t/03-proxy_wasm/hfuncs/112-proxy_set_http_response_header.t +++ b/t/03-proxy_wasm/hfuncs/112-proxy_set_http_response_header.t @@ -199,6 +199,7 @@ resp Connection: upgrade.*/ === TEST 8: proxy_wasm - set_http_response_header() sets Connection header (keep-alive) +--- skip_valgrind: 5 --- timeout_expected: 5 --- abort --- wasm_modules: hostcalls diff --git a/t/03-proxy_wasm/hfuncs/contexts/002-set_tick_period.t b/t/03-proxy_wasm/hfuncs/contexts/002-set_tick_period.t index 14821cc2b..b8f213f3e 100644 --- a/t/03-proxy_wasm/hfuncs/contexts/002-set_tick_period.t +++ b/t/03-proxy_wasm/hfuncs/contexts/002-set_tick_period.t @@ -6,7 +6,7 @@ use t::TestWasm; skip_hup(); skip_no_debug(); -skip_valgrind(); +skip_valgrind('always'); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/03-proxy_wasm/hfuncs/contexts/100-proxy_log.t b/t/03-proxy_wasm/hfuncs/contexts/100-proxy_log.t index 7e7002078..dff0ae0f1 100644 --- a/t/03-proxy_wasm/hfuncs/contexts/100-proxy_log.t +++ b/t/03-proxy_wasm/hfuncs/contexts/100-proxy_log.t @@ -6,7 +6,7 @@ use t::TestWasm; skip_hup(); skip_no_debug(); -skip_valgrind(); +skip_valgrind('always'); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/03-proxy_wasm/hfuncs/contexts/113-proxy_get_http_request_body.t b/t/03-proxy_wasm/hfuncs/contexts/113-proxy_get_http_request_body.t index 4239142d2..0ff1f540e 100644 --- a/t/03-proxy_wasm/hfuncs/contexts/113-proxy_get_http_request_body.t +++ b/t/03-proxy_wasm/hfuncs/contexts/113-proxy_get_http_request_body.t @@ -6,7 +6,7 @@ use t::TestWasm; skip_hup(); skip_no_debug(); -skip_valgrind(); +skip_valgrind('always'); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/03-proxy_wasm/hfuncs/contexts/114-proxy_set_http_request_body.t b/t/03-proxy_wasm/hfuncs/contexts/114-proxy_set_http_request_body.t index 1ee7e02de..f3c7a16bc 100644 --- a/t/03-proxy_wasm/hfuncs/contexts/114-proxy_set_http_request_body.t +++ b/t/03-proxy_wasm/hfuncs/contexts/114-proxy_set_http_request_body.t @@ -6,7 +6,7 @@ use t::TestWasm; skip_hup(); skip_no_debug(); -skip_valgrind(); +skip_valgrind('always'); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/03-proxy_wasm/hfuncs/contexts/115-proxy_get_http_response_body.t b/t/03-proxy_wasm/hfuncs/contexts/115-proxy_get_http_response_body.t index e0d28a3db..c5bfadaa3 100644 --- a/t/03-proxy_wasm/hfuncs/contexts/115-proxy_get_http_response_body.t +++ b/t/03-proxy_wasm/hfuncs/contexts/115-proxy_get_http_response_body.t @@ -6,7 +6,7 @@ use t::TestWasm; skip_hup(); skip_no_debug(); -skip_valgrind(); +skip_valgrind('always'); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/03-proxy_wasm/hfuncs/contexts/116-proxy_set_http_response_body.t b/t/03-proxy_wasm/hfuncs/contexts/116-proxy_set_http_response_body.t index e7f6c8d6d..792373a0c 100644 --- a/t/03-proxy_wasm/hfuncs/contexts/116-proxy_set_http_response_body.t +++ b/t/03-proxy_wasm/hfuncs/contexts/116-proxy_set_http_response_body.t @@ -6,7 +6,7 @@ use t::TestWasm; skip_hup(); skip_no_debug(); -skip_valgrind(); +skip_valgrind('always'); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/03-proxy_wasm/hfuncs/contexts/130-proxy_dispatch_http.t b/t/03-proxy_wasm/hfuncs/contexts/130-proxy_dispatch_http.t index 78a8a9660..65469b03d 100644 --- a/t/03-proxy_wasm/hfuncs/contexts/130-proxy_dispatch_http.t +++ b/t/03-proxy_wasm/hfuncs/contexts/130-proxy_dispatch_http.t @@ -6,7 +6,7 @@ use t::TestWasm; skip_hup(); skip_no_debug(); -skip_valgrind(); +skip_valgrind('always'); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/03-proxy_wasm/hfuncs/contexts/131-proxy_get_http_dispatch_response_body.t b/t/03-proxy_wasm/hfuncs/contexts/131-proxy_get_http_dispatch_response_body.t index 335182ca4..05efb5d5d 100644 --- a/t/03-proxy_wasm/hfuncs/contexts/131-proxy_get_http_dispatch_response_body.t +++ b/t/03-proxy_wasm/hfuncs/contexts/131-proxy_get_http_dispatch_response_body.t @@ -6,7 +6,7 @@ use t::TestWasm; skip_hup(); skip_no_debug(); -skip_valgrind(); +skip_valgrind('always'); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/05-others/002-resolver_add_sanity.t b/t/05-others/002-resolver_add_sanity.t index d4dc7e4ef..df7417bf8 100644 --- a/t/05-others/002-resolver_add_sanity.t +++ b/t/05-others/002-resolver_add_sanity.t @@ -4,7 +4,7 @@ use strict; use lib '.'; use t::TestWasm; -skip_valgrind('wasmtime'); +#skip_valgrind('wasmtime'); plan tests => repeat_each() * (blocks() * 4); diff --git a/t/05-others/011-upstream_connection_abort.t b/t/05-others/011-upstream_connection_abort.t index 1a17fd98a..ae07a178a 100644 --- a/t/05-others/011-upstream_connection_abort.t +++ b/t/05-others/011-upstream_connection_abort.t @@ -5,7 +5,6 @@ use lib '.'; use t::TestWasm; skip_hup(); -skip_valgrind(); plan tests => repeat_each() * (blocks() * 4); @@ -15,7 +14,7 @@ __DATA__ === TEST 1: upstream connection abort - wasm_call Calls on aborted upstream connections execute response phases on the produced -HTTP 502 response. +--- skip_valgrind: 4 --- skip_no_debug: 4 --- wasm_modules: ngx_rust_tests --- tcp_listen: $TEST_NGINX_UNIX_SOCKET @@ -50,6 +49,7 @@ wasm ops calling "ngx_rust_tests\.log_notice_hello" in "body_filter" phase\Z/ === TEST 2: upstream connection abort - chained filters Filters on aborted upstream connections execute response phases on the produced HTTP 502 response. +--- skip_valgrind: 4 --- wasm_modules: on_phases --- tcp_listen: $TEST_NGINX_UNIX_SOCKET --- tcp_shutdown: 2 diff --git a/t/TestWasm.pm b/t/TestWasm.pm index 9493a58e2..06761c1db 100644 --- a/t/TestWasm.pm +++ b/t/TestWasm.pm @@ -55,6 +55,9 @@ sub skip_valgrind (@) { if ($nver =~ m/$skip/) { plan skip_all => "skipped with Valgrind (nginx -V matches '$skip')"; + + } elsif ($nver eq "always") { + plan skip_all => "skipped with Valgrind (always)"; } return; @@ -216,13 +219,22 @@ add_block_preprocessor(sub { } } + my $skip_n; + my @block_skip = (); + + if (defined $block->skip_eval + && $block->skip_eval =~ m/\s*(\d+):\s*(.*)/) + { + push @block_skip, $2; + } + # --- skip_no_debug: 3 if (defined $block->skip_no_debug - && !defined $block->skip_eval && $block->skip_no_debug =~ m/\s*(\d+)/) { - $block->set_value("skip_eval", sprintf '%d: $::nginxV !~ m/--with-debug/', $1); + $skip_n = $1; + push @block_skip, '$::nginxV !~ m/--with-debug/'; } # --- skip_valgrind: 3 @@ -231,7 +243,13 @@ add_block_preprocessor(sub { && $ENV{TEST_NGINX_USE_VALGRIND} && $block->skip_valgrind =~ m/\s*(\d+)/) { - $block->set_value("skip_eval", sprintf '%d: $ENV{TEST_NGINX_USE_VALGRIND} && !$ENV{TEST_NGINX_USE_VALGRIND_ALL}', $1); + $skip_n = $1; + push @block_skip, '$ENV{TEST_NGINX_USE_VALGRIND}'; + } + + if (defined $skip_n) { + $block->set_value("skip_eval", sprintf('%d: (%s)', $skip_n, + join " || ", @block_skip)); } # --- timeout_expected: 1