diff --git a/util/clean.sh b/util/clean.sh index e100024bc..da76d22d3 100755 --- a/util/clean.sh +++ b/util/clean.sh @@ -31,6 +31,7 @@ if [[ "$1" == "--all" || "$1" == "--more" ]]; then $DIR_PREFIX \ $DIR_DIST_OUT \ $DIR_DIST_WORK \ + $DIR_TESTS_LIB_WASM remove_luarocks cargo clean --manifest-path lib/Cargo.toml cargo clean --manifest-path t/lib/Cargo.toml diff --git a/util/sdk.sh b/util/sdk.sh index caf123adf..ab2517e42 100755 --- a/util/sdk.sh +++ b/util/sdk.sh @@ -42,6 +42,9 @@ Options: --build Build a Proxy-Wasm SDK and example filters. + --install Copy all compiled Proxy-Wasm SDK example filters + to work/lib/wasm for test suites. + -V, --sdk-ver Proxy-Wasm SDK version to build (e.g. '0.2.1') -f, --force, --clean Force a clean build with --build, @@ -72,6 +75,9 @@ while [[ "$1" ]]; do --build) MODE="build" ;; + --install) + MODE="install" + ;; --clean|--force|-f) CLEAN="clean" ;; diff --git a/util/sdks/assemblyscript.sh b/util/sdks/assemblyscript.sh index 45962f82a..31881303a 100755 --- a/util/sdks/assemblyscript.sh +++ b/util/sdks/assemblyscript.sh @@ -112,7 +112,12 @@ clean="$3" if [ "$mode" = "download" ]; then download_assemblyscript_sdk "$version" "$clean" -else +elif [ "$mode" = "build" ]; then build_assemblyscript_sdk "$version" "$clean" + +elif [ "$mode" = "install" ]; then install_assemblyscript_sdk_examples + +else + fatal "Unknown mode." fi diff --git a/util/sdks/go.sh b/util/sdks/go.sh index acb771ef9..8482f25be 100755 --- a/util/sdks/go.sh +++ b/util/sdks/go.sh @@ -131,7 +131,12 @@ clean="$3" if [ "$mode" = "download" ]; then download_go_sdk "$version" "$clean" -else +elif [ "$mode" = "build" ]; then build_go_sdk "$version" "$clean" + +elif [ "$mode" = "install" ]; then install_go_sdk_examples + +else + fatal "Unknown mode." fi diff --git a/util/setup_dev.sh b/util/setup_dev.sh index 6918178bc..02f19fbc2 100755 --- a/util/setup_dev.sh +++ b/util/setup_dev.sh @@ -15,7 +15,7 @@ source $NGX_WASM_DIR/util/_lib.sh ############################################################################### -mkdir -p $DIR_CPANM $DIR_BIN $DIR_TESTS_LIB_WASM +mkdir -p $DIR_CPANM $DIR_BIN # OpenSSL diff --git a/util/test.sh b/util/test.sh index f121907e5..0c4b748fc 100755 --- a/util/test.sh +++ b/util/test.sh @@ -94,6 +94,8 @@ if [[ "$CI" == 'true' ]]; then export NGX_BUILD_FORCE=1 fi +mkdir -p $DIR_TESTS_LIB_WASM + args=() if [ "$TEST_NGINX_CARGO_PROFILE" = release ]; then @@ -104,15 +106,14 @@ export RUSTFLAGS="$TEST_NGINX_CARGO_RUSTFLAGS" eval cargo build \ --manifest-path t/lib/Cargo.toml \ --lib \ - "${args[@]}" \ - --target wasm32-wasi + --target wasm32-wasi \ + "${args[@]}" -if [ "$TEST_NGINX_CARGO_PROFILE" = release ]; then - cp target/wasm32-wasi/release/*.wasm $DIR_TESTS_LIB_WASM +eval cp t/lib/target/wasm32-wasi/$TEST_NGINX_CARGO_PROFILE/*.wasm \ + $DIR_TESTS_LIB_WASM -else - cp target/wasm32-wasi/debug/*.wasm $DIR_TESTS_LIB_WASM -fi +$NGX_WASM_DIR/util/sdk.sh -S go --install +$NGX_WASM_DIR/util/sdk.sh -S assemblyscript --install if [ $(uname -s) = Linux ]; then export TEST_NGINX_EVENT_TYPE=epoll