From eaac986f98251355fea600efb68457192ea22fda Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Thu, 3 Oct 2024 11:50:38 -0700 Subject: [PATCH] Fixed test so that stop time is not earlier than request_stop time --- test/C/src/enclave/EnclaveRequestStop.lf | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/C/src/enclave/EnclaveRequestStop.lf diff --git a/test/C/src/enclave/EnclaveRequestStop.lf b/test/C/src/enclave/EnclaveRequestStop.lf new file mode 100644 index 0000000000..91df3b1a60 --- /dev/null +++ b/test/C/src/enclave/EnclaveRequestStop.lf @@ -0,0 +1,29 @@ +/** Test that enclaves all stop at the time requested by the first enclave to request a stop. */ +target C { + timeout: 10 sec +} + +reactor Stop(stop_time: time = 5 s) { + preamble {= + #include "platform.h" // Defines PRINTF_TIME + =} + timer t(stop_time) + + reaction(t) {= + lf_request_stop(); + =} + + reaction(shutdown) {= + lf_print("Stopped at tag (" PRINTF_TIME ", %d)", lf_time_logical_elapsed(), lf_tag().microstep); + if (lf_time_logical_elapsed() != 50000000LL || lf_tag().microstep != 1) { + lf_print_error_and_exit("Expected stop tag to be (50ms, 1)."); + } + =} +} + +main reactor { + @enclave + s1 = new Stop() + @enclave + s2 = new Stop(stop_time = 50 ms) +}