diff --git a/create_tarball.sh b/create_tarball.sh index 2dee665060..e59ec421c3 100755 --- a/create_tarball.sh +++ b/create_tarball.sh @@ -35,6 +35,7 @@ if [ ! -d ${software_dir_overlay} ]; then exit 3 fi +current_workdir=${PWD} cd ${overlay_upper_dir}/versions/ echo ">> Collecting list of files/directories to include in tarball via ${PWD}..." @@ -88,6 +89,9 @@ echo "wrote file list to ${files_list}" echo "wrote module file list to ${module_files_list}" [ -r ${module_files_list} ] && cat ${module_files_list} +# Copy the module files list to current workindg dir for later use in the test step +cp ${module_files_list} ${current_workdir}/module_files.list.txt + topdir=${cvmfs_repo}/versions/ echo ">> Creating tarball ${target_tgz} from ${topdir}..." diff --git a/easystacks/software.eessi.io/2023.06/a64fx/eessi-2023.06-eb-4.9.3-2023a.yml b/easystacks/software.eessi.io/2023.06/a64fx/eessi-2023.06-eb-4.9.3-2023a.yml new file mode 100644 index 0000000000..df3d0dedaa --- /dev/null +++ b/easystacks/software.eessi.io/2023.06/a64fx/eessi-2023.06-eb-4.9.3-2023a.yml @@ -0,0 +1,2 @@ +easyconfigs: + - LAMMPS-2Aug2023_update2-foss-2023a-kokkos.eb diff --git a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-001-system.yml b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-001-system.yml index 97c6031c79..1b2343ec1f 100644 --- a/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-001-system.yml +++ b/easystacks/software.eessi.io/2023.06/eessi-2023.06-eb-4.9.2-001-system.yml @@ -3,3 +3,9 @@ easyconfigs: options: # see https://github.com/easybuilders/easybuild-easyconfigs/pull/21412 from-commit: 1cdd81524c974a29825e37bcf8ef3ccc291f5227 + - ReFrame-4.6.2.eb: + options: + # see https://github.com/easybuilders/easybuild-easyconfigs/pull/21307 + from-commit: 0c4bd5c5a80f571a8932fbc38880d72455406816 + # see https://github.com/easybuilders/easybuild-easyblocks/pull/3431 + include-easyblocks-from-commit: efddeb02abe1a679324ac01ef19601dedbe79cc0 diff --git a/test_suite.sh b/test_suite.sh index 31f85f60fd..e7151e00e7 100755 --- a/test_suite.sh +++ b/test_suite.sh @@ -195,8 +195,22 @@ else fatal_error "Failed to run 'reframe --version'" 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 [[ ${test_selection_exit_code} -eq 0 ]]; then + echo_green "Succesfully extracted names of tests to run: ${REFRAME_NAME_ARGS}" +else + fatal_error "Failed to extract names of tests to run: ${REFRAME_NAME_ARGS}" + exit ${test_selection_exit_code} +fi +export REFRAME_ARGS="--tag CI --tag 1_node --nocolor ${REFRAME_NAME_ARGS}" + # List the tests we want to run -export REFRAME_ARGS='--tag CI --tag 1_node --nocolor' echo "Listing tests: reframe ${REFRAME_ARGS} --list" reframe ${REFRAME_ARGS} --list if [[ $? -eq 0 ]]; then diff --git a/tests/eessi_test_mapping/map_software_to_test.py b/tests/eessi_test_mapping/map_software_to_test.py new file mode 100644 index 0000000000..24cf246ef1 --- /dev/null +++ b/tests/eessi_test_mapping/map_software_to_test.py @@ -0,0 +1,90 @@ +import yaml +import re +import os +import argparse + +def load_mappings(file_path): + """Load the YAML mappings from a file.""" + if not os.path.exists(file_path): + raise FileNotFoundError(f"Error: {file_path} does not exist.") + with open(file_path, 'r') as file: + config = yaml.safe_load(file) + return config['mappings'] + +def read_software_names(file_path): + """Read software names from the module_files.list.txt file.""" + if not os.path.exists(file_path): + raise FileNotFoundError(f"Error: {file_path} does not exist.") + with open(file_path, 'r') as file: + software_names = [line.strip() for line in file if line.strip()] + return software_names + +def get_tests_for_software(software_name, mappings): + """Get the list of tests for a given software name based on the first matching regex pattern.""" + + # Iterate over patterns in the order they appear in the YAML file + for pattern, tests in mappings.items(): + if re.match(pattern, software_name): + return tests + + # If no matches are found, return the default tests if they exist + if 'default_tests' in mappings: + return mappings['default_tests'] + + return [] + +def main(yaml_file, module_file, debug): + """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}'") + + 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") + + # Always add the default set of tests, if default_tests is specified + if 'default_tests' in mappings: + additional_tests = mappings['default_tests'] + for test in additional_tests: + if test not in tests_to_run: + tests_to_run.append(test) + + if additional_tests and debug: + print(f"Adding default set of tests: {additional_tests}") + + # Create argument string out of the list of tests to run + if tests_to_run: + arg_string = " ".join([f"-n {test_name}" for test_name in tests_to_run]) + + # Print final lists & argument string + if debug: + print(f"Full list of tests to run: {tests_to_run}") + print(f"Argument string: {arg_string}") + else: + # This is the only thing this script should print, unless run with --debug + print(f"{arg_string}") + +if __name__ == "__main__": + 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.') + + args = parser.parse_args() + + main(args.mapping_file, args.module_list, args.debug) diff --git a/tests/eessi_test_mapping/software_to_tests.yml b/tests/eessi_test_mapping/software_to_tests.yml new file mode 100644 index 0000000000..626477781f --- /dev/null +++ b/tests/eessi_test_mapping/software_to_tests.yml @@ -0,0 +1,35 @@ +# This file creates a mapping between (regular expressions for) module names and test names from the EESSI test suite +# If a module name matches one of the regular expressions, the listed set of tests will be run in the test step +# For a given module name, the test list for the first matching regular expression is returned +# E.g. for +# mappings: +# foo-v1: +# - bar +# foo-* +# - bar2 +# only the bar test will be run for foo-v1 (even though it also matches the pattern (foo-*) +# If a module name does not match anything, the default_tests will be run +# Note that to list all available tests by name, one can do execute +# reframe -R -c /path/to/eessi/test-suite/ --list | grep -Po "\bEESSI_\S+?(?=[\s'])" | uniq +# Note that this regular expression is a bit sensitive to changes in the structure of ReFrame's output, +# but is confirmed to work for ReFrame version 4.6.1 +mappings: + PyTorch-Bundle/*: + - EESSI_PyTorch_torchvision + QuantumESPRESSO/*: + - EESSI_QuantumESPRESSO + CP2K/*: + - EESSI_CP2K + ESPResSo/*: + - EESSI_ESPRESSO + LAMMPS/*: + - EESSI_LAMMPS + OSU-Micro-Benchmarks/*: + - EESSI_OSU_Micro_Benchmarks + GROMACS/*: + - EESSI_GROMACS + default_tests: + # Low level tests + - EESSI_OSU_Micro_Benchmarks + # A very quick-to-run high level application test + - EESSI_LAMMPS