cmake_test/expectfail_subprocess
This module defines the function to execute
EXPECTFAIL tests and sections. It is called
by cmake_test/execution_unit.CTExecutionUnit.execute
Attention
This module is intended for internal use only.
- cmake_test/expectfail_subprocess.ct_expectfail_subprocess(curr_section_instance)
Constructs the files needed for a test to be executed in a subprocess and then executes the subprocess.
This function will only be called for sections marked with EXPECTFAIL. Subprocesses are required because there is no way to handle exceptions correctly and not leave a test in an indeterminate state. A full interpreter shutdown is required to prevent code from proceeding from the exception point as if nothing had happened.
This function first pulls all required information from the given CTExecutionUnit instance, most importantly the unit’s parent tree. This tree is then converted to a list of variable declarations and inserted into a template CMakeLists.txt. These declarations ensure only the section and its direct parents are executed to prevent a different section or test from running. Finally, the template is executed in a subprocess, resulting in the section and its parents being executed. The subprocess result code is stored, and if the code is reported as succeeding testing is halted since we expect it to fail.
- Parameters:
curr_section_instance (CTExecutionUnit) – The section execution unit object that will be executed as a subprocess.