diff --git a/src/integrationtest/integrationtest_drunc.py b/src/integrationtest/integrationtest_drunc.py index 9420233..63189a2 100755 --- a/src/integrationtest/integrationtest_drunc.py +++ b/src/integrationtest/integrationtest_drunc.py @@ -36,6 +36,7 @@ from daqconf.get_session_apps import get_segment_apps import time import random +import json def parametrize_fixture_with_items(metafunc, fixture, itemsname): @@ -310,6 +311,35 @@ def run_nanorc(request, create_config_files, tmp_path_factory): run_dir = tmp_path_factory.mktemp("run") + # 15-Dec-2025, KAB: if one of our integtest bundle scripts has provided information + # about itself in the execution environment of the currently running test, use that + # information to create a file in the 'run' directory of the test. This is used by the + # bundle script to locate which pytest directory on disk matches the running of which test. + try: + bundle_script_info = os.environ["DUNEDAQ_INTEGTEST_BUNDLE_INFO"] + info_list = bundle_script_info.split(';') + if (len(info_list) == 3): + bundle_info_data = { + "description": "This file was automatically generated by the DUNE DAQ integrationtest infrastructure. It contains information about the 'bundle' script that ran this test.", + "bundle_script_start_time": info_list[0], + "bundle_script_process_id": info_list[1], + "individual_test_start_time": info_list[2] + } + bundle_file_name = f"{run_dir}/bundle_script_info.json" + try: + with open(f"{bundle_file_name}", "w") as info_file: + json.dump(bundle_info_data, info_file, indent=2) + except FileNotFoundError: + print(f"\n*** Warning: unable to write bundle info data to file {bundle_file_name}") + else: + print("\n*** Warning: the DUNEDAQ_INTEGTEST_BUNDLE_INFO env var is set, but it doesn't seem") + print( " to contain the expected 3 values that are used to help bundle scripts match") + print( " pytest directories to individual tests that are run.") + print( f" Contents of the env var: '{bundle_script_info}'") + except KeyError: + # if the expected env var is not set, we simply don't create the bundle info file + pass + connsvc_obj = None if ( not disable_connectivity_service