Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 18 additions & 27 deletions integtest/3ru_1df_multirun_test.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import pytest
import os
import re
import copy
import psutil
import math
import urllib.request

import integrationtest.data_file_checks as data_file_checks
import integrationtest.log_file_checks as log_file_checks
import integrationtest.basic_checks as basic_checks
import integrationtest.data_classes as data_classes
import integrationtest.resource_validation as resource_validation
from integrationtest.get_pytest_tmpdir import get_pytest_tmpdir
from integrationtest.verbosity_helper import IntegtestVerbosityLevels

pytest_plugins = "integrationtest.integrationtest_drunc"

# tweak the print() statement default behavior so that it always flushes the output.
import functools
print = functools.partial(print, flush=True)
print = functools.partial(print, flush=True) # always flush print() output

pytest_plugins = "integrationtest.integrationtest_drunc"

# Values that help determine the running conditions
number_of_data_producers = 3
Expand Down Expand Up @@ -99,8 +97,6 @@
resource_validator.free_memory_needs(20, 32) # 25% more than what we observe being used ('free -h')
actual_output_path = get_pytest_tmpdir()
resource_validator.free_disk_space_needs(actual_output_path, 1) # more than what we observe
resval_debug_string = resource_validator.get_debug_string()
print(f"{resval_debug_string}")

# The next three variable declarations *must* be present as globals in the test
# file. They're read by the "fixtures" in conftest.py to determine how
Expand Down Expand Up @@ -148,7 +144,7 @@

confgen_arguments = {
"WIBEth_System": conf_dict,
"Software_TPG_System": swtpg_conf,
"WIBEth_TPG_System": swtpg_conf,
}

# The commands to run in dunerc, as a list
Expand All @@ -172,26 +168,17 @@

# The tests themselves

def test_dunerc_success(run_dunerc):
# print the name of the current test
current_test = os.environ.get("PYTEST_CURRENT_TEST")
match_obj = re.search(r".*\[(.+)-run_.*rc.*\d].*", current_test)
if match_obj:
current_test = match_obj.group(1)
banner_line = re.sub(".", "=", current_test)
print(banner_line)
print(current_test)
print(banner_line)

# Check that dunerc completed correctly
assert run_dunerc.completed_process.returncode == 0
def test_dunerc_success(run_dunerc, caplog):
# checks for run control success, problems during pytest setup, etc.
basic_checks.basic_checks(run_dunerc, caplog, print_test_name=True)


def test_log_files(run_dunerc):
if check_for_logfile_errors:
# Check that there are no warnings or errors in the log files
assert log_file_checks.logs_are_error_free(
run_dunerc.log_files, True, True, ignored_logfile_problems
run_dunerc.log_files, True, True, ignored_logfile_problems,
verbosity_helper=run_dunerc.verbosity_helper
)


Expand All @@ -218,11 +205,15 @@ def test_data_files(run_dunerc):
fragment_check_list.append(triggeractivity_frag_params)

# Run some tests on the output data file
assert len(run_dunerc.data_files) == expected_number_of_data_files
all_ok = len(run_dunerc.data_files) == expected_number_of_data_files
if all_ok:
if run_dunerc.verbosity_helper.compare_level(IntegtestVerbosityLevels.drunc_transitions):
print(f"\n\N{WHITE HEAVY CHECK MARK} The correct number of raw data files was found ({expected_number_of_data_files})")
else:
print(f"\n\N{POLICE CARS REVOLVING LIGHT} An incorrect number of raw data files was found, expected {expected_number_of_data_files}, found {len(run_dunerc.data_files)} \N{POLICE CARS REVOLVING LIGHT}")

all_ok = True
for idx in range(len(run_dunerc.data_files)):
data_file = data_file_checks.DataFile(run_dunerc.data_files[idx])
data_file = data_file_checks.DataFile(run_dunerc.data_files[idx], run_dunerc.verbosity_helper)
all_ok &= data_file_checks.sanity_check(data_file)
all_ok &= data_file_checks.check_file_attributes(data_file)
all_ok &= data_file_checks.check_event_count(
Expand Down
36 changes: 12 additions & 24 deletions integtest/3ru_3df_multirun_test.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import pytest
import os
import re
import copy
import urllib.request

import integrationtest.data_file_checks as data_file_checks
import integrationtest.log_file_checks as log_file_checks
import integrationtest.basic_checks as basic_checks
import integrationtest.data_classes as data_classes
import integrationtest.resource_validation as resource_validation
from integrationtest.get_pytest_tmpdir import get_pytest_tmpdir
from integrationtest.verbosity_helper import IntegtestVerbosityLevels

pytest_plugins = "integrationtest.integrationtest_drunc"

# tweak the print() statement default behavior so that it always flushes the output.
import functools
print = functools.partial(print, flush=True)
print = functools.partial(print, flush=True) # always flush print() output

pytest_plugins = "integrationtest.integrationtest_drunc"

# Values that help determine the running conditions
number_of_data_producers = 2
Expand Down Expand Up @@ -122,8 +121,6 @@
resource_validator.free_memory_needs(15, 24) # 25% more than what we observe being used ('free -h')
actual_output_path = get_pytest_tmpdir()
resource_validator.free_disk_space_needs(actual_output_path, 1) # more than what we observe
resval_debug_string = resource_validator.get_debug_string()
print(f"{resval_debug_string}")

# 29-Dec-2025, KAB: The following comment about three variables is out-of-date.
# It will be replaced soon, and the comment block above is a start on that.
Expand Down Expand Up @@ -169,7 +166,7 @@

confgen_arguments = {
"WIBEth_System": conf_dict,
"Software_TPG_System": swtpg_conf,
"WIBEth_TPG_System": swtpg_conf,
}

# 29-Dec-2025, KAB: added sample process manager choices.
Expand Down Expand Up @@ -200,26 +197,17 @@
# The tests themselves


def test_dunerc_success(run_dunerc):
# print the name of the current test
current_test = os.environ.get("PYTEST_CURRENT_TEST")
match_obj = re.search(r".*\[(.+)-run_.*rc.*\d].*", current_test)
if match_obj:
current_test = match_obj.group(1)
banner_line = re.sub(".", "=", current_test)
print(banner_line)
print(current_test)
print(banner_line)

# Check that dunerc completed correctly
assert run_dunerc.completed_process.returncode == 0
def test_dunerc_success(run_dunerc, caplog):
# checks for run control success, problems during pytest setup, etc.
basic_checks.basic_checks(run_dunerc, caplog, print_test_name=True)


def test_log_files(run_dunerc):
if check_for_logfile_errors:
# Check that there are no warnings or errors in the log files
assert log_file_checks.logs_are_error_free(
run_dunerc.log_files, True, True, ignored_logfile_problems
run_dunerc.log_files, True, True, ignored_logfile_problems,
verbosity_helper=run_dunerc.verbosity_helper
)


Expand Down Expand Up @@ -260,7 +248,7 @@ def test_data_files(run_dunerc):

all_ok = True
for idx in range(len(run_dunerc.data_files)):
data_file = data_file_checks.DataFile(run_dunerc.data_files[idx])
data_file = data_file_checks.DataFile(run_dunerc.data_files[idx], run_dunerc.verbosity_helper)
all_ok &= data_file_checks.sanity_check(data_file)
all_ok &= data_file_checks.check_file_attributes(data_file)
all_ok &= data_file_checks.check_event_count(
Expand Down
49 changes: 12 additions & 37 deletions integtest/example_system_test.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import pytest
import os
import copy
import os
import re
import random
import string
import pathlib

import integrationtest.data_file_checks as data_file_checks
import integrationtest.log_file_checks as log_file_checks
import integrationtest.basic_checks as basic_checks
import integrationtest.data_classes as data_classes
import integrationtest.resource_validation as resource_validation
from integrationtest.get_pytest_tmpdir import get_pytest_tmpdir
from integrationtest.verbosity_helper import IntegtestVerbosityLevels

pytest_plugins = "integrationtest.integrationtest_drunc"

# tweak the print() statement default behavior so that it always flushes the output.
import functools
print = functools.partial(print, flush=True)
print = functools.partial(print, flush=True) # always flush print() output

pytest_plugins = "integrationtest.integrationtest_drunc"

# Values that help determine the running conditions
run_duration = 20 # seconds
Expand Down Expand Up @@ -88,8 +89,6 @@
resource_validator.free_memory_needs(15, 24) # 25% more than what we observe being used ('free -h')
actual_output_path = get_pytest_tmpdir()
resource_validator.free_disk_space_needs(actual_output_path, 1) # more than what we observe
resval_debug_string = resource_validator.get_debug_string()
print(f"{resval_debug_string}")

# The arguments to pass to the config generator, excluding the json
# output directory (the test framework handles that)
Expand Down Expand Up @@ -152,33 +151,13 @@ def host_is_at_ehn1(hostname):
# The tests themselves


def test_dunerc_success(run_dunerc):
# print the name of the current test
current_test = os.environ.get("PYTEST_CURRENT_TEST")
match_obj = re.search(r".*\[(.+)-run_.*rc.*\d].*", current_test)
if match_obj:
current_test = match_obj.group(1)
banner_line = re.sub(".", "=", current_test)
print(banner_line)
print(current_test)
print(banner_line)

if not host_is_at_ehn1(hostname) and "EHN1" in current_test:
pytest.skip(
f"This computer ({hostname}) is not at EHN1, not running EHN1 sessions"
)

# Check that dunerc completed correctly
assert run_dunerc.completed_process.returncode == 0
def test_dunerc_success(run_dunerc, caplog):
# checks for run control success, problems during pytest setup, etc.
basic_checks.basic_checks(run_dunerc, caplog, print_test_name=True)


def test_log_files(run_dunerc):
current_test = os.environ.get("PYTEST_CURRENT_TEST")
if not host_is_at_ehn1(hostname) and "EHN1" in current_test:
pytest.skip(
f"This computer ({hostname}) is not at EHN1, not running EHN1 sessions"
)

if host_is_at_ehn1(hostname) and "EHN1" in current_test:
log_dir = pathlib.Path("/log")
run_dunerc.log_files += list(log_dir.glob(f"log_*_{run_dunerc.daq_session_name}*.txt"))
Expand All @@ -201,17 +180,13 @@ def test_log_files(run_dunerc):
if check_for_logfile_errors:
# Check that there are no warnings or errors in the log files
assert log_file_checks.logs_are_error_free(
run_dunerc.log_files, True, True, ignored_logfile_problems
run_dunerc.log_files, True, True, ignored_logfile_problems,
verbosity_helper=run_dunerc.verbosity_helper
)


def test_data_files(run_dunerc):
current_test = os.environ.get("PYTEST_CURRENT_TEST")
if not host_is_at_ehn1(hostname) and "EHN1" in current_test:
pytest.skip(
f"This computer ({hostname}) is not at EHN1, not running EHN1 sessions"
)

datafile_params = {
"Local 1x1 Conf": {"expected_fragment_count": 4, "expected_file_count": 1},
"Local 2x3 Conf": {"expected_fragment_count": 8, "expected_file_count": 3},
Expand Down Expand Up @@ -259,7 +234,7 @@ def test_data_files(run_dunerc):
all_ok = True

for idx in range(len(run_dunerc.data_files)):
data_file = data_file_checks.DataFile(run_dunerc.data_files[idx])
data_file = data_file_checks.DataFile(run_dunerc.data_files[idx], run_dunerc.verbosity_helper)
all_ok &= data_file_checks.sanity_check(data_file)
all_ok &= data_file_checks.check_file_attributes(data_file)
all_ok &= data_file_checks.check_event_count(
Expand Down
42 changes: 15 additions & 27 deletions integtest/fake_data_producer_test.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import pytest
import os
import re
import copy
import urllib.request
import math

import integrationtest.data_file_checks as data_file_checks
import integrationtest.log_file_checks as log_file_checks
import integrationtest.basic_checks as basic_checks
import integrationtest.data_classes as data_classes
import integrationtest.resource_validation as resource_validation
from integrationtest.get_pytest_tmpdir import get_pytest_tmpdir
from integrationtest.verbosity_helper import IntegtestVerbosityLevels

pytest_plugins = "integrationtest.integrationtest_drunc"

# tweak the print() statement default behavior so that it always flushes the output.
import functools
print = functools.partial(print, flush=True)
print = functools.partial(print, flush=True) # always flush print() output

pytest_plugins = "integrationtest.integrationtest_drunc"

# Values that help determine the running conditions
run_duration = 20 # seconds
Expand Down Expand Up @@ -58,8 +58,6 @@
resource_validator.free_memory_needs(4) # double what we observe being used ('free -h')
actual_output_path = get_pytest_tmpdir()
resource_validator.free_disk_space_needs(actual_output_path, 1) # more than what we observe
resval_debug_string = resource_validator.get_debug_string()
print(f"{resval_debug_string}")

# The next three variable declarations *must* be present as globals in the test
# file. They're read by the "fixtures" in conftest.py to determine how
Expand Down Expand Up @@ -123,26 +121,17 @@

# The tests themselves

def test_dunerc_success(run_dunerc):
# print the name of the current test
current_test = os.environ.get("PYTEST_CURRENT_TEST")
match_obj = re.search(r".*\[(.+)-run_.*rc.*\d].*", current_test)
if match_obj:
current_test = match_obj.group(1)
banner_line = re.sub(".", "=", current_test)
print(banner_line)
print(current_test)
print(banner_line)

# Check that dunerc completed correctly
assert run_dunerc.completed_process.returncode == 0
def test_dunerc_success(run_dunerc, caplog):
# checks for run control success, problems during pytest setup, etc.
basic_checks.basic_checks(run_dunerc, caplog, print_test_name=True)


def test_log_files(run_dunerc):
if check_for_logfile_errors:
# Check that there are no warnings or errors in the log files
assert log_file_checks.logs_are_error_free(
run_dunerc.log_files, True, True, ignored_logfile_problems
run_dunerc.log_files, True, True, ignored_logfile_problems,
verbosity_helper=run_dunerc.verbosity_helper
)


Expand All @@ -163,16 +152,15 @@ def test_data_files(run_dunerc):
fragment_check_list = [frag_params]

# Run some tests on the output data file
all_ok = True
all_ok &= len(run_dunerc.data_files) == expected_number_of_data_files
print("") # Clear potential dot from pytest
all_ok = len(run_dunerc.data_files) == expected_number_of_data_files
if all_ok:
print(f"\N{WHITE HEAVY CHECK MARK} The correct number of raw data files was found ({expected_number_of_data_files})")
if run_dunerc.verbosity_helper.compare_level(IntegtestVerbosityLevels.drunc_transitions):
print(f"\n\N{WHITE HEAVY CHECK MARK} The correct number of raw data files was found ({expected_number_of_data_files})")
else:
print(f"\N{POLICE CARS REVOLVING LIGHT} An incorrect number of raw data files was found, expected {expected_number_of_data_files}, found {len(run_dunerc.data_files)} \N{POLICE CARS REVOLVING LIGHT}")
print(f"\n\N{POLICE CARS REVOLVING LIGHT} An incorrect number of raw data files was found, expected {expected_number_of_data_files}, found {len(run_dunerc.data_files)} \N{POLICE CARS REVOLVING LIGHT}")

for idx in range(len(run_dunerc.data_files)):
data_file = data_file_checks.DataFile(run_dunerc.data_files[idx])
data_file = data_file_checks.DataFile(run_dunerc.data_files[idx], run_dunerc.verbosity_helper)
all_ok &= data_file_checks.sanity_check(data_file)
all_ok &= data_file_checks.check_file_attributes(data_file)
all_ok &= data_file_checks.check_event_count(
Expand Down
Loading