With solving #29 support for user tasks will be/was implemented.
We could allow to use test functions in these background tasks as long as the UTF is waiting for reentry through its own background monitor. The state for the UTF in this phase is the same as if the current test case is executed. So regular test function such as CHECK/WARN should directly work.
Specific care has to taken for use of REQUIRE from user background tasks where further test execution should stop.
Possible implementation:
On REQUIRE call we check if we are in 'waiting for reentry' mode using the global flag + SavedState DF existence.
If yes, we use the the current stacktrace and look backwards for a procedure that is in the list of procedures associated with background tasks. If the procedures task is in running state then we found the caller user background task.
We stop the found task and Abort current execution of code
Due to the stopped task the UTFBackgroundMOnitor will issue a Reentry
In RunTest, we have to check now already on Reentry (before calling the reentry function) for ShouldDoAbort() and execute the Hooks accordingly (same logic as on error of test case).
We can not support catching RTEs from the user tasks background function?!?
CHECK statements do already work in background tasks which is shown in tests/TestResultsTests/ReentryTests.ipf (de58e8d (Add elaborate test cases for result waves, 2023-01-03)).
With solving #29 support for user tasks will be/was implemented.
We could allow to use test functions in these background tasks as long as the UTF is waiting for reentry through its own background monitor. The state for the UTF in this phase is the same as if the current test case is executed. So regular test function such as CHECK/WARN should directly work.
Specific care has to taken for use of REQUIRE from user background tasks where further test execution should stop.
Possible implementation:
On REQUIRE call we check if we are in 'waiting for reentry' mode using the global flag + SavedState DF existence.
If yes, we use the the current stacktrace and look backwards for a procedure that is in the list of procedures associated with background tasks. If the procedures task is in running state then we found the caller user background task.
We stop the found task and Abort current execution of code
Due to the stopped task the UTFBackgroundMOnitor will issue a Reentry
In RunTest, we have to check now already on Reentry (before calling the reentry function) for ShouldDoAbort() and execute the Hooks accordingly (same logic as on error of test case).
We can not support catching RTEs from the user tasks background function?!?