Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed May 5, 2024
1 parent 91d447f commit 9dfdec5
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 78 deletions.
151 changes: 76 additions & 75 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,21 @@ jobs:
v8: [""]
ipc: [no_ipc]
ssl: [ssl]
debug: [debug, no_debug]
#debug: [debug, no_debug]
debug: [debug]
hup: [no_hup]
module_type: [static]
include:
# Wasmtime
- runtime: wasmtime
wasmtime: 19.0.0
os: ubuntu-latest
cc: gcc-12
ngx: 1.25.5
ipc: no_ipc
ssl: ssl
debug: debug
hup: hup
#- runtime: wasmtime
# wasmtime: 19.0.0
# os: ubuntu-latest
# cc: gcc-12
# ngx: 1.25.5
# ipc: no_ipc
# ssl: ssl
# debug: debug
# hup: hup
# V8
- runtime: v8
v8: 12.0.267.17
Expand All @@ -66,72 +67,72 @@ jobs:
debug: debug
hup: no_hup
# Old Nginx
- label: old_nginx
os: ubuntu-latest
cc: gcc-12
ngx: 1.21.6
runtime: wasmer
wasmer: 3.1.1
ipc: no_ipc
ssl: ssl
debug: debug
hup: no_hup
# Nginx + dynamic ngx_wasmx_module + HUP
- label: dynamic_nginx
os: ubuntu-latest
cc: gcc-12
ngx: 1.25.5
runtime: wasmtime
wasmtime: 19.0.0
ipc: no_ipc
ssl: ssl
debug: debug
hup: hup
module_type: dynamic
# No SSL
- os: ubuntu-latest
cc: gcc-12
ngx: 1.25.5
runtime: wasmer
wasmer: 3.1.1
ipc: no_ipc
ssl: no_ssl
debug: no_debug
hup: no_hup
# OpenResty
- label: openresty
os: ubuntu-latest
cc: gcc-12
openresty: 1.25.3.1
runtime: wasmtime
wasmtime: 19.0.0
ipc: no_ipc
ssl: ssl
debug: debug
hup: no_hup
#- label: old_nginx
# os: ubuntu-latest
# cc: gcc-12
# ngx: 1.21.6
# runtime: wasmer
# wasmer: 3.1.1
# ipc: no_ipc
# ssl: ssl
# debug: debug
# hup: no_hup
## Nginx + dynamic ngx_wasmx_module + HUP
#- label: dynamic_nginx
# os: ubuntu-latest
# cc: gcc-12
# ngx: 1.25.5
# runtime: wasmtime
# wasmtime: 19.0.0
# ipc: no_ipc
# ssl: ssl
# debug: debug
# hup: hup
# module_type: dynamic
## No SSL
#- os: ubuntu-latest
# cc: gcc-12
# ngx: 1.25.5
# runtime: wasmer
# wasmer: 3.1.1
# ipc: no_ipc
# ssl: no_ssl
# debug: no_debug
# hup: no_hup
## OpenResty
#- label: openresty
# os: ubuntu-latest
# cc: gcc-12
# openresty: 1.25.3.1
# runtime: wasmtime
# wasmtime: 19.0.0
# ipc: no_ipc
# ssl: ssl
# debug: debug
# hup: no_hup
# OpenResty + dynamic ngx_wasmx_module
- label: dynamic_openresty
os: ubuntu-latest
cc: gcc-12
openresty: 1.25.3.1
runtime: wasmtime
wasmtime: 19.0.0
ipc: no_ipc
ssl: ssl
debug: debug
hup: no_hup
module_type: dynamic
# IPC
- label: ipc
os: ubuntu-latest
cc: gcc-12
ngx: 1.25.5
runtime: wasmtime
wasmtime: 19.0.0
ipc: ipc
ssl: no_ssl
debug: debug
hup: no_hup
#- label: dynamic_openresty
# os: ubuntu-latest
# cc: gcc-12
# openresty: 1.25.3.1
# runtime: wasmtime
# wasmtime: 19.0.0
# ipc: no_ipc
# ssl: ssl
# debug: debug
# hup: no_hup
# module_type: dynamic
## IPC
#- label: ipc
# os: ubuntu-latest
# cc: gcc-12
# ngx: 1.25.5
# runtime: wasmtime
# wasmtime: 19.0.0
# ipc: ipc
# ssl: no_ssl
# debug: debug
# hup: no_hup
uses: ./.github/workflows/job-unit-tests.yml
with:
os: ${{ matrix.os }}
Expand Down
30 changes: 28 additions & 2 deletions .github/workflows/job-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,19 @@ jobs:
os: ${{ inputs.os }}
ghcr_username: ${{ github.repository_owner }}
ghcr_password: ${{ secrets.TOKEN_GITHUB }}
- name: Setup coredumps location
run: |
mkdir $GITHUB_WORKSPACE/coredumps
sudo bash -c 'echo "$GITHUB_WORKSPACE/coredumps/%e.%p.%t" > /proc/sys/kernel/core_pattern'
- run: make setup
- run: make
- run: make test
#- run: make test
- name: Run make test
run: |
ulimit -c unlimited
ulimit -c
./util/test.sh t/01-wasm/directives/001-module_directive.t ||
ulimit -c
- name: Run lcov
id: lcov
if: ${{ !env.ACT && inputs.coverage }}
Expand Down Expand Up @@ -163,13 +173,29 @@ jobs:
flags: unit
- run: rm -f t/servroot/html/nginx.sock
if: ${{ failure() && !env.ACT }}
- uses: actions/upload-artifact@v4
- name: Prefix Upload
uses: actions/upload-artifact@v4
if: ${{ failure() && !env.ACT }}
with:
name: ${{ github.job }}-sha-${{ github.sha }}-run-${{ github.run_number }}-${{ inputs.ngx != '' && format('nginx-{0}', inputs.ngx) || format('openresty-{0}', inputs.openresty) }}-${{ inputs.runtime }}-${{ inputs.module_type == 'dynamic' && 'dynamic' || 'static'}}-${{ inputs.ipc }}-${{ inputs.ssl }}-${{ inputs.debug }}-${{ inputs.hup }}
path: |
work/buildroot/
t/servroot*
- name: Executable Upload
uses: actions/upload-artifact@v4
if: ${{ failure() && !env.ACT }}
with:
name: executable
path: work/buildroot/nginx
- name: Coredumps Upload
uses: actions/upload-artifact@v4
if: ${{ failure() && !env.ACT }}
with:
name: coredumps
path: $GITHUB_WORKSPACE/coredumps
#- name: Setup tmate session
# if: ${{ failure() && !env.ACT }}
# uses: mxschmitt/action-tmate@v3
- name: Cleanup
if: ${{ always() }}
uses: ./.github/actions/cleanup
6 changes: 5 additions & 1 deletion lib/ngx-wasm-rs/lib/wat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ pub unsafe extern "C" fn ngx_wasm_wat_to_wasm(
wat: *const wasm_byte_vec_t,
wasm: *mut wasm_byte_vec_t,
) -> Option<Box<wasm_byte_vec_t>> {
let wat_slice;
let empty = Vec::new();
let mut wat_slice = empty.as_ref();

unsafe {
//if (*wat).size > 0 {
wat_slice = std::slice::from_raw_parts((*wat).data, (*wat).size);
//}
}

match wabt::wat2wasm(wat_slice) {
Expand Down
1 change: 1 addition & 0 deletions t/01-wasm/directives/001-module_directive.t
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ qr/\[emerg\] .*? \[wasm\] open\(\) ".*?none\.wat" failed \(2: No such file or di


=== TEST 10: module directive - no .wat bytes - v8
--- ONLY
--- skip_eval: 4: $::nginxV !~ m/v8/
--- main_config
wasm {
Expand Down

0 comments on commit 9dfdec5

Please sign in to comment.