Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(*) opt-in Valgrind test cases #447

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"t/lib/proxy-wasm-tests/rust-sdk-ver-zero-one",
"t/lib/proxy-wasm-tests/benchmarks",
"t/lib/proxy-wasm-tests/instance-lifecycle",
"t/lib/proxy-wasm-tests/context-checks",
]
exclude = [
"lib/ngx-wasm-rs",
Expand Down
33 changes: 16 additions & 17 deletions src/common/proxy_wasm/ngx_proxy_wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ action2rc(ngx_proxy_wasm_ctx_t *pwctx,
case NGX_HTTP_REWRITE_PHASE:
case NGX_HTTP_ACCESS_PHASE:
case NGX_HTTP_CONTENT_PHASE:
case NGX_WASM_BACKGROUND_PHASE:
ngx_log_debug6(NGX_LOG_DEBUG_WASM, pwctx->log, 0,
"proxy_wasm pausing in \"%V\" phase "
"(filter: %l/%l, step: %d, action: %d, "
Expand Down Expand Up @@ -683,6 +684,7 @@ ngx_proxy_wasm_run_step(ngx_proxy_wasm_exec_t *pwexec,
ngx_int_t rc;
ngx_proxy_wasm_err_e ecode;
ngx_proxy_wasm_action_e action = NGX_PROXY_WASM_ACTION_CONTINUE;
ngx_proxy_wasm_exec_t *out;
ngx_proxy_wasm_ctx_t *pwctx = pwexec->parent;
ngx_proxy_wasm_filter_t *filter = pwexec->filter;
#if (NGX_DEBUG)
Expand All @@ -700,10 +702,12 @@ ngx_proxy_wasm_run_step(ngx_proxy_wasm_exec_t *pwexec,
if (pwexec->ictx == NULL || pwexec->ictx->instance->trapped) {
#endif
ecode = ngx_proxy_wasm_create_context(filter, pwctx, pwexec->id,
pwexec, NULL);
pwexec, &out);
if (ecode != NGX_PROXY_WASM_ERR_NONE) {
return ecode;
}

pwexec = out;
#if 1
}
#endif
Expand Down Expand Up @@ -842,6 +846,9 @@ get_instance(ngx_proxy_wasm_filter_t *filter,

dd("get instance in store: %p", store);

/* store initialized */
ngx_wasm_assert(store->pool);

for (q = ngx_queue_head(&store->busy);
q != ngx_queue_sentinel(&store->busy);
q = ngx_queue_next(q))
Expand Down Expand Up @@ -988,9 +995,6 @@ ngx_proxy_wasm_create_context(ngx_proxy_wasm_filter_t *filter,
ictx = in->ictx;

} else {
/* store initialized */
ngx_wasm_assert(store->pool);

ictx = get_instance(filter, store, log);
if (ictx == NULL) {
goto error;
Expand Down Expand Up @@ -1187,10 +1191,15 @@ ngx_proxy_wasm_create_context(ngx_proxy_wasm_filter_t *filter,

pwexec->started = 1;
}
}

if (out) {
*out = pwexec;
if (out) {
*out = pwexec;
}

} else {
if (out) {
*out = rexec;
}
}

return NGX_PROXY_WASM_ERR_NONE;
Expand Down Expand Up @@ -1245,19 +1254,9 @@ ngx_proxy_wasm_on_done(ngx_proxy_wasm_exec_t *pwexec)
pwexec->index + 1, pwexec->parent->nfilters);

#if 0
/**
* Currently, dispatches are synchronous hence will always
* have been executed when on_done is invoked.
*/
#ifdef NGX_WASM_HTTP
call = pwexec->call;
if (call) {
ngx_log_debug3(NGX_LOG_DEBUG_WASM, pwexec->log, 0,
"proxy_wasm \"%V\" filter (%l/%l) "
"cancelling HTTP dispatch",
pwexec->filter->name, pwexec->index + 1,
pwexec->parent->nfilters);

ngx_http_proxy_wasm_dispatch_destroy(call);

pwexec->call = NULL;
Expand Down
Loading
Loading