diff --git a/scripts/dst_set_integtest_env_vars.sh b/scripts/dst_set_integtest_env_vars.sh new file mode 100644 index 0000000..4cdbbf1 --- /dev/null +++ b/scripts/dst_set_integtest_env_vars.sh @@ -0,0 +1,62 @@ +# This script needs to be sourced. +# +# Its purpose is to set values for various environmental variables that are +# useful for looking up integration tests in our C++ and Python repositories. + +# check if a software environment has been set up +if [[ "$DBT_AREA_ROOT" == "" ]]; then + echo + echo "Please set up a valid DUNE-DAQ software area before running this script." + return +fi + +# check if this script has already been run, and exit early if yes +if [[ "${DST_DAR_COPY}" != "" ]] && \ + [[ "${DST_DAR_COPY}" == "${DBT_AREA_ROOT}" ]]; then + return +fi +export DST_DAR_COPY="${DBT_AREA_ROOT}" + +# default all of the env vars that we might set to empty strings +export DST_LOCAL_CPP_SOURCE_DIR="" +export DST_LOCAL_PYTHON_SOURCE_DIR="" +export DST_LOCAL_PYTHON_VENV_DIR="" +export DST_LOCAL_SPACK_INSTALL_DIR="" +export DST_BASEREL_CPP_SOURCE_DIR="" +export DST_BASEREL_PYTHON_VENV_DIR="" +export DST_CORE_BASEREL_SPACK_DIR="" +export DST_DETSPEC_BASEREL_SPACK_DIR="" + +if [[ "${DBT_AREA_ROOT}" != "" ]] && [[ "`echo ${DBT_AREA_ROOT} | grep '^/cvmfs'`" == "" ]] && \ + [[ -w "${DBT_AREA_ROOT}" ]] && [[ -w "${DBT_AREA_ROOT}/sourcecode" ]]; then + export DST_LOCAL_CPP_SOURCE_DIR="${DBT_AREA_ROOT}/sourcecode" +fi + +if [[ "${DBT_AREA_ROOT}" != "" ]] && [[ "`echo ${DBT_AREA_ROOT} | grep '^/cvmfs'`" == "" ]] && \ + [[ -w "${DBT_AREA_ROOT}" ]] && [[ -w "${DBT_AREA_ROOT}/pythoncode" ]]; then + export DST_LOCAL_PYTHON_SOURCE_DIR="${DBT_AREA_ROOT}/pythoncode" +fi + +if [[ "${DBT_AREA_ROOT}" != "" ]] && [[ "`echo ${DBT_AREA_ROOT} | grep '^/cvmfs'`" == "" ]] && \ + [[ -w "${DBT_AREA_ROOT}" ]] && [[ -w "${DBT_AREA_ROOT}/.venv" ]]; then + export DST_LOCAL_PYTHON_VENV_DIR="`ls -1d ${DBT_AREA_ROOT}/.venv/lib/python*/site-packages 2>/dev/null | head -1`" +fi + +if [[ "${DBT_AREA_ROOT}" != "" ]] && [[ "`echo ${DBT_AREA_ROOT} | grep '^/cvmfs'`" == "" ]] && \ + [[ -w "${DBT_AREA_ROOT}" ]] && [[ -w "${DBT_AREA_ROOT}/install" ]]; then + export DST_LOCAL_SPACK_INSTALL_DIR="${DBT_AREA_ROOT}/install" +fi + +dbt_info_output=`dbt-info release` +detector_specific_release_dir=`echo "${dbt_info_output}" | grep 'Release dir' | awk '{print $3}'` +detector_specific_release_name=`echo "${dbt_info_output}" | grep 'Release name:' | awk '{print $3}'` +core_release_name=`echo "${dbt_info_output}" | grep 'Base release name:' | awk '{print $4}'` +core_release_dir=`echo "${detector_specific_release_dir}" | sed "s/${detector_specific_release_name}/${core_release_name}/g"` + +export DST_BASEREL_CPP_SOURCE_DIR="${detector_specific_release_dir}/sourcecode" + +export DST_BASEREL_PYTHON_VENV_DIR="`ls -1d ${detector_specific_release_dir}/.venv/lib/python*/site-packages 2>/dev/null | head -1`" + +export DST_CORE_BASEREL_SPACK_DIR="`ls -1d ${core_release_dir}/spack-installation/opt/spack/linux-*/gcc-* 2>/dev/null | head -1`" + +export DST_DETSPEC_BASEREL_SPACK_DIR="`ls -1d ${detector_specific_release_dir}/spack-installation/opt/spack/linux-*/gcc-* 2>/dev/null | head -1`" diff --git a/scripts/dunedaq_integtest_bundle.sh b/scripts/dunedaq_integtest_bundle.sh index 8a109aa..565c716 100755 --- a/scripts/dunedaq_integtest_bundle.sh +++ b/scripts/dunedaq_integtest_bundle.sh @@ -185,6 +185,7 @@ let random_subset_count=0 only_list_tests="" PYTEST_BASE_COMMAND=(pytest -s --tb=short) # our core pytest command, with DAQ printout included and short pytest traceback PYTEST_OPTIONS=() +BASEREL_PYTEST_SUMMARY_CHOICE="--no-summary" while true; do case "$1" in @@ -311,6 +312,7 @@ while true; do if [[ $level -ge 6 ]]; then # enable printout of Pytest 'skip' reasons and turn on drunc debugging PYTEST_OPTIONS+=(-rs --dunerc-option log-level debug) + BASEREL_PYTEST_SUMMARY_CHOICE="" fi shift 2 ;; @@ -392,6 +394,7 @@ else fi # determine the list of tests +source dst_set_integtest_env_vars.sh if [[ "${excluded_repo_names}" == "" ]]; then initial_integtest_list=(`list_available_integtests.sh ${requested_repo_list[@]} 2>/dev/null`) else @@ -534,43 +537,74 @@ while [[ ${full_set_loop_count} -lt ${full_set_requested_interations} ]]; do PYTEST_COMMAND+=("--junit-xml=${test_repo}_${test_name%.py}_results.xml" "--") fi - # First, check if the test is found in the Python virtual environment. - # This picks up tests from our Python-only software packages. - if [[ "`ls ${DBT_AREA_ROOT}/.venv/lib/python*/site-packages/${test_repo}/integtest/${test_name} 2>/dev/null`" != "" ]]; then - PYTEST_COMMAND+=(${DBT_AREA_ROOT}/.venv/lib/python*/site-packages/${test_repo}/integtest/${test_name}) - "${PYTEST_COMMAND[@]}" | CaptureOutputNoANSI ${ITGRUNNER_LOG_FILE} - - # Next, check if the test exists in the current working directory. - # This is a convenience for developers when they are working on an integtest - # in a C++ package (the test is found without rebuilding the software). - elif [[ -e "./${test_name}" ]]; then - PYTEST_COMMAND+=(./${test_name}) - "${PYTEST_COMMAND[@]}" | CaptureOutputNoANSI ${ITGRUNNER_LOG_FILE} - - # Next, check if the test exists in the local software area. - elif [[ -e "${DBT_AREA_ROOT}/sourcecode/${test_repo}/integtest/${test_name}" ]]; then - if [[ -w "${DBT_AREA_ROOT}" ]]; then - PYTEST_COMMAND+=(${DBT_AREA_ROOT}/sourcecode/${test_repo}/integtest/${test_name}) + # determine the repository type, to help determine where to look for the test + repo_type="`get_repo_type.sh ${test_repo}`" + + # handle tests in Python repositories + if [[ "${repo_type}" == "Python" ]]; then + + if [[ "${DST_LOCAL_PYTHON_VENV_DIR}" != "" ]]; then + if [[ -e "${DST_LOCAL_PYTHON_VENV_DIR}/${test_repo}/integtest/${test_name}" ]] && \ + [[ -e "${DST_LOCAL_PYTHON_SOURCE_DIR}/${test_repo}/src/${test_repo}/integtest/${test_name}" ]] && \ + [[ "`diff ${DST_LOCAL_PYTHON_VENV_DIR}/${test_repo}/integtest/${test_name} ${DST_LOCAL_PYTHON_SOURCE_DIR}/${test_repo}/src/${test_repo}/integtest/${test_name}`" != "" ]]; then + echo "" + echo -e "\U1f7e1 WARNING: The version of ${test_name} in" | CaptureOutput ${ITGRUNNER_LOG_FILE} + echo -e "\U1f7e1 WARNING: ${DST_LOCAL_PYTHON_SOURCE_DIR}/${test_repo}/src/${test_repo}/integtest" | CaptureOutput ${ITGRUNNER_LOG_FILE} + echo -e "\U1f7e1 WARNING: does not match the version found in the local Python virtual environment (.venv dir)." | CaptureOutput ${ITGRUNNER_LOG_FILE} + echo -e "\U1f7e1 WARNING: This can happen when the Python package needs to be (re?)installed locally." | CaptureOutput ${ITGRUNNER_LOG_FILE} + echo -e "\U1f7e1 WARNING: Please try re-installing ${test_repo} (e.g. 'pip install .') or re-running 'dbt-build'." | CaptureOutput ${ITGRUNNER_LOG_FILE} + elif [[ -e "${DST_LOCAL_PYTHON_VENV_DIR}/${test_repo}/integtest/${test_name}" ]]; then + PYTEST_COMMAND+=(${DST_LOCAL_PYTHON_VENV_DIR}/${test_repo}/integtest/${test_name}) + "${PYTEST_COMMAND[@]}" | CaptureOutputNoANSI ${ITGRUNNER_LOG_FILE} + else + echo "" + echo -e "\U1f7e1 WARNING: ${test_name} was not found in the local Python virtual environment (.venv dir)." | CaptureOutput ${ITGRUNNER_LOG_FILE} + echo -e "\U1f7e1 WARNING: This can happen when the Python package needs to be (re?)installed locally, or when" | CaptureOutput ${ITGRUNNER_LOG_FILE} + echo -e "\U1f7e1 WARNING: it has been installed with the '-e' option. Please try re-installing the ${test_repo}" | CaptureOutput ${ITGRUNNER_LOG_FILE} + echo -e "\U1f7e1 WARNING: package without the '-e' option (e.g. 'pip install .') or re-running 'dbt-build'." | CaptureOutput ${ITGRUNNER_LOG_FILE} + fi + + elif [[ "${DST_BASEREL_PYTHON_VENV_DIR}" != "" ]] && \ + [[ -e "${DST_BASEREL_PYTHON_VENV_DIR}/${test_repo}/integtest/${test_name}" ]]; then + # remove any trailing "--" in PYTEST_COMMAND since we are adding more pytest options here + if [[ "${PYTEST_COMMAND[-1]}" == "--" ]]; then + unset 'PYTEST_COMMAND[-1]' + fi + PYTEST_COMMAND+=(-p no:cacheprovider ${BASEREL_PYTEST_SUMMARY_CHOICE} ${DST_BASEREL_PYTHON_VENV_DIR}/${test_repo}/integtest/${test_name}) "${PYTEST_COMMAND[@]}" | CaptureOutputNoANSI ${ITGRUNNER_LOG_FILE} + else + echo "" + echo -e "\U0001F534 ERROR: Unable to find ${test_name} in the ${test_repo} (Python) repo." | CaptureOutput ${ITGRUNNER_LOG_FILE} + echo -e "\U0001F534 ERROR: This should not have happened. Please contact daqsystemtest developers." | CaptureOutput ${ITGRUNNER_LOG_FILE} + fi + + # handle tests in C++ repositories + elif [[ "${repo_type}" == "CPP" ]]; then + + if [[ "${DST_LOCAL_CPP_SOURCE_DIR}" != "" ]] && \ + [[ -e "${DST_LOCAL_CPP_SOURCE_DIR}/${test_repo}/integtest/${test_name}" ]]; then + PYTEST_COMMAND+=(${DST_LOCAL_CPP_SOURCE_DIR}/${test_repo}/integtest/${test_name}) + "${PYTEST_COMMAND[@]}" | CaptureOutputNoANSI ${ITGRUNNER_LOG_FILE} + elif [[ "${DST_BASEREL_CPP_SOURCE_DIR}" != "" ]] && \ + [[ -e "${DST_BASEREL_CPP_SOURCE_DIR}/${test_repo}/integtest/${test_name}" ]]; then # remove any trailing "--" in PYTEST_COMMAND since we are adding more pytest options here if [[ "${PYTEST_COMMAND[-1]}" == "--" ]]; then unset 'PYTEST_COMMAND[-1]' fi - PYTEST_COMMAND+=(-p no:cacheprovider --no-summary ${DBT_AREA_ROOT}/sourcecode/${test_repo}/integtest/${test_name}) + PYTEST_COMMAND+=(-p no:cacheprovider ${BASEREL_PYTEST_SUMMARY_CHOICE} ${DST_BASEREL_CPP_SOURCE_DIR}/${test_repo}/integtest/${test_name}) "${PYTEST_COMMAND[@]}" | CaptureOutputNoANSI ${ITGRUNNER_LOG_FILE} + + else + echo "" + echo -e "\U0001F534 ERROR: Unable to find ${test_name} in the ${test_repo} (C++) repo." | CaptureOutput ${ITGRUNNER_LOG_FILE} + echo -e "\U0001F534 ERROR: This should not have happened. Please contact daqsystemtest developers." | CaptureOutput ${ITGRUNNER_LOG_FILE} fi - # Lastly, we assume that the test can be found in the installed software - # area (for C++ packages). else - share_envvar_name="${test_repo^^}_SHARE" # double caret converts env var to uppercase - # remove any trailing "--" in PYTEST_COMMAND since we are adding more pytest options here - if [[ "${PYTEST_COMMAND[-1]}" == "--" ]]; then - unset 'PYTEST_COMMAND[-1]' - fi - PYTEST_COMMAND+=(-p no:cacheprovider --no-summary ${!share_envvar_name}/integtest/${test_name}) - "${PYTEST_COMMAND[@]}" | CaptureOutputNoANSI ${ITGRUNNER_LOG_FILE} + echo "" + echo -e "\U0001F534 ERROR: Unexpected repo type for the '${test_repo}' repo: \"${repo_type}\"." | CaptureOutput ${ITGRUNNER_LOG_FILE} + echo -e "\U0001F534 ERROR: This should not have happened. Please contact daqsystemtest developers." | CaptureOutput ${ITGRUNNER_LOG_FILE} fi let pytest_return_code=${PIPESTATUS[0]} @@ -598,8 +632,8 @@ while [[ ${full_set_loop_count} -lt ${full_set_requested_interations} ]]; do script_pid=`jq -r .bundle_script_process_id ${info_file}` individual_test_start_time=`jq -r .individual_test_start_time ${info_file}` if [[ ${script_start_time} -eq ${INITIAL_TIMESTAMP} ]] && \ - [[ ${script_pid} -eq ${CURRENT_PID} ]] && \ - [[ ${individual_test_start_time} -eq ${CURRENT_TIMESTAMP} ]]; then + [[ ${script_pid} -eq ${CURRENT_PID} ]] && \ + [[ ${individual_test_start_time} -eq ${CURRENT_TIMESTAMP} ]]; then current_pytest_rundir=$info_file break fi @@ -617,13 +651,24 @@ while [[ ${full_set_loop_count} -lt ${full_set_requested_interations} ]]; do echo -e "\U1F535 Copying the files from failed test ${pytest_tmpdir} to ${new_dir}. \U1F535" echo -e "\U1F535 Please note that copied directories from failed tests typically get cleaned up after 26 hours, \U1F535" echo -e "\U1F535 or when 10 newer failures happen, whichever comes first. \U1F535" - cp -pR "${pytest_tmpdir}" "${new_dir}" + # 15-Oct-2026, KAB: added use of rsync with a size limit to avoid + # copying large files (e.g. large HDF5 data files) + if [[ "`which rsync 2>/dev/null`" != "" ]]; then + rsync -a --max-size=200m "${pytest_tmpdir}/" "${new_dir}" + else + cp -pR "${pytest_tmpdir}" "${new_dir}" + fi if [[ $? == 0 ]]; then was_successfully_copied="yes" # 18-Dec-2025, KAB: added the removal of the "current" symbolic links # from inside the copied directory (since they get broken in the copying) rm -f "${new_dir}/configcurrent" rm -f "${new_dir}/runcurrent" + # 15-Oct-2026, KAB: set permissions so that others can see files from failed tests + chmod go+rx ${new_dir} + chmod go+rx ${new_dir}/run* + chmod go+rx ${new_dir}/config* + chmod go+rx ${new_dir}/.. fi fi fi @@ -680,8 +725,8 @@ echo "" | CaptureOutput ${ITGR date | CaptureOutput ${ITGRUNNER_LOG_FILE} echo "Log file is: ${ITGRUNNER_LOG_FILE}" | CaptureOutput ${ITGRUNNER_LOG_FILE} echo "" | CaptureOutput ${ITGRUNNER_LOG_FILE} -summary_string="`egrep $'=====|\u2B95' ${ITGRUNNER_LOG_FILE} | egrep ' in |Running'`" -colorized_summary_string="`echo \"${summary_string}\" | sed 's/passed/passed \\\\U2705/' | sed 's/failed/failed \\\\U274c/' | sed 's/\(errors\?\)/\1 \\\\U1F6A8/' | sed 's/no tests ran/no tests ran \\\\U1F6A8/' | sed 's/skipped/skipped \\\\U1f7e1/'`" +summary_string="`egrep $'=====|\u2B95|\U1f7e1 WARNING|\U0001F534 ERROR' ${ITGRUNNER_LOG_FILE} | egrep ' in |Running|WARNING|ERROR'`" +colorized_summary_string="`echo \"${summary_string}\" | sed 's/passed/passed \\\\U2705/' | sed 's/failed/failed \\\\U274c/' | sed 's/warning/warning \\\\U274c/' | sed 's/\(errors\?\)/\1 \\\\U1F6A8/' | sed 's/no tests ran/no tests ran \\\\U1F6A8/' | sed 's/skipped/skipped \\\\U1f7e1/' | sed 's/deselected/deselected \\\\U1f7e1/'`" echo -e "${colorized_summary_string}" | CaptureOutput ${ITGRUNNER_LOG_FILE} # check again if the numad daemon is running diff --git a/scripts/get_repo_type.sh b/scripts/get_repo_type.sh new file mode 100755 index 0000000..8f22fde --- /dev/null +++ b/scripts/get_repo_type.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +if [[ $# -eq 0 ]] || [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "-?" ]]; then + echo + echo "Usage: `basename $0` " + echo + echo " Determines the type of the specified repo, \"CPP\" or \"Python\"." + echo " Prints out \"Unknown\" if the type can't be determined." + echo + exit +fi +repo_name=$1 + +# check if a software environment has been set up +if [[ "$DBT_AREA_ROOT" == "" ]]; then + echo + echo "Please set up a valid DUNE-DAQ software area before running this script." + exit +fi + +source dst_set_integtest_env_vars.sh + +if [[ "${DST_LOCAL_SPACK_INSTALL_DIR}" != "" ]] && \ + [[ -e "${DST_LOCAL_SPACK_INSTALL_DIR}/${repo_name}" ]]; then + echo "CPP" +elif [[ "${DST_CORE_BASEREL_SPACK_DIR}" != "" ]] && \ + [[ "`ls -1d ${DST_CORE_BASEREL_SPACK_DIR}/${repo_name}* 2>/dev/null | head -1`" != "" ]]; then + echo "CPP" +elif [[ "${DST_DETSPEC_BASEREL_SPACK_DIR}" != "" ]] && \ + [[ "`ls -1d ${DST_DETSPEC_BASEREL_SPACK_DIR}/${repo_name}* 2>/dev/null | head -1`" != "" ]]; then + echo "CPP" +elif [[ "${DST_LOCAL_PYTHON_VENV_DIR}" != "" ]] && \ + [[ -e ${DST_LOCAL_PYTHON_VENV_DIR}/${repo_name} ]]; then + echo "Python" +elif [[ "${DST_BASEREL_PYTHON_VENV_DIR}" != "" ]] && \ + [[ -e ${DST_BASEREL_PYTHON_VENV_DIR}/${repo_name} ]]; then + echo "Python" +else + echo "Unknown" +fi diff --git a/scripts/list_available_integtests.sh b/scripts/list_available_integtests.sh index ee2abc3..9472b96 100755 --- a/scripts/list_available_integtests.sh +++ b/scripts/list_available_integtests.sh @@ -1,5 +1,4 @@ #!/bin/bash -# 19-Dec-2025, KAB # function to display usage hints usage() { @@ -20,6 +19,9 @@ Options: """ } +# initialization +source dst_set_integtest_env_vars.sh + # function to check for a specific string in a list string_in_list() { # get the search string from the first argument @@ -38,6 +40,76 @@ string_in_list() { return 1 } +# function to find integtests in a local sourcecode area +list_local_sourcecode_tests() { + if [[ "$DST_LOCAL_CPP_SOURCE_DIR" == "" ]]; then + return 1 + fi + local repo_name="$1" + tmp_list=(`ls -1 ${DST_LOCAL_CPP_SOURCE_DIR}/${repo_name}/integtest/*_test.py 2>/dev/null | xargs -r -n 1 basename | sort -u`) + if [[ ${#tmp_list[@]} -gt 0 ]]; then + integtest_list=(${tmp_list[@]}) + return 0 + fi + return 1 +} + +# function to find integtests in a local pythoncode area +list_local_pythoncode_tests() { + if [[ "$DST_LOCAL_PYTHON_SOURCE_DIR" == "" ]]; then + return 1 + fi + local repo_name="$1" + tmp_list=(`ls -1 ${DST_LOCAL_PYTHON_SOURCE_DIR}/${repo_name}/src/${repo_name}/integtest/*_test.py 2>/dev/null | xargs -r -n 1 basename | sort -u`) + if [[ ${#tmp_list[@]} -gt 0 ]]; then + integtest_list=(${tmp_list[@]}) + return 0 + fi + return 1 +} + +# function to find integtests in base release C++ repos +list_baserel_cpp_tests() { + if [[ "$DST_BASEREL_CPP_SOURCE_DIR" == "" ]]; then + return 1 + fi + local repo_name="$1" + tmp_list=(`ls -1d ${DST_BASEREL_CPP_SOURCE_DIR}/${repo_name}/integtest/*_test.py 2>/dev/null | xargs -r -n 1 basename | sort -u`) + if [[ ${#tmp_list[@]} -gt 0 ]]; then + integtest_list=(${tmp_list[@]}) + return 0 + fi + return 1 +} + +# function to find integtests in local Python virtual environment +list_local_venv_py_tests() { + if [[ "$DST_LOCAL_PYTHON_VENV_DIR" == "" ]]; then + return 1 + fi + local repo_name="$1" + tmp_list=(`ls -1d ${DST_LOCAL_PYTHON_VENV_DIR}/${repo_name}/integtest/*_test.py 2>/dev/null | xargs -r -n 1 basename | sort -u`) + if [[ ${#tmp_list[@]} -gt 0 ]]; then + integtest_list=(${tmp_list[@]}) + return 0 + fi + return 1 +} + +# function to find integtests in base release Python virtual environment +list_baserel_venv_py_tests() { + if [[ "$DST_BASEREL_PYTHON_VENV_DIR" == "" ]]; then + return 1 + fi + local repo_name="$1" + tmp_list=(`ls -1d ${DST_BASEREL_PYTHON_VENV_DIR}/${repo_name}/integtest/*_test.py 2>/dev/null | xargs -r -n 1 basename | sort -u`) + if [[ ${#tmp_list[@]} -gt 0 ]]; then + integtest_list=(${tmp_list[@]}) + return 0 + fi + return 1 +} + GETOPT_TEMP=`getopt -o hx: --long help,exclude: -- "$@"` if [ $? -ne 0 ]; then usage @@ -111,13 +183,16 @@ echo "Looking for integtests in the _${repo_list[@]}_ repo(s)..." >&2 echo "" >&2 for repo_name in "${repo_list[@]}"; do - share_envvar_name="${repo_name^^}_SHARE" # double caret converts env var to uppercase - - # Here, we list all integtests that exist either in the installed software area (C++ packages), - # the local software area, or the Python virtual environment (the .venv subdir). - # ${!var} returns what var points to - integtest_list=(`ls -1 ${!share_envvar_name}/integtest/*_test.py ${DBT_AREA_ROOT}/sourcecode/${repo_name}/integtest/*_test.py ${DBT_AREA_ROOT}/.venv/lib/python*/site-packages/${repo_name}/integtest/*_test.py 2>/dev/null | xargs -r -n 1 basename | sort -u`) - if [[ ${#integtest_list[@]} -gt 0 ]]; then + # We look for tests in several places and stop looking as soon as we find some. + # The functions that are called in this "if" statement modify the integtest_list + # when tests are found, and return "true" when they do, so the contents of the + # "if" block can simply print out what is in the integtest_list. + integtest_list=() + if list_local_sourcecode_tests ${repo_name} || \ + list_local_pythoncode_tests ${repo_name} || \ + list_local_venv_py_tests ${repo_name} || \ + list_baserel_cpp_tests ${repo_name} || \ + list_baserel_venv_py_tests ${repo_name}; then for test_name in "${integtest_list[@]}"; do echo "${repo_name}/${test_name}" done @@ -125,20 +200,23 @@ for repo_name in "${repo_list[@]}"; do echo "-> No integtests were found for repository \"${repo_name}\"." >&2 # The following logic is simply an attempt to provide a little more information - # about *why* the integtest was not found. It attemts to take into account + # about *why* the integtest was not found. It tries to take into account # differences between C++ packages and Python packages. - if [[ -e "${DBT_AREA_ROOT}/sourcecode/${repo_name}" ]]; then - echo "-> No integtest directory was found in ${DBT_AREA_ROOT}/sourcecode/${repo_name}." >&2 - fi - if [[ "${!share_envvar_name}" == "" ]] && [[ `pip list | grep "^${repo_name} "` == "" ]]; then - echo "-> \"${repo_name}\" does not appear to be a valid repository name." >&2 - else - if [[ "${!share_envvar_name}" != "" ]]; then - echo "-> No integtest directory was found in ${share_envvar_name} (${!share_envvar_name})." >&2 - fi - if [[ `pip list | grep "^${repo_name} "` != "" ]]; then - echo "-> No integtest directory was found in ${DBT_AREA_ROOT}/venv for repo \"${repo_name}\"." >&2 - fi + if [[ -e "${DST_LOCAL_CPP_SOURCE_DIR}/${repo_name}" ]] && \ + [[ ! -e "${DST_LOCAL_CPP_SOURCE_DIR}/${repo_name}/integtest" ]]; then + echo "-> No integtest directory was found in ${DST_LOCAL_CPP_SOURCE_DIR}/${repo_name}." >&2 + elif [[ -e "${DST_LOCAL_PYTHON_SOURCE_DIR}/${repo_name}" ]] && \ + [[ ! -e "${DST_LOCAL_PYTHON_SOURCE_DIR}/${repo_name}/src/${repo_name}/integtest" ]]; then + echo "-> No integtest directory was found in ${DST_LOCAL_PYTHON_SOURCE_DIR}/${repo_name}/src/${repo_name}." >&2 + elif [[ -e "${DST_LOCAL_PYTHON_VENV_DIR}/${repo_name}" ]] && \ + [[ ! -e "${DST_LOCAL_PYTHON_VENV_DIR}/${repo_name}/integtest" ]]; then + echo "-> No integtest directory was found in ${DST_LOCAL_PYTHON_VENV_DIR}/${repo_name}." >&2 + elif [[ -e "${DST_BASEREL_PYTHON_VENV_DIR}/${repo_name}" ]] && \ + [[ ! -e "${DST_BASEREL_PYTHON_VENV_DIR}/${repo_name}/integtest" ]]; then + echo "-> No integtest directory was found in ${DST_BASEREL_PYTHON_VENV_DIR}/${repo_name}." >&2 + elif [[ -e "${DST_BASEREL_CPP_SOURCE_DIR}/${repo_name}" ]] && \ + [[ ! -e "${DST_BASEREL_CPP_SOURCE_DIR}/${repo_name}/integtest" ]]; then + echo "-> No integtest directory was found in ${DST_BASEREL_CPP_SOURCE_DIR}/${repo_name}." >&2 fi fi done diff --git a/scripts/list_repos_with_integtests.sh b/scripts/list_repos_with_integtests.sh index 6b202d6..24ab572 100755 --- a/scripts/list_repos_with_integtests.sh +++ b/scripts/list_repos_with_integtests.sh @@ -7,9 +7,9 @@ if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "-?" ]]; then echo echo " Lists the software repositories that have integration tests (integtests) in them." echo - echo " For C++ packages, the base release, local install dir, and local sourcecode dir" + echo " For C++ packages, the local sourcecode dir (if any) and the base release " echo " are searched, unless \"local\" is passed as an argument. In that case, only the" - echo " local install and sourcecode directories are searched." + echo " local sourcecode directory is searched." echo echo " For Python packages, the \$DBT_AREA_ROOT/.venv area is searched, independent of" echo " whether that area is part of a local software area or a base release. If the" @@ -19,54 +19,61 @@ if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "-?" ]]; then exit fi +# check if a software environment has been set up +if [[ "$DBT_AREA_ROOT" == "" ]]; then + echo + echo "Please set up a valid DUNE-DAQ software area before running this script." + exit +fi + # initialization -all_repo_paths=() +all_integtest_paths=() +source dst_set_integtest_env_vars.sh -# skip repos in the base release, if the user has specified "local" +# let the user know what is happening echo "" >&2 if [[ $# -eq 0 ]] || [[ "$1" != "local" ]]; then echo "Looking for _all_ repositories with integtests in them..." >&2 - echo "" >&2 - - # determine the base release directory - release_dir=`dbt-info release | grep 'Release dir:' | cut -d' ' -f3` - base_release_name=`dbt-info release | grep 'Base release name:' | cut -d' ' -f4` - base_release_dir="${release_dir}/../${base_release_name}" - - # look up the paths of all of the C++ repositories in the core and detector-specific categories with integtests - det_rel_repo_paths=(`ls -1d ${release_dir}/spack-installation/opt/spack/*linux*/gcc-*/*/*/integtest/*_test.py 2>/dev/null`) - base_rel_repo_paths=(`ls -1d ${base_release_dir}/spack-installation/opt/spack/*linux*/gcc-*/*/*/integtest/*_test.py 2>/dev/null`) - all_repo_paths=("${det_rel_repo_paths[@]}" "${base_rel_repo_paths[@]}") - - # add in the paths of the Python repositories with integtests - if [[ "${DBT_AREA_ROOT}" != "" ]]; then - venv_dir_repo_paths=(`ls -1 ${DBT_AREA_ROOT}/.venv/lib/python*/site-packages/*/integtest/*_test.py`) - all_repo_paths=("${all_repo_paths[@]}" "${venv_dir_repo_paths[@]}") - fi else echo "Looking for _local_ repositories with integtests in them..." >&2 - echo "" >&2 fi +echo "" >&2 -# add in the paths of the C++ repositories in the local install and sourcecode dirs -if [[ "$DBT_AREA_ROOT" != "" ]]; then - install_dir_repo_paths=(`ls -1 ${DBT_AREA_ROOT}/install/*/share/integtest/*_test.py 2>/dev/null`) - sourcecode_dir_repo_paths=(`ls -1 ${DBT_AREA_ROOT}/sourcecode/*/integtest/*_test.py 2>/dev/null`) - all_repo_paths=("${all_repo_paths[@]}" "${install_dir_repo_paths[@]}" "${sourcecode_dir_repo_paths[@]}") +# look in a local software area first +# -> C++ repositories +if [[ "${DST_LOCAL_CPP_SOURCE_DIR}" != "" ]]; then + sourcecode_dir_repo_paths=(`ls -1 ${DST_LOCAL_CPP_SOURCE_DIR}/*/integtest/*_test.py 2>/dev/null`) + all_integtest_paths+=("${sourcecode_dir_repo_paths[@]}") +fi +# -> Python repositories +if [[ "${DST_LOCAL_PYTHON_SOURCE_DIR}" != "" ]]; then + pythoncode_dir_repo_paths=(`ls -1 ${DST_LOCAL_PYTHON_SOURCE_DIR}/*/src/*/integtest/*_test.py 2>/dev/null`) + all_integtest_paths+=("${pythoncode_dir_repo_paths[@]}") fi -# add in the paths of the Python repositories that have integtests and are cloned locally -if [[ "`echo $DBT_AREA_ROOT | grep '^/cvmfs'`" == "" ]]; then - venv_dir_repo_paths=(`ls -1 ${DBT_AREA_ROOT}/.venv/lib/python*/site-packages/*/integtest/*_test.py 2>/dev/null`) - for path in "${venv_dir_repo_paths[@]}"; do - repo_name=`echo ${path} | sed 's,.*site-packages/,,' | sed 's,/integtest.*,,'` - if [[ -e $DBT_AREA_ROOT/pythoncode/${repo_name} ]]; then - all_repo_paths=("${all_repo_paths[@]}" "${path}") - fi - done +# include additional areas, unless the user has specified "local" +if [[ $# -eq 0 ]] || [[ "$1" != "local" ]]; then + + # include a local Python virtual environment, if it exists + if [[ "${DST_LOCAL_PYTHON_VENV_DIR}" != "" ]]; then + venv_py_repos=(`ls -1d ${DST_LOCAL_PYTHON_VENV_DIR}/*/integtest/*_test.py 2>/dev/null`) + all_integtest_paths+=("${venv_py_repos[@]}") + fi + + # add in the paths of the C++ integtests in the base release + if [[ "${DST_BASEREL_CPP_SOURCE_DIR}" != "" ]]; then + base_rel_cpp_repos=(`ls -1d ${DST_BASEREL_CPP_SOURCE_DIR}/*/integtest/*_test.py 2>/dev/null`) + all_integtest_paths+=("${base_rel_cpp_repos[@]}") + fi + + # add in the paths of the Python integtests in the base release virtual environment + if [[ "${DST_BASEREL_PYTHON_VENV_DIR}" != "" ]]; then + venv_py_repos=(`ls -1d ${DST_BASEREL_PYTHON_VENV_DIR}/*/integtest/*_test.py 2>/dev/null`) + all_integtest_paths+=("${venv_py_repos[@]}") + fi fi -repos_with_integtests=(`echo "${all_repo_paths[@]}" | sed 's,/share,,g' | xargs -r -n 1 dirname | xargs -r -n 1 dirname | xargs -r -n 1 basename | cut -d'-' -f1 | sort -u`) +repos_with_integtests=(`echo "${all_integtest_paths[@]}" | sed 's,/share,,g' | xargs -r -n 1 dirname | xargs -r -n 1 dirname | xargs -r -n 1 basename | cut -d'-' -f1 | sort -u`) for repo in "${repos_with_integtests[@]}"; do echo "$repo"