Skip to content

Commit

Permalink
refactor: refactor spec testsuite and remove feature
Browse files Browse the repository at this point in the history
Signed-off-by: George Cosma <[email protected]>
  • Loading branch information
george-cosma committed Sep 24, 2024
1 parent 44abce2 commit 6b0827f
Show file tree
Hide file tree
Showing 14 changed files with 295 additions and 293 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Format
run: cargo check
- name: Run clippy
Expand All @@ -39,11 +41,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: webiny/[email protected]

msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: taiki-e/install-action@cargo-hack
- run: cargo hack check --rust-version --workspace --all-targets --ignore-private
8 changes: 6 additions & 2 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -26,22 +28,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v14
with:
name: dlr-ft
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: nix build .#wasm-interpreter --print-build-logs
- run: nix build .?submodules=1#wasm-interpreter --print-build-logs
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
verbose: true
file: result/lcov-codecov.json
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- run: nix build .#report --print-build-logs
- run: nix build .?submodules=1#report --print-build-logs
- name: Archive report
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pages_coverage_preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
# -=-=-=-= Create report =-=-=-=-
- uses: cachix/install-nix-action@v27
if: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pages_deploy_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pages_requirement_preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
# -=-=-=-= Strictdoc =-=-=-=-
- name: Install python
uses: actions/[email protected]
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ hexf = "0.2.1"
[features]
default = ["hooks"]
hooks = []
spec-test = []

[[bench]]
name = "hook_performance_impact"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/wasm-interpreter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rustPlatform.buildRustPackage rec {
src = ./..;

# File suffices to include
extensions = [ "lock" "rs" "toml" ];
extensions = [ "lock" "rs" "toml" "wast" ];
# Files to explicitly include
include = [ ];
# Files to explicitly exclude
Expand Down
95 changes: 0 additions & 95 deletions tests/specification/dummy.wast

This file was deleted.

33 changes: 25 additions & 8 deletions tests/specification/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,38 @@ mod reports;
mod run;
mod test_errors;

#[test_log::test]
pub fn spec_dummy() {
let path = "./tests/specification/dummy.wast";
let report = run::run_spec_test(path);
println!("Report for {}:\n{}", path, report);
}

#[test_log::test]
pub fn spec_tests() {
let paths = get_wast_files(Path::new("./tests/specification/testsuite/"))
.expect("Failed to find testsuite");

let mut successful_reports = 0;
let mut failed_reports = 0;
let mut compile_error_reports = 0;

for test_path in paths {
println!("Report for {}:", test_path.display());
let report = run::run_spec_test(test_path.to_str().unwrap());
println!("Report for {}:\n{}", test_path.display(), report);
println!("{}", report);

match report {
reports::WastTestReport::Asserts(assert_report) => {
if assert_report.has_errors() {
failed_reports += 1;
} else {
successful_reports += 1;
}
}
reports::WastTestReport::CompilationError(_) => {
compile_error_reports += 1;
}
}
}

println!(
"Tests: {} Passed, {} Failed, {} Compilation Errors",
successful_reports, failed_reports, compile_error_reports
);
}

// See: https://stackoverflow.com/a/76820878
Expand Down
Loading

0 comments on commit 6b0827f

Please sign in to comment.