Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ofzo committed Dec 12, 2023
1 parent e1f8024 commit f15d4c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
23 changes: 2 additions & 21 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ env:

jobs:

test-linux:

test:
runs-on: ubuntu-latest

steps:
Expand All @@ -29,25 +28,7 @@ jobs:
- name: Generate tests
run: bash ./update.test.sh
- name: Run tests
run: cargo test --verbose

# test-macos:

# runs-on: macos-latest

# steps:
# - uses: actions/checkout@v2
# with:
# submodules: "recursive"
# - name: Install cmake
# run: brew install -y cmake
# - name: Build wabt
# run: cd wabt && mkdir build && cd build && cmake .. && cmake --build .
# - name: Generate tests
# run: bash ./update.test.sh
# - name: Run tests
# run: cargo test --verbose

run: cargo test --package oxygen --test wasm --verbose

build:

Expand Down
19 changes: 10 additions & 9 deletions update.test.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
rm -rf ./crates/decode/tests/*
if [[ ! -e ./crates/decode/tests ]];
rm -rf ./tests/*
if [[ ! -e ./tests ]];
then
mkdir ./crates/decode/tests
mkdir ./tests
fi
touch ./crates/decode/tests/wasm.rs
touch ./tests/wasm.rs

echo "use oxygen::runtime::AsmccRuntime;" >> ./crates/decode/tests/wasm.rs
echo "use std::{env, fs::read, path::Path};" >> ./crates/decode/tests/wasm.rs
echo "use oxygen::runtime::OxygenRuntime;" >> ./tests/wasm.rs
echo "use std::{env, fs::read, path::Path};" >> ./tests/wasm.rs

function gene(){
name=$(echo $1 | sed 's/[\.-]/_/g')
echo "
#[test]
fn test_$name() {
let mut rt = AsmccRuntime::default();
let mut rt = OxygenRuntime::default();
let url = Path::new(\"./testsuite/valid/$1\");
let root = env::current_dir().unwrap();
let root = root.parent().unwrap().parent().unwrap();
// let root = root.parent().unwrap().parent().unwrap();
let url = root.join(url);
let url = url.canonicalize().unwrap();
let buf = read(url).unwrap();
Expand All @@ -30,7 +30,7 @@ fn test_$name() {
};
assert!(r, \"Failed to load wasm $1\");
}
" >> ./crates/decode/tests/wasm.rs
" >> ./tests/wasm.rs
echo "Info: Generate $1 test success"
}

Expand All @@ -44,6 +44,7 @@ then
for file in $(ls ./testsuite/valid/)
do
gene $file
echo "Generate $file test case success"
done
else
gene "$1"
Expand Down

0 comments on commit f15d4c5

Please sign in to comment.