From 7ad2f9ca0eeaca2c8caee1b1aef5d05cfb568bdd Mon Sep 17 00:00:00 2001 From: Kurt Biery Date: Mon, 15 Dec 2025 17:09:05 -0600 Subject: [PATCH 1/2] Modified integrationtest_drunc.py so that it creates a simple JSON file in the pytest 'run' dir so that our integtest 'bundle' scripts can match a given test to its associated directory. --- src/integrationtest/integrationtest_drunc.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/integrationtest/integrationtest_drunc.py b/src/integrationtest/integrationtest_drunc.py index 9420233..a75049f 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,25 @@ 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] + } + with open(f"{run_dir}/bundle_script_info.json", "w") as info_file: + info_file.write(f"{json.dumps(bundle_info_data)}") + except KeyError: + pass + connsvc_obj = None if ( not disable_connectivity_service From e308ed2b1c84ff6cf849184c462304ffb7a5b6da Mon Sep 17 00:00:00 2001 From: Kurt Biery Date: Mon, 22 Dec 2025 10:21:05 -0600 Subject: [PATCH 2/2] Added error checking to the code in integrationtest_drunc.py that creates the bundle info file --- src/integrationtest/integrationtest_drunc.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/integrationtest/integrationtest_drunc.py b/src/integrationtest/integrationtest_drunc.py index a75049f..63189a2 100755 --- a/src/integrationtest/integrationtest_drunc.py +++ b/src/integrationtest/integrationtest_drunc.py @@ -318,16 +318,26 @@ def run_nanorc(request, create_config_files, tmp_path_factory): try: bundle_script_info = os.environ["DUNEDAQ_INTEGTEST_BUNDLE_INFO"] info_list = bundle_script_info.split(';') - if (len(info_list) >= 3): + 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] } - with open(f"{run_dir}/bundle_script_info.json", "w") as info_file: - info_file.write(f"{json.dumps(bundle_info_data)}") + 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