Skip to content

Commit

Permalink
Merge pull request #770 from casparvl/fix_tests_for_script_only_deplo…
Browse files Browse the repository at this point in the history
…yment

Fix test step when only deploying scripts
  • Loading branch information
boegel authored Oct 2, 2024
2 parents 42ae325 + e06e303 commit c4e20c6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 23 deletions.
6 changes: 4 additions & 2 deletions bot/check-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ else
[[ ${VERBOSE} -ne 0 ]] && echo " Slurm output file '"${job_out}"' NOT found"
fi


# ReFrame prints e.g.
#[----------] start processing checks
#[ RUN ] GROMACS_EESSI %benchmark_info=HECBioSim/Crambin %nb_impl=cpu %scale=2_nodes %module_name=GROMACS/2021.3-foss-2021a /d597cff4 @snellius:rome+default
Expand Down Expand Up @@ -76,7 +75,10 @@ fi
if [[ ! -z ${grep_reframe_failed} ]]; then
grep_reframe_result=${grep_reframe_failed}
else
grep_reframe_result=${grep_reframe_success}
# Grep the entire output of ReFrame, so that we can report it in the foldable section of the test report
GP_success_full='(?s)\[----------\] start processing checks.*?\[==========\] Finished on [a-zA-Z0-9 ]*'
grep_reframe_success_full=$(grep -v "^>> searching for " ${job_dir}/${job_out} | grep -Pzo "${GP_success}")
grep_reframe_result=${grep_reframe_success_full}
fi

echo "[TEST]" > ${job_test_result_file}
Expand Down
17 changes: 13 additions & 4 deletions test_suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,19 @@ fi
# Get the subset of test names based on the test mapping and tags (e.g. CI, 1_node)
module_list="module_files.list.txt"
mapping_config="tests/eessi_test_mapping/software_to_tests.yml"
# Run with --debug for easier debugging in case there are issues:
python3 tests/eessi_test_mapping/map_software_to_test.py --module-list "${module_list}" --mapping-file "${mapping_config}" --debug
REFRAME_NAME_ARGS=$(python3 tests/eessi_test_mapping/map_software_to_test.py --module-list "${module_list}" --mapping-file "${mapping_config}")
test_selection_exit_code=$?
if [[ ! -f "$module_list" ]]; then
echo_green "File ${module_list} not found, so only running the default set of tests from ${mapping_config}"
# Run with --debug for easier debugging in case there are issues:
python3 tests/eessi_test_mapping/map_software_to_test.py --mapping-file "${mapping_config}" --debug --defaults-only
REFRAME_NAME_ARGS=$(python3 tests/eessi_test_mapping/map_software_to_test.py --mapping-file "${mapping_config}" --defaults-only)
test_selection_exit_code=$?
else
# Run with --debug for easier debugging in case there are issues:
python3 tests/eessi_test_mapping/map_software_to_test.py --module-list "${module_list}" --mapping-file "${mapping_config}" --debug
REFRAME_NAME_ARGS=$(python3 tests/eessi_test_mapping/map_software_to_test.py --module-list "${module_list}" --mapping-file "${mapping_config}")
test_selection_exit_code=$?
fi
# Check exit status
if [[ ${test_selection_exit_code} -eq 0 ]]; then
echo_green "Succesfully extracted names of tests to run: ${REFRAME_NAME_ARGS}"
else
Expand Down
39 changes: 22 additions & 17 deletions tests/eessi_test_mapping/map_software_to_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,32 @@ def get_tests_for_software(software_name, mappings):

return []

def main(yaml_file, module_file, debug):
def main(yaml_file, module_file, debug, defaults_only):
"""Main function to process software names and their tests."""
mappings = load_mappings(yaml_file)
if debug:
print(f"Loaded mappings from '{yaml_file}'")

software_names = read_software_names(module_file)
if debug:
print(f"Read software names from '{module_file}'")
if not defaults_only:
software_names = read_software_names(module_file)
if debug:
print(f"Read software names from '{module_file}'")

tests_to_run = []
arg_string = ""
# For each module name, get the relevant set of tests
for software_name in software_names:
additional_tests = get_tests_for_software(software_name, mappings)
for test in additional_tests:
if test not in tests_to_run:
tests_to_run.append(test)

if additional_tests and debug:
print(f"Software: {software_name} -> Tests: {additional_tests}")
elif debug:
print(f"Software: {software_name} -> No tests found")

if not defaults_only:
# For each module name, get the relevant set of tests
for software_name in software_names:
additional_tests = get_tests_for_software(software_name, mappings)
for test in additional_tests:
if test not in tests_to_run:
tests_to_run.append(test)

if additional_tests and debug:
print(f"Software: {software_name} -> Tests: {additional_tests}")
elif debug:
print(f"Software: {software_name} -> No tests found")

# Always add the default set of tests, if default_tests is specified
if 'default_tests' in mappings:
Expand Down Expand Up @@ -83,8 +86,10 @@ def main(yaml_file, module_file, debug):
parser = argparse.ArgumentParser(description="Map software names to their tests based on a YAML configuration.")
parser.add_argument('--mapping-file', type=str, help='Path to the YAML file containing the test mappings.')
parser.add_argument('--module-list', type=str, help='Path to the file containing the list of software names.')
parser.add_argument('--debug', action='store_true', help='Enable debug output.')
defaults_help = "Don't consider the module-list file, only return the default tests from the mapping file"
parser.add_argument('--defaults-only', action='store_true', default=False, help=defaults_help)
parser.add_argument('--debug', action='store_true', default=False, help='Enable debug output.')

args = parser.parse_args()

main(args.mapping_file, args.module_list, args.debug)
main(args.mapping_file, args.module_list, args.debug, args.defaults_only)

0 comments on commit c4e20c6

Please sign in to comment.