diff --git a/scripts/dunedaq_integtest_bundle.sh b/scripts/dunedaq_integtest_bundle.sh index c220d40..53d9d0f 100755 --- a/scripts/dunedaq_integtest_bundle.sh +++ b/scripts/dunedaq_integtest_bundle.sh @@ -285,8 +285,19 @@ while [[ ${full_set_loop_count} -lt ${full_set_requested_interations} ]]; do echo -e "\U0001F535 \033[0;34mStarting test ${overall_test_index} of ${total_number_of_tests}...\033[0m \U0001F535" | CaptureOutput ${ITGRUNNER_LOG_FILE} echo -e "\u2B95 \033[0;1mRunning ${FULL_TEST_NAME}\033[0m \u2B05" | CaptureOutput ${ITGRUNNER_LOG_FILE} - if [[ -e "./${test_name}" ]]; then + + # 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} | 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} | 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} | CaptureOutputNoANSI ${ITGRUNNER_LOG_FILE} @@ -295,6 +306,9 @@ while [[ ${full_set_loop_count} -lt ${full_set_requested_interations} ]]; do PYTEST_COMMAND=`echo ${PYTEST_COMMAND} | sed 's/--$//'` ${PYTEST_COMMAND} -p no:cacheprovider --no-summary ${DBT_AREA_ROOT}/sourcecode/${test_repo}/integtest/${test_name} | CaptureOutputNoANSI ${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 the trailing "--" in PYTEST_COMMAND since we are adding more pytest options here diff --git a/scripts/list_available_integtests.sh b/scripts/list_available_integtests.sh index 3f0f328..ff7f216 100755 --- a/scripts/list_available_integtests.sh +++ b/scripts/list_available_integtests.sh @@ -94,24 +94,33 @@ 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 - if [[ -e "${!share_envvar_name}/integtest" ]] || [[ -e "${DBT_AREA_ROOT}/sourcecode/${repo_name}/integtest" ]]; then - integtest_list=(`ls -1 ${!share_envvar_name}/integtest/*_test.py ${DBT_AREA_ROOT}/sourcecode/${repo_name}/integtest/*_test.py 2>/dev/null | xargs -r -n 1 basename | sort -u`) - if [[ ${#integtest_list[@]} -gt 0 ]]; then - for test_name in "${integtest_list[@]}"; do - echo "${repo_name}/${test_name}" - done - else - echo "-> No integtests were found for repository \"${repo_name}\"." >&2 - fi + 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 + for test_name in "${integtest_list[@]}"; do + echo "${repo_name}/${test_name}" + done else + 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 + # 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}" == "" ]]; then + if [[ "${!share_envvar_name}" == "" ]] && [[ `pip list | grep "^${repo_name} "` == "" ]]; then echo "-> \"${repo_name}\" does not appear to be a valid repository name." >&2 else - echo "-> No integtest directory was found in ${share_envvar_name} (${!share_envvar_name})." >&2 + 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 fi fi done diff --git a/scripts/list_repos_with_integtests.sh b/scripts/list_repos_with_integtests.sh index 2e973e9..6b202d6 100755 --- a/scripts/list_repos_with_integtests.sh +++ b/scripts/list_repos_with_integtests.sh @@ -4,10 +4,17 @@ if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "-?" ]]; then echo echo "Usage: `basename $0` [optional \"local\" keyword]" + echo echo " Lists the software repositories that have integration tests (integtests) in them." - echo " Searches the base releases, local install dir, and local sourcecode dir," - echo " unless \"local\" is passed as an argument. In that case, only the local" - echo " install and sourcecode directories are searched." + echo + echo " For C++ packages, the base release, local install dir, and local sourcecode dir" + echo " are searched, unless \"local\" is passed as an argument. In that case, only the" + echo " local install and sourcecode directories are 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" + echo " \"local\" flag is specified, an attempt is made to limit the results to packages" + echo " that have been cloned into the local 'pythoncode' directory." echo exit fi @@ -26,22 +33,39 @@ if [[ $# -eq 0 ]] || [[ "$1" != "local" ]]; then 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 repositories in the core and detector-specific categories - det_rel_repo_paths=(`ls -1d ${release_dir}/spack-installation/opt/spack/*linux*/gcc-*/*/*/integtest/*_test.py`) - base_rel_repo_paths=(`ls -1d ${base_release_dir}/spack-installation/opt/spack/*linux*/gcc-*/*/*/integtest/*_test.py`) + # 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 -# add in the paths of the repositories in the local install and sourcecode dirs +# 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`) - sourcecode_dir_repo_paths=(`ls -1 ${DBT_AREA_ROOT}/sourcecode/*/integtest/*_test.py`) + 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[@]}") 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 +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`) for repo in "${repos_with_integtests[@]}"; do