Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed May 8, 2024
1 parent 29671d4 commit 34b183e
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/job-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
sudo bash -c 'echo "${{ github.workspace }}/coredumps/%e.%p.%t" > /proc/sys/kernel/core_pattern'
- run: make setup
- run: make
- name: Run make test
- name: Run tests
run: |
ulimit -c unlimited
make test
Expand Down
1 change: 0 additions & 1 deletion src/common/lua/ngx_wasm_lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,6 @@ ngx_wasm_lua_thread_run(ngx_wasm_lua_ctx_t *lctx)
ngx_int_t
ngx_wasm_lua_resume(ngx_wasm_subsys_env_t *env)
{
size_t i;
ngx_int_t rc;
ngx_queue_t *q;
ngx_http_lua_ctx_t *ctx;
Expand Down
2 changes: 1 addition & 1 deletion src/common/lua/ngx_wasm_lua_resolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static const char *DNS_SOLVING_SCRIPT = ""
" 'nameserver ' .. nameserver, \n"
" 'options timeout:' .. timeout, \n"
" }, \n"
" noSynchronisation = true, \n"
" --noSynchronisation = true, \n"
" }) \n"
" if not ok then \n"
" error(fmt('wasm lua failed initializing dns_client ' .. \n"
Expand Down
2 changes: 2 additions & 0 deletions src/common/proxy_wasm/ngx_proxy_wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,8 @@ ngx_proxy_wasm_dispatch_calls_total(ngx_proxy_wasm_exec_t *pwexec)
q != ngx_queue_sentinel(&pwexec->calls);
q = ngx_queue_next(q), n++) { /* void */ }

dd("n: %ld", n);

return n;
}

Expand Down
25 changes: 24 additions & 1 deletion src/http/ngx_http_wasm_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,6 @@ ngx_http_wasm_rewrite_handler(ngx_http_request_t *r)
break;
default:
ngx_wa_assert(rc == NGX_ERROR);
rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
goto done;
}
#endif
Expand Down Expand Up @@ -1075,6 +1074,30 @@ ngx_http_wasm_content_handler(ngx_http_request_t *r)

rctx->entered_content_phase = 1;

#if (NGX_WASM_LUA)
/* Lua yield in previous content may have replaced
* r->write_event_handler with ngx_http_core_run_phases; force
* our lua thread resume */
rc = ngx_wasm_lua_resume(&rctx->env);
dd("wasm lua resume rc: %ld", rc);
switch (rc) {
case NGX_AGAIN:
if (r == r->main) {
r->main->count++;
dd("r->main->count++: %d", r->main->count);
rc = NGX_DONE;
}

goto done;
case NGX_OK:
break;
default:
ngx_wa_assert(rc == NGX_ERROR);
rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
goto done;
}
#endif

rc = ngx_http_wasm_content(rctx);

done:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,7 @@ ok
echo ok;
}
--- request
GET /t

POST /t
Hello world
--- response_headers_like
pwm-call-id: \d, \d, \d, \d
Expand Down
1 change: 0 additions & 1 deletion t/lib/proxy-wasm-tests/hostcalls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ impl RootContext for TestRoot {
config: self.config.clone(),
on_phases: phases,
n_sync_calls: 0,
ncalls: 0,
}))
}
}
Expand Down
1 change: 0 additions & 1 deletion t/lib/proxy-wasm-tests/hostcalls/src/types/test_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub struct TestHttp {
pub on_phases: Vec<TestPhase>,
pub config: HashMap<String, String>,
pub n_sync_calls: usize,
pub ncalls: usize,
}

impl TestHttp {
Expand Down

0 comments on commit 34b183e

Please sign in to comment.