diff --git a/src/runtime2/tests/error_handling.rs b/src/runtime2/tests/error_handling.rs index ddf0d1dbbd6fdef77a1cc4b6156596b399d76f1d..9ab1a7eba5fccf1f6498fdde2ea8fbee3abb1060 100644 --- a/src/runtime2/tests/error_handling.rs +++ b/src/runtime2/tests/error_handling.rs @@ -20,9 +20,15 @@ fn test_connected_uncommunicating_component_error() { sync auto a = get(never_providing); } composite constructor() { + // Test one way channel a -> b; new sitting_idly_waiting(b); new crashing_and_burning(a); + + // And the other way around + channel c -> d; + new crashing_and_burning(c); + new sitting_idly_waiting(d); }", "constructor", no_args()) } @@ -43,6 +49,43 @@ fn test_connected_communicating_component_error() { channel a -> b; new send_and_fail(a); new receive_once(b); + + channel c -> d; + new receive_once(d); + new send_and_fail(c); } ", "constructor", no_args()) +} + +#[test] +fn test_failing_after_successful_sync() { + compile_and_create_component(" + primitive put_and_fail(out tx) { sync put(tx, 1); u8 a = {}[0]; } + primitive get_and_fail(in rx) { sync auto a = get(rx); u8 a = {}[0]; } + primitive put_and_exit(out tx) { sync put(tx, 2); } + primitive get_and_exit(in rx) { sync auto a = get(rx); } + + composite constructor() { + { + channel a -> b; + new put_and_fail(a); + new get_and_exit(b); + } + { + channel a -> b; + new get_and_exit(b); + new put_and_fail(a); + } + { + channel a -> b; + new put_and_exit(a); + new get_and_fail(b); + } + { + channel a -> b; + new get_and_fail(b); + new put_and_exit(a); + } + } + ", "constructor", no_args()); } \ No newline at end of file diff --git a/src/runtime2/tests/mod.rs b/src/runtime2/tests/mod.rs index b139ad3ad26b8119bccdbfb57b8b0377e01e9578..138fccfa2ee5e323b3348452eec5069438a1044b 100644 --- a/src/runtime2/tests/mod.rs +++ b/src/runtime2/tests/mod.rs @@ -5,7 +5,7 @@ use crate::runtime2::component::{CompCtx, CompPDL}; mod error_handling; -const NUM_THREADS: u32 = 1; +const NUM_THREADS: u32 = 4; const DEBUG_LOGGING: bool = true; pub(crate) fn compile_and_create_component(source: &str, routine_name: &str, args: ValueGroup) {