Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Nov 17, 2023
1 parent b4c840b commit 7c38cb2
Show file tree
Hide file tree
Showing 30 changed files with 101 additions and 39 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -158,6 +158,7 @@ jobs:
v8: [""]
hup: [no_hup, hup]
debug: [debug]
path: [""]
include:
# Wasmtime
- runtime: wasmtime
Expand All @@ -167,6 +168,7 @@ jobs:
ngx: 1.25.3
hup: no_hup
debug: debug
path: t/01-wasm
# V8
- runtime: v8
v8: 11.4.183.23
Expand All @@ -175,16 +177,38 @@ jobs:
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 }}
Expand All @@ -197,6 +221,7 @@ jobs:
v8: ${{ matrix.v8 }}
hup: ${{ matrix.hup }}
debug: ${{ matrix.debug }}
path: ${{ matrix.path }}
secrets: inherit

lint:
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/job-valgrind-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ on:
hup:
required: true
type: string
path:
required: false
type: string

defaults:
run:
Expand All @@ -46,8 +49,9 @@ 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_RANDOMIZE: 0
TEST_NGINX_NO_CLEAN: 1
TEST_NGINX_TIMEOUT: 120
TEST_NGINX_EXTERNAL_TIMEOUT: 120s
Expand Down Expand Up @@ -101,7 +105,10 @@ jobs:
ghcr_password: ${{ secrets.TOKEN_GITHUB }}
- run: make setup
- run: make
- run: make test 2>&1 | tee valgrind.out
- name: Run tests
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
Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/002-shm_queue_sanity.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use t::TestWasm;

workers(2);
master_on();
skip_valgrind();
#skip_valgrind();

plan tests => repeat_each() * (blocks() * 5);

Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/003-shm_kv_sanity.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use t::TestWasm;

workers(2);
master_on();
skip_valgrind();
#skip_valgrind();

plan tests => repeat_each() * (blocks() * 5);

Expand Down
13 changes: 11 additions & 2 deletions t/01-wasm/directives/001-module_directive.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -95,6 +96,7 @@ qr/\[emerg\] .*? invalid module name ""/
=== TEST 6: module directive - bad path
--- skip_valgrind: 4
--- main_config
wasm {
module a '';
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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;
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/directives/002-compiler_directive.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use lib '.';
use t::TestWasm;

skip_valgrind();
skip_valgrind('always');

our $nginxV = $t::TestWasm::nginxV;

Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/directives/003-shm_directives.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use lib '.';
use t::TestWasm;

skip_valgrind();
#skip_valgrind('always');

plan tests => repeat_each() * (blocks() * 5);

Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/directives/004-resolver_directive.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use lib '.';
use t::TestWasm;

skip_valgrind();
#skip_valgrind();

plan tests => repeat_each() * (blocks() * 4);

Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/directives/005-socket_directives.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use lib '.';
use t::TestWasm;

skip_valgrind();
#skip_valgrind();

plan tests => repeat_each() * (blocks() * 4);

Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/directives/006-backtraces_directive.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use lib '.';
use t::TestWasm;

skip_valgrind('wasmtime');
#skip_valgrind('wasmtime');

our $nginxV = $t::TestWasm::nginxV;

Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/directives/008-flag_directive_wasmtime.t
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/directives/009-flag_directive_wasmer.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use lib '.';
use t::TestWasm;

skip_valgrind();
skip_valgrind('always');

our $nginxV = $t::TestWasm::nginxV;

Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/directives/010-flag_directive_v8.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use lib '.';
use t::TestWasm;

skip_valgrind();
skip_valgrind('always');

our $nginxV = $t::TestWasm::nginxV;

Expand Down
2 changes: 1 addition & 1 deletion t/01-wasm/hfuncs/001-log.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use lib '.';
use t::TestWasm;

skip_valgrind();
skip_valgrind('always');

plan tests => repeat_each() * (blocks() * 3);

Expand Down
4 changes: 2 additions & 2 deletions t/02-http/002-wasm_oob.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ use strict;
use lib '.';
use t::TestWasm;

skip_valgrind();

plan tests => repeat_each() * (blocks() * 4);

run_tests();

__DATA__
=== TEST 1: wasm - oob memory read
--- skip_valgrind: 4
--- main_config
wasm {
module a $TEST_NGINX_HTML_DIR/a.wat;
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 5 additions & 6 deletions t/03-proxy_wasm/002-on_root_phases_failures.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use t::TestWasm;

skip_valgrind('wasmtime');

my $n = 4;
plan tests => repeat_each() * (blocks() * $n);
plan tests => repeat_each() * (blocks() * 4);

run_tests();

Expand All @@ -17,7 +16,7 @@ __DATA__
'daemon off' must be set to check exit_code is 2
Valgrind mode already writes 'daemon off'
HUP mode does not catch the worker exit_code
--- skip_eval: $n: $ENV{TEST_NGINX_USE_HUP} == 1
--- skip_eval: 4: $ENV{TEST_NGINX_USE_HUP} == 1
--- main_config eval
qq{
wasm {
Expand All @@ -43,7 +42,7 @@ qq{
'daemon off' must be set to check exit_code is 2
Valgrind mode already writes 'daemon off'
HUP mode does not catch the worker exit_code
--- skip_eval: $n: $ENV{TEST_NGINX_USE_HUP} == 1
--- skip_eval: 4: $ENV{TEST_NGINX_USE_HUP} == 1
--- main_config eval
qq{
wasm {
Expand All @@ -70,7 +69,7 @@ qq{
'daemon off' must be set to check exit_code is 2
Valgrind mode already writes 'daemon off'
HUP mode does not catch the worker exit_code
--- skip_eval: $n: $ENV{TEST_NGINX_USE_HUP} == 1
--- skip_eval: 4: $ENV{TEST_NGINX_USE_HUP} == 1
--- main_config eval
qq{
wasm {
Expand All @@ -96,7 +95,7 @@ qq{
'daemon off' must be set to check exit_code is 2
Valgrind mode already writes 'daemon off'
HUP mode does not catch the worker exit_code
--- skip_eval: $n: $ENV{TEST_NGINX_USE_HUP} == 1
--- skip_eval: 4: $ENV{TEST_NGINX_USE_HUP} == 1
--- main_config eval
qq{
wasm {
Expand Down
2 changes: 2 additions & 0 deletions t/03-proxy_wasm/hfuncs/106-proxy_get_http_response_header.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions t/03-proxy_wasm/hfuncs/111-proxy_set_http_request_header.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 7c38cb2

Please sign in to comment.