serialize C integration tests

This commit is contained in:
Dustin J. Mitchell
2022-01-26 01:38:25 +00:00
parent 8f703fd63a
commit 96b59dd5b2
3 changed files with 12 additions and 0 deletions

View File

@@ -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(
{ $s:ident } => {
#[test]
fn $s() {
let _guard = MUTEX.lock().unwrap();
assert_eq!(integration_tests::bindings_tests::$s(), 0);
}
};