From 4fe23518a0ce3b829ad56504ed92983fbbc6dc51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Mon, 15 Jun 2026 22:53:30 +0200 Subject: [PATCH] test(validation): run capture via store_result Co-Authored-By: Claude Opus 4.8 --- test/validation/items/run/check_capture.py | 9 ++++++++ test/validation/items/run/test.tum | 24 ++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 test/validation/items/run/check_capture.py diff --git a/test/validation/items/run/check_capture.py b/test/validation/items/run/check_capture.py new file mode 100644 index 0000000..d51d00b --- /dev/null +++ b/test/validation/items/run/check_capture.py @@ -0,0 +1,9 @@ +import py_func.tm as tm + + +def assert_captured(): + """The sub-run log stored by `run` via store_result must be in the gdict.""" + log = tm.gd("captured_log", "") + assert "Test run success." in log, \ + "captured sub-run log not reachable from the gdict (store_result)" + return 0 diff --git a/test/validation/items/run/test.tum b/test/validation/items/run/test.tum index 80d3d7a..0507c1b 100644 --- a/test/validation/items/run/test.tum +++ b/test/validation/items/run/test.tum @@ -1,10 +1,7 @@ # run item: launches a .tum file in a new testium instance. -# In batch mode the sub-instance runs with -b; in GUI mode with -r. -# The run item result is SUCCESS if the sub-instance launched successfully, -# regardless of its own test result. -# -# log_file points the sub-instance log at the throwaway report dir (gitignored) -# so a GUI run does not litter the repo with sub_*.log files. +# Child mode: -b in batch / -r in the GUI, or forced -b (captured) by batch: true. +# Result is SUCCESS if the sub-instance launched, regardless of its own result. +# log_file (GUI -r only) goes to the gitignored report dir to avoid repo litter. - run: name: run PASS (valid file, passing sub-test) @@ -30,3 +27,18 @@ tum: $(test_path)$(psep)sub_pass.tum wait_for_exec: true log_file: $(validation_report_path)$(psep)run_sub.log + +# batch: true forces a headless, captured sub-run even in the GUI; its log is +# kept as the result value and pushed to the gdict by store_result. +- run: + name: run batch (capture sub-run log to the gdict) + key: $(test)_PASS + tum: $(test_path)$(psep)sub_pass.tum + batch: true + store_result: captured_log + +- py_func: + name: captured sub-run log is post-processable from the gdict + key: $(test)_PASS + file: $(test_path)$(psep)check_capture.py + func_name: assert_captured