mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
serialize C integration tests
This commit is contained in:
parent
8f703fd63a
commit
96b59dd5b2
3 changed files with 12 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1529,6 +1529,7 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"cc",
|
"cc",
|
||||||
"env_logger 0.8.4",
|
"env_logger 0.8.4",
|
||||||
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
"taskchampion",
|
"taskchampion",
|
||||||
|
|
|
@ -18,6 +18,7 @@ tempfile = "3"
|
||||||
pretty_assertions = "1"
|
pretty_assertions = "1"
|
||||||
log = "^0.4.14"
|
log = "^0.4.14"
|
||||||
env_logger = "^0.8.3"
|
env_logger = "^0.8.3"
|
||||||
|
lazy_static = "1"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1.0"
|
cc = "1.0"
|
||||||
|
|
|
@ -1,7 +1,17 @@
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
use std::sync::Mutex;
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
// the C library running the tests is not reentrant, so we use a mutex to ensure that only one
|
||||||
|
// test runs at a time.
|
||||||
|
static ref MUTEX: Mutex<()> = Mutex::new(());
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! suite(
|
macro_rules! suite(
|
||||||
{ $s:ident } => {
|
{ $s:ident } => {
|
||||||
#[test]
|
#[test]
|
||||||
fn $s() {
|
fn $s() {
|
||||||
|
let _guard = MUTEX.lock().unwrap();
|
||||||
assert_eq!(integration_tests::bindings_tests::$s(), 0);
|
assert_eq!(integration_tests::bindings_tests::$s(), 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue