From fd5e002db0a59b18d1c52aa6a04310b8d70acf62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Traian-Florin=20=C8=98erb=C4=83nu=C8=9B=C4=83?= Date: Sat, 21 Dec 2024 23:40:13 +0200 Subject: [PATCH] Unifying testing script --- .github/workflows/test-pr.yml | 10 ++-------- tests/ulm/erc20/erc20_negative_test.sh | 2 -- tests/ulm/erc20/run_tests.sh | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100755 tests/ulm/erc20/run_tests.sh diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index 0da85b87d..7fc7e083d 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -111,14 +111,8 @@ jobs: run: docker exec -u user kwasm-ci-erc20-${GITHUB_SHA} bash -c "CXX=clang++-16 make ulm-build" - name: 'Build erc20-bin' run: docker exec -u user kwasm-ci-erc20-${GITHUB_SHA} bash -c "CXX=clang++-16 make erc20-bin" - - name: 'Start test' - run: docker exec -u user -d -i -t kwasm-ci-erc20-${GITHUB_SHA} bash -c "(sleep 3 ; ./scripts/ulm-load-lang ./build/lib/libkwasm.so ; tests/ulm/erc20/erc20_test.sh ; tests/ulm/erc20/erc20_negative_test.sh; killall geth ) & (./scripts/run-dev-ulm &> ulm.log)" - # - name: 'Load kwasm library' - # run: docker exec -u user kwasm-ci-erc20-${GITHUB_SHA} bash -c "./scripts/ulm-load-lang ./build/lib/libkwasm.so" - # - name: 'Run ERC20 tests' - # run: docker exec -u user kwasm-ci-erc20-${GITHUB_SHA} bash -c "tests/ulm/erc20/erc20_test.sh" - # - name: 'Run ERC20 negative tests' - # run: docker exec -u user kwasm-ci-erc20-${GITHUB_SHA} bash -c "tests/ulm/erc20/erc20_negative_test.sh" + - name: 'Run ERC20 tests' + run: docker exec -u user kwasm-ci-erc20-${GITHUB_SHA} bash -c "./tests/ulm/erc20/run-tests.sh" - name: 'Tear down Docker' if: always() run: | diff --git a/tests/ulm/erc20/erc20_negative_test.sh b/tests/ulm/erc20/erc20_negative_test.sh index a70ab8143..9d04ead9b 100755 --- a/tests/ulm/erc20/erc20_negative_test.sh +++ b/tests/ulm/erc20/erc20_negative_test.sh @@ -128,8 +128,6 @@ function test_transfer_too_much { contract=$(erc20_deploy $k1) echo -n "." - exit 0 - balance2=$(erc20_balanceOf $k1 $contract $a2) echo -n "." assert_eq "0" "$balance2" "Balance of Account 2" diff --git a/tests/ulm/erc20/run_tests.sh b/tests/ulm/erc20/run_tests.sh new file mode 100755 index 000000000..99e545307 --- /dev/null +++ b/tests/ulm/erc20/run_tests.sh @@ -0,0 +1,18 @@ +set -e + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +ROOT_DIR="$SCRIPT_DIR/../../.." + +# change to root directory +cd "$ROOT_DIR" + +./scripts/run-dev-ulm &> ulm.log & +sleep 1 + +./scripts/ulm-load-lang ./build/lib/libkwasm.so + +tests/ulm/erc20/erc20_test.sh + +tests/ulm/erc20/erc20_negative_test.sh + +kill %1