From e7e923223bacdd5d68eedc7352be97f9b9aaba61 Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Thu, 17 Aug 2023 21:55:51 -0700 Subject: [PATCH] tests(build) add test cases to ngx_wasm_rs_linking.t Remove a duplicated test and add 2 more tests with static libwee8 + dynamic ngx-wasm-rs. --- t/10-build/004-ngx_wasm_rs_linking.t | 75 ++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/t/10-build/004-ngx_wasm_rs_linking.t b/t/10-build/004-ngx_wasm_rs_linking.t index ef714d0b8..812e1a8c4 100644 --- a/t/10-build/004-ngx_wasm_rs_linking.t +++ b/t/10-build/004-ngx_wasm_rs_linking.t @@ -41,16 +41,7 @@ stub4 -=== TEST 3: dynamically linked libwee8 (environment variables) + dynamic ngx-wasm-rs built separately ---- SKIP: NYI - the V8 build system builds libwee8 statically ---- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'v8' ---- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build --features wat ) && NGX_WASM_CARGO=0 NGX_BUILD_CC_OPT="-I $pwd/lib/ngx-wasm-rs/include" NGX_BUILD_LD_OPT="-L$pwd/lib/ngx-wasm-rs/target/debug -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug-lngx_wasm_rs" make} ---- grep_nginxV -ngx_wasm_module [dev debug v8] - - - -=== TEST 4: dynamically linked libwasmer (environment variables) + dynamic ngx-wasm-rs built separately +=== TEST 3: dynamically linked libwasmer (environment variables) + dynamic ngx-wasm-rs built separately --- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'wasmer' --- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build ) && NGX_WASM_CARGO=0 NGX_BUILD_CC_OPT="-I $pwd/lib/ngx-wasm-rs/include" NGX_BUILD_LD_OPT="-L$pwd/lib/ngx-wasm-rs/target/debug -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug -lngx_wasm_rs" make} --- grep_nginxV @@ -64,7 +55,7 @@ stub2 -=== TEST 5: dynamically linked libwasmer (./configure arguments) + dynamic ngx-wasm-rs built separately +=== TEST 4: dynamically linked libwasmer (./configure arguments) + dynamic ngx-wasm-rs built separately --- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'wasmer' --- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build ) && NGX_WASM_CARGO=0 NGX_WASM_RUNTIME_INC= NGX_WASM_RUNTIME_LIB= NGX_WASM_RUNTIME_LD_OPT= NGX_BUILD_CONFIGURE_OPT="--with-cc-opt='-I$ENV{NGX_WASM_RUNTIME_DIR}/include -I$pwd/lib/ngx-wasm-rs/include' --with-ld-opt='-L$ENV{NGX_WASM_RUNTIME_DIR} -L$pwd/lib/ngx-wasm-rs/target/debug -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug -lngx_wasm_rs'" make} --- grep_nginxV @@ -78,10 +69,10 @@ stub2 -=== TEST 6: dynamically linked libwee8 (environment variables) + dynamic ngx-wasm-rs built separately +=== TEST 5: dynamically linked libwee8 (environment variables) + dynamic ngx-wasm-rs built separately --- SKIP: NYI - the V8 build system builds libwee8 statically --- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'v8' ---- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build --features wat ) && NGX_WASM_CARGO=0 NGX_BUILD_CC_OPT="-I $pwd/lib/ngx-wasm-rs/include" NGX_BUILD_LD_OPT="-L$pwd/lib/ngx-wasm-rs/target/debug -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug-lngx_wasm_rs" make} +--- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build --features wat ) && NGX_WASM_CARGO=0 NGX_BUILD_CC_OPT="-I $pwd/lib/ngx-wasm-rs/include" NGX_BUILD_LD_OPT="-L$pwd/lib/ngx-wasm-rs/target/debug -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug -lngx_wasm_rs" make} --- grep_nginxV ngx_wasm_module [dev debug v8] --- grep_libs @@ -93,10 +84,10 @@ stub2 -=== TEST 7: dynamically linked libwee8 (./configure arguments) + dynamic ngx-wasm-rs built separately +=== TEST 6: dynamically linked libwee8 (./configure arguments) + dynamic ngx-wasm-rs built separately --- SKIP: NYI - the V8 build system builds libwee8 statically --- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'v8' ---- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build --features wat ) && NGX_WASM_CARGO=0 NGX_WASM_RUNTIME_INC= NGX_WASM_RUNTIME_LIB= NGX_WASM_RUNTIME_LD_OPT= NGX_BUILD_CONFIGURE_OPT="--with-cc-opt='-I$ENV{NGX_WASM_RUNTIME_DIR}/include -I$pwd/lib/ngx-wasm-rs/include' --with-ld-opt='-L$ENV{NGX_WASM_RUNTIME_DIR} -L$pwd/lib/ngx-wasm-rs/target/debug -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug-lngx_wasm_rs'" make} +--- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build --features wat ) && NGX_WASM_CARGO=0 NGX_WASM_RUNTIME_INC= NGX_WASM_RUNTIME_LIB= NGX_WASM_RUNTIME_LD_OPT= NGX_BUILD_CONFIGURE_OPT="--with-cc-opt='-I$ENV{NGX_WASM_RUNTIME_DIR}/include -I$pwd/lib/ngx-wasm-rs/include' --with-ld-opt='-L$ENV{NGX_WASM_RUNTIME_DIR} -L$pwd/lib/ngx-wasm-rs/target/debug -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug -lngx_wasm_rs'" make} --- grep_nginxV ngx_wasm_module [dev debug v8] --- grep_libs @@ -108,7 +99,7 @@ stub2 -=== TEST 8: statically linked libwasmer (environment variables) + static ngx-wasm-rs built separately +=== TEST 7: statically linked libwasmer (environment variables) + static ngx-wasm-rs built separately --- SKIP: Cannot link two static Rust libraries linked with different compilers --- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'wasmer' --- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build ) && NGX_WASM_CARGO=0 NGX_BUILD_CC_OPT="-I $pwd/lib/ngx-wasm-rs/include" NGX_BUILD_LD_OPT="$pwd/lib/ngx-wasm-rs/target/debug/libngx_wasm_rs.a" NGX_WASM_RUNTIME_INC="$ENV{NGX_WASM_RUNTIME_DIR}/include" NGX_WASM_RUNTIME_LD_OPT="$ENV{NGX_WASM_RUNTIME_DIR}/lib/lib$ENV{NGX_WASM_RUNTIME}.a" make} @@ -126,7 +117,7 @@ libngx_wasm_rs -=== TEST 9: statically linked libwasmer (./configure arguments) + static ngx-wasm-rs built separately +=== TEST 8: statically linked libwasmer (./configure arguments) + static ngx-wasm-rs built separately --- SKIP: Cannot link two static Rust libraries linked with different compilers --- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'wasmer' --- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build ) && NGX_WASM_CARGO=0 NGX_WASM_RUNTIME_INC= NGX_WASM_RUNTIME_LIB= NGX_WASM_RUNTIME_LD_OPT= NGX_BUILD_CONFIGURE_OPT="--with-cc-opt='-I$ENV{NGX_WASM_RUNTIME_DIR}/include -I$pwd/lib/ngx-wasm-rs/include' --with-ld-opt='$ENV{NGX_WASM_RUNTIME_DIR}/lib/lib$ENV{NGX_WASM_RUNTIME}.a $pwd/lib/ngx-wasm-rs/target/debug/libngx_wasm_rs.a'" make} @@ -144,7 +135,7 @@ libngx_wasm_rs -=== TEST 10: statically linked libwee8 (environment variables) + static ngx-wasm-rs built separately +=== TEST 9: statically linked libwee8 (environment variables) + static ngx-wasm-rs built separately --- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'v8' --- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build --features wat ) && NGX_WASM_CARGO=0 NGX_BUILD_CC_OPT="-I $pwd/lib/ngx-wasm-rs/include" NGX_BUILD_LD_OPT="$pwd/lib/ngx-wasm-rs/target/debug/libngx_wasm_rs.a" NGX_WASM_RUNTIME_LD_OPT="$ENV{NGX_WASM_RUNTIME_DIR}/lib/libwee8.a -L$ENV{NGX_WASM_RUNTIME_DIR}/lib" make} --- grep_nginxV @@ -161,7 +152,7 @@ libngx_wasm_rs -=== TEST 11: statically linked libwee8 (./configure arguments) + static ngx-wasm-rs built separately +=== TEST 10: statically linked libwee8 (./configure arguments) + static ngx-wasm-rs built separately --- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'v8' --- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build --features wat ) && NGX_WASM_CARGO=0 NGX_WASM_RUNTIME_INC= NGX_WASM_RUNTIME_LIB= NGX_WASM_RUNTIME_LD_OPT= NGX_BUILD_CONFIGURE_OPT="--with-cc-opt='-I$ENV{NGX_WASM_RUNTIME_DIR}/include -I$pwd/lib/ngx-wasm-rs/include' --with-ld-opt='$ENV{NGX_WASM_RUNTIME_DIR}/lib/libwee8.a -L$ENV{NGX_WASM_RUNTIME_DIR} $pwd/lib/ngx-wasm-rs/target/debug/libngx_wasm_rs.a' " make} --- grep_nginxV @@ -178,7 +169,7 @@ libngx_wasm_rs -=== TEST 12: statically linked libwasmer (environment variables) + dynamic ngx-wasm-rs built separately +=== TEST 11: statically linked libwasmer (environment variables) + dynamic ngx-wasm-rs built separately --- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'wasmer' --- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build ) && NGX_WASM_CARGO=0 NGX_BUILD_CC_OPT="-I $pwd/lib/ngx-wasm-rs/include" NGX_BUILD_LD_OPT="-L$pwd/lib/ngx-wasm-rs/target/debug -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug -lngx_wasm_rs" NGX_WASM_RUNTIME_INC="$ENV{NGX_WASM_RUNTIME_DIR}/include" NGX_WASM_RUNTIME_LD_OPT="$ENV{NGX_WASM_RUNTIME_DIR}/lib/lib$ENV{NGX_WASM_RUNTIME}.a" make} --- grep_nginxV @@ -199,7 +190,7 @@ libwasmer -=== TEST 13: statically linked libwasmer (./configure arguments) + dynamic ngx-wasm-rs built separately +=== TEST 12: statically linked libwasmer (./configure arguments) + dynamic ngx-wasm-rs built separately --- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'wasmer' --- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build ) && NGX_WASM_CARGO=0 NGX_WASM_RUNTIME_INC= NGX_WASM_RUNTIME_LIB= NGX_WASM_RUNTIME_LD_OPT= NGX_BUILD_CONFIGURE_OPT="--with-cc-opt='-I$ENV{NGX_WASM_RUNTIME_DIR}/include -I$pwd/lib/ngx-wasm-rs/include' --with-ld-opt='$ENV{NGX_WASM_RUNTIME_DIR}/lib/lib$ENV{NGX_WASM_RUNTIME}.a -L$pwd/lib/ngx-wasm-rs/target/debug/ -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug/ -lngx_wasm_rs'" make} --- grep_nginxV @@ -217,3 +208,45 @@ ngx_wasm_module [dev debug wasmer] libngx_wasm_rs --- no_grep_libs libwasmer + + + +=== TEST 13: statically linked libwee8 (environment variables) + dynamic ngx-wasm-rs built separately +--- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'v8' +--- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build --features wat ) && NGX_WASM_CARGO=0 NGX_BUILD_CC_OPT="-I $pwd/lib/ngx-wasm-rs/include" NGX_BUILD_LD_OPT="-L$pwd/lib/ngx-wasm-rs/target/debug -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug -lngx_wasm_rs" NGX_WASM_RUNTIME_LD_OPT="$ENV{NGX_WASM_RUNTIME_DIR}/lib/libwee8.a -L$ENV{NGX_WASM_RUNTIME_DIR}/lib" make} +--- grep_nginxV +ngx_wasm_module [dev debug v8] +--- run_cmd eval: qq{nm -g $::buildroot/nginx} +--- grep_cmd eval +[ + qr/T _?wasm_store_new/, +] +--- no_grep_cmd eval +[ + qr/T _?ngx_wasm_backtrace_demangle/, +] +--- grep_libs +libngx_wasm_rs +--- no_grep_libs +libwee8 + + + +=== TEST 14: statically linked libwee8 (./configure arguments) + dynamic ngx-wasm-rs built separately +--- skip_eval: 6: $ENV{NGX_WASM_RUNTIME} ne 'v8' +--- build eval: use Cwd qw(cwd); my $pwd = cwd(); qq{( cd $pwd/lib/ngx-wasm-rs; cargo build --features wat ) && NGX_WASM_CARGO=0 NGX_WASM_RUNTIME_INC= NGX_WASM_RUNTIME_LIB= NGX_WASM_RUNTIME_LD_OPT= NGX_BUILD_CONFIGURE_OPT="--with-cc-opt='-I$ENV{NGX_WASM_RUNTIME_DIR}/include -I$pwd/lib/ngx-wasm-rs/include' --with-ld-opt='$ENV{NGX_WASM_RUNTIME_DIR}/lib/libwee8.a -L$pwd/lib/ngx-wasm-rs/target/debug/ -Wl,-rpath=$pwd/lib/ngx-wasm-rs/target/debug/ -lngx_wasm_rs'" make} +--- grep_nginxV +ngx_wasm_module [dev debug v8] +--- run_cmd eval: qq{nm -g $::buildroot/nginx} +--- grep_cmd eval +[ + qr/T _?wasm_store_new/, +] +--- no_grep_cmd eval +[ + qr/T _?ngx_wasm_backtrace_demangle/, +] +--- grep_libs +libngx_wasm_rs +--- no_grep_libs +libwee8