Skip to content

Commit

Permalink
Added serial test macro for serial tests
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed May 19, 2021
1 parent c36e5d5 commit 67188ed
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ anyhow = "1.0"
blake3 = "0.3"
criterion = "0.3"
lazy_static = "1.4"
serial_test = "0.5"
wasmer-engine-dummy = { path = "tests/lib/engine-dummy" }
compiler-test-derive = { path = "tests/lib/compiler-test-derive" }
tempfile = "3.1"
Expand Down
9 changes: 6 additions & 3 deletions tests/compilers/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ fn get_module(store: &Store) -> Result<Module> {
}

#[compiler_test(imports)]
#[serial_test::serial(dynamic_function)]
fn dynamic_function(config: crate::Config) -> Result<()> {
let store = config.store();
let module = get_module(&store)?;
Expand Down Expand Up @@ -78,7 +79,7 @@ fn dynamic_function(config: crate::Config) -> Result<()> {
},
},
)?;
assert_eq!(HITS.load(SeqCst), 4);
assert_eq!(HITS.swap(0, SeqCst), 4);
Ok(())
}

Expand Down Expand Up @@ -138,6 +139,7 @@ fn dynamic_function_with_env(config: crate::Config) -> Result<()> {
}

#[compiler_test(imports)]
#[serial_test::serial(static_function)]
fn static_function(config: crate::Config) -> Result<()> {
let store = config.store();
let module = get_module(&store)?;
Expand Down Expand Up @@ -171,11 +173,12 @@ fn static_function(config: crate::Config) -> Result<()> {
},
},
)?;
assert_eq!(HITS.load(SeqCst), 4);
assert_eq!(HITS.swap(0, SeqCst), 4);
Ok(())
}

#[compiler_test(imports)]
#[serial_test::serial(static_function_with_results)]
fn static_function_with_results(config: crate::Config) -> Result<()> {
let store = config.store();
let module = get_module(&store)?;
Expand Down Expand Up @@ -209,7 +212,7 @@ fn static_function_with_results(config: crate::Config) -> Result<()> {
},
},
)?;
assert_eq!(HITS.load(SeqCst), 4);
assert_eq!(HITS.swap(0, SeqCst), 4);
Ok(())
}

Expand Down

0 comments on commit 67188ed

Please sign in to comment.