diff --git a/.shellcheck_exclude_paths b/.shellcheck_exclude_paths index e84d523737..873e54f928 100644 --- a/.shellcheck_exclude_paths +++ b/.shellcheck_exclude_paths @@ -1,9 +1,3 @@ -scripts/ci/circle/postCDashStatus.sh -scripts/ci/circle/run.sh -scripts/ci/gh-actions/check-branch-name.sh -scripts/ci/gh-actions/get-changed-files.sh -scripts/ci/gh-actions/macos-setup.sh -scripts/ci/gh-actions/run.sh scripts/ci/scripts/github-prs-to-gitlab.sh scripts/ci/scripts/run-clang-format.sh scripts/ci/scripts/run-flake8.sh @@ -15,18 +9,3 @@ scripts/developer/setup.sh scripts/docker/setup-user.sh scripts/runconf/runconf.sh scripts/runconf/runconf_olcf.sh -testing/contract/lammps/build.sh -testing/contract/lammps/config.sh -testing/contract/lammps/install.sh -testing/contract/lammps/setup.sh -testing/contract/lammps/test.sh -testing/contract/scorpio/build.sh -testing/contract/scorpio/config.sh -testing/contract/scorpio/install.sh -testing/contract/scorpio/setup.sh -testing/contract/scorpio/test.sh -testing/contract/tau/build.sh -testing/contract/tau/config.sh -testing/contract/tau/install.sh -testing/contract/tau/setup.sh -testing/contract/tau/test.sh diff --git a/scripts/ci/circle/postCDashStatus.sh b/scripts/ci/circle/postCDashStatus.sh index 800b192d77..031ae912cc 100755 --- a/scripts/ci/circle/postCDashStatus.sh +++ b/scripts/ci/circle/postCDashStatus.sh @@ -4,7 +4,7 @@ USER=${STATUS_ROBOT_NAME} TOKEN=${STATUS_ROBOT_KEY} COMMIT=${CIRCLE_SHA1} CDASH_STATUS_CONTEXT="cdash" -SOURCE_DIR="$(readlink -f ${CIRCLE_WORKING_DIRECTORY}/source)" +SOURCE_DIR="$(readlink -f "${CIRCLE_WORKING_DIRECTORY}"/source)" build_status_body() { cat < /dev/null)" - if [ $? -eq 0 ] + RESULT="$(curl -s "${APIURL}" | python3 -c "import sys, json; print(json.load(sys.stdin)['head']['ref'])" 2> /dev/null)" + exit_status=$? + if [ "$exit_status" -eq 0 ] then REALBRANCH="$(echo "${RESULT}" | tr '/' '-')" fi @@ -70,8 +72,9 @@ echo "**********Env End************" echo "**********CTest Begin**********" ${CTEST} --version -echo ${CTEST} -VV -S ${CTEST_SCRIPT} -Ddashboard_full=OFF ${CTEST_STEP_ARGS} -${CTEST} -VV -S ${CTEST_SCRIPT} -Ddashboard_full=OFF ${CTEST_STEP_ARGS} +echo ${CTEST} -VV -S "${CTEST_SCRIPT}" -Ddashboard_full=OFF "${CTEST_STEP_ARGS}" +# shellcheck disable=SC2086 +${CTEST} -VV -S "${CTEST_SCRIPT}" -Ddashboard_full=OFF ${CTEST_STEP_ARGS} RET=$? echo "**********CTest End************" diff --git a/scripts/ci/gh-actions/check-branch-name.sh b/scripts/ci/gh-actions/check-branch-name.sh index 83bffd8e85..52d09e6cb0 100755 --- a/scripts/ci/gh-actions/check-branch-name.sh +++ b/scripts/ci/gh-actions/check-branch-name.sh @@ -4,7 +4,7 @@ if [ "${GITHUB_EVENT_NAME}" = "pull_request" ] then if [ -z "${BASE_REF}" ] then - BASE_REF="$(jq -r .pull_request.base.ref ${GITHUB_EVENT_PATH})" + BASE_REF="$(jq -r .pull_request.base.ref "${GITHUB_EVENT_PATH}")" fi echo "Base ref: ${BASE_REF}" echo "Head ref: ${GITHUB_HEAD_REF}" diff --git a/scripts/ci/gh-actions/get-changed-files.sh b/scripts/ci/gh-actions/get-changed-files.sh index 9e3ed8fa5b..5afcd19396 100755 --- a/scripts/ci/gh-actions/get-changed-files.sh +++ b/scripts/ci/gh-actions/get-changed-files.sh @@ -3,12 +3,12 @@ case "${GITHUB_EVENT_NAME}" in pull_request) - BASE_SHA=$(jq -r .pull_request.base.sha ${GITHUB_EVENT_PATH}) - HEAD_SHA=$(jq -r .pull_request.head.sha ${GITHUB_EVENT_PATH}) + BASE_SHA=$(jq -r .pull_request.base.sha "${GITHUB_EVENT_PATH}") + HEAD_SHA=$(jq -r .pull_request.head.sha "${GITHUB_EVENT_PATH}") ;; push) - BASE_SHA=$(jq -r .before ${GITHUB_EVENT_PATH}) - HEAD_SHA=$(jq -r .after ${GITHUB_EVENT_PATH}) + BASE_SHA=$(jq -r .before "${GITHUB_EVENT_PATH}") + HEAD_SHA=$(jq -r .after "${GITHUB_EVENT_PATH}") ;; *) echo "Unable to get changed files from '${GITHUB_EVENT_NAME}' event" @@ -20,11 +20,11 @@ echo "Base: ${BASE_SHA}" echo "Head: ${HEAD_SHA}" echo "" -git fetch origin ${BASE_SHA} +git fetch origin "${BASE_SHA}" echo "" echo "::group::All changed files" -git diff --name-only ${BASE_SHA}...${HEAD_SHA} | tee all-changed-files.txt +git diff --name-only "${BASE_SHA}"..."${HEAD_SHA}" | tee all-changed-files.txt echo "::group::Filtered changes" grep -v '^docs/' all-changed-files.txt | tee filtered-changed-files.txt diff --git a/scripts/ci/gh-actions/macos-setup.sh b/scripts/ci/gh-actions/macos-setup.sh index 8cae241e0e..0eb6850f20 100755 --- a/scripts/ci/gh-actions/macos-setup.sh +++ b/scripts/ci/gh-actions/macos-setup.sh @@ -8,13 +8,13 @@ then echo "Error: GH_YML_MATRIX_COMPILER variable is not defined" exit 1 fi -XCODE_VER="$(echo ${GH_YML_MATRIX_COMPILER} | sed -e 's|_|.|g' -e 's|xcode||')" -if [ ! -d /Applications/Xcode_${XCODE_VER}.app ] +XCODE_VER="$(echo "${GH_YML_MATRIX_COMPILER}" | sed -e 's|_|.|g' -e 's|xcode||')" +if [ ! -d "/Applications/Xcode_${XCODE_VER}.app" ] then echo "Error: XCode installation directory /Applications/Xcode_${XCODE_VER}.app does not exist" exit 2 fi -sudo xcode-select --switch /Applications/Xcode_${XCODE_VER}.app +sudo xcode-select --switch "/Applications/Xcode_${XCODE_VER}.app" echo "Installing CMake" @@ -36,7 +36,7 @@ brew install ninja echo "Installing GCC" brew install gcc -sudo ln -v -s $(which gfortran-11) /usr/local/bin/gfortran +sudo ln -v -s "$(which gfortran-11)" /usr/local/bin/gfortran echo "Installing blosc compression" brew install c-blosc diff --git a/scripts/ci/gh-actions/run.sh b/scripts/ci/gh-actions/run.sh index 5dcfcca7aa..c511730eea 100755 --- a/scripts/ci/gh-actions/run.sh +++ b/scripts/ci/gh-actions/run.sh @@ -100,19 +100,19 @@ export ADIOS2_IP=127.0.0.1 export OMP_NUM_THREADS=1 # Load any additional setup scripts -if [ -f gha/scripts/ci/setup-run/ci-${GH_YML_JOBNAME}.sh ] +if [ -f "gha/scripts/ci/setup-run/ci-${GH_YML_JOBNAME}.sh" ] then SETUP_RUN_SCRIPT=gha/scripts/ci/setup-run/ci-${GH_YML_JOBNAME}.sh -elif [ -f gha/scripts/ci/setup-run/ci-${GH_YML_MATRIX_OS}-${GH_YML_MATRIX_COMPILER}-${GH_YML_MATRIX_PARALLEL}.sh ] +elif [ -f "gha/scripts/ci/setup-run/ci-${GH_YML_MATRIX_OS}-${GH_YML_MATRIX_COMPILER}-${GH_YML_MATRIX_PARALLEL}.sh" ] then SETUP_RUN_SCRIPT=gha/scripts/ci/setup-run/ci-${GH_YML_MATRIX_OS}-${GH_YML_MATRIX_COMPILER}-${GH_YML_MATRIX_PARALLEL}.sh -elif [ -f gha/scripts/ci/setup-run/ci-${GH_YML_MATRIX_OS}-${GH_YML_MATRIX_COMPILER}.sh ] +elif [ -f "gha/scripts/ci/setup-run/ci-${GH_YML_MATRIX_OS}-${GH_YML_MATRIX_COMPILER}.sh" ] then SETUP_RUN_SCRIPT=gha/scripts/ci/setup-run/ci-${GH_YML_MATRIX_OS}-${GH_YML_MATRIX_COMPILER}.sh -elif [ -f gha/scripts/ci/setup-run/ci-${GH_YML_MATRIX_OS}.sh ] +elif [ -f "gha/scripts/ci/setup-run/ci-${GH_YML_MATRIX_OS}.sh" ] then SETUP_RUN_SCRIPT=gha/scripts/ci/setup-run/ci-${GH_YML_MATRIX_OS}.sh -elif [ -f gha/scripts/ci/setup-run/ci-${GH_YML_BASE_OS}.sh ] +elif [ -f "gha/scripts/ci/setup-run/ci-${GH_YML_BASE_OS}.sh" ] then SETUP_RUN_SCRIPT=gha/scripts/ci/setup-run/ci-${GH_YML_BASE_OS}.sh fi @@ -126,7 +126,8 @@ echo "::endgroup::" echo "::group::Job-run setup (if any)" if [ "${SETUP_RUN_SCRIPT:-UNSET}" != "UNSET" ] then - source ${SETUP_RUN_SCRIPT} + # shellcheck source=/dev/null + source "${SETUP_RUN_SCRIPT}" fi echo "::endgroup::" @@ -139,7 +140,8 @@ echo "::group::CTest version" echo "::endgroup::" echo "::group::Execute job step" -"${CTEST}" -VV -S ${CTEST_SCRIPT} -Ddashboard_full=OFF ${CTEST_STEP_ARGS} +# shellcheck disable=SC2086 +"${CTEST}" -VV -S "${CTEST_SCRIPT}" -Ddashboard_full=OFF ${CTEST_STEP_ARGS} RET=$? echo "::endgroup::" diff --git a/testing/contract/lammps/build.sh b/testing/contract/lammps/build.sh index 0290ec8f3d..436861e621 100755 --- a/testing/contract/lammps/build.sh +++ b/testing/contract/lammps/build.sh @@ -3,6 +3,10 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -cmake --build ${build_dir} -j8 +# Fail if is not set +build_dir="${build_dir:?}" + +cmake --build "${build_dir}" -j8 diff --git a/testing/contract/lammps/config.sh b/testing/contract/lammps/config.sh index 14837d843a..256306608d 100755 --- a/testing/contract/lammps/config.sh +++ b/testing/contract/lammps/config.sh @@ -3,17 +3,23 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -mkdir -p ${build_dir} -cd ${build_dir} +# Fail if is not set +source_dir="${source_dir:?}" +build_dir="${build_dir:?}" +install_dir="${install_dir:?}" + +mkdir -p "${build_dir}" +cd "${build_dir}" cmake \ - -DCMAKE_INSTALL_PREFIX=${install_dir} \ + -DCMAKE_INSTALL_PREFIX="${install_dir}" \ -DBUILD_MPI=yes \ -DBUILD_EXE=yes \ -DBUILD_LIB=no \ -DBUILD_DOC=no \ -DLAMMPS_SIZES=smallbig \ -DPKG_ADIOS=yes \ - ${source_dir}/cmake + "${source_dir}/cmake" diff --git a/testing/contract/lammps/install.sh b/testing/contract/lammps/install.sh index f319d25356..26b65c1592 100755 --- a/testing/contract/lammps/install.sh +++ b/testing/contract/lammps/install.sh @@ -3,6 +3,10 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -cmake --install ${build_dir} +# Fail if is not set +build_dir="${build_dir:?}" + +cmake --install "${build_dir}" diff --git a/testing/contract/lammps/setup.sh b/testing/contract/lammps/setup.sh index ca74ccf68a..00a4a7f1d5 100755 --- a/testing/contract/lammps/setup.sh +++ b/testing/contract/lammps/setup.sh @@ -1,7 +1,14 @@ -source_dir=$(readlink -f ${PWD})/source -build_dir=$(readlink -f ${PWD})/build -install_dir=$(readlink -f ${PWD})/install -test_dir=$(readlink -f ${PWD})/test +#!/bin/bash + +source_dir=$(readlink -f "${PWD}")/source +build_dir=$(readlink -f "${PWD}")/build +install_dir=$(readlink -f "${PWD}")/install +test_dir=$(readlink -f "${PWD}")/test + +export source_dir +export build_dir +export install_dir +export test_dir echo "source_dir = \"${source_dir}\"" echo "build_dir = \"${build_dir}\"" diff --git a/testing/contract/lammps/test.sh b/testing/contract/lammps/test.sh index 2c378c1fda..28a0486b34 100755 --- a/testing/contract/lammps/test.sh +++ b/testing/contract/lammps/test.sh @@ -3,13 +3,18 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -mkdir -p ${test_dir} -cd ${test_dir} +# Fail if is not set +install_dir="${install_dir:?}" +test_dir="${test_dir:?}" + +mkdir -p "${test_dir}" +cd "${test_dir}" cp -v /opt/adios2/source/testing/contract/lammps/{adios2_config.xml,check_results.sh,in.test} . -mpiexec -np 4 --oversubscribe ${install_dir}/bin/lmp -in in.test +mpiexec -np 4 --oversubscribe "${install_dir}/bin/lmp" -in in.test ./check_results.sh diff --git a/testing/contract/scorpio/build.sh b/testing/contract/scorpio/build.sh index 0290ec8f3d..436861e621 100755 --- a/testing/contract/scorpio/build.sh +++ b/testing/contract/scorpio/build.sh @@ -3,6 +3,10 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -cmake --build ${build_dir} -j8 +# Fail if is not set +build_dir="${build_dir:?}" + +cmake --build "${build_dir}" -j8 diff --git a/testing/contract/scorpio/config.sh b/testing/contract/scorpio/config.sh index bb88cc834c..9ff170bd49 100755 --- a/testing/contract/scorpio/config.sh +++ b/testing/contract/scorpio/config.sh @@ -3,22 +3,28 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -mkdir -p ${build_dir} -cd ${build_dir} +# Fail if is not set +source_dir="${source_dir:?}" +build_dir="${build_dir:?}" +install_dir="${install_dir:?}" + +mkdir -p "${build_dir}" +cd "${build_dir}" export CC=mpicc export CXX=mpic++ export FC=mpifort cmake \ - -DCMAKE_INSTALL_PREFIX=${install_dir} \ + -DCMAKE_INSTALL_PREFIX="${install_dir}" \ -DFPHSA_NAME_MISMATCHED=ON \ -DPIO_ENABLE_TESTS=ON \ -DPIO_ENABLE_EXAMPLES=ON \ -DWITH_NETCDF=OFF \ -DWITH_PNETCDF=ON \ - -DPnetCDF_PATH=$(spack location -i parallel-netcdf) \ + -DPnetCDF_PATH="$(spack location -i parallel-netcdf)" \ -DWITH_ADIOS2=ON \ - ${source_dir} + "${source_dir}" diff --git a/testing/contract/scorpio/install.sh b/testing/contract/scorpio/install.sh index f319d25356..26b65c1592 100755 --- a/testing/contract/scorpio/install.sh +++ b/testing/contract/scorpio/install.sh @@ -3,6 +3,10 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -cmake --install ${build_dir} +# Fail if is not set +build_dir="${build_dir:?}" + +cmake --install "${build_dir}" diff --git a/testing/contract/scorpio/setup.sh b/testing/contract/scorpio/setup.sh index 08fbcaa5e2..1e32491be1 100755 --- a/testing/contract/scorpio/setup.sh +++ b/testing/contract/scorpio/setup.sh @@ -1,7 +1,14 @@ -source_dir=$(readlink -f ${PWD})/source -build_dir=$(readlink -f ${PWD})/build -install_dir=$(readlink -f ${PWD})/install -test_dir=$(readlink -f ${PWD})/test +#!/bin/bash + +source_dir=$(readlink -f "${PWD}")/source +build_dir=$(readlink -f "${PWD}")/build +install_dir=$(readlink -f "${PWD}")/install +test_dir=$(readlink -f "${PWD}")/test + +export source_dir +export build_dir +export install_dir +export test_dir echo "source_dir = \"${source_dir}\"" echo "build_dir = \"${build_dir}\"" diff --git a/testing/contract/scorpio/test.sh b/testing/contract/scorpio/test.sh index 0249fa7d5f..94b4fca85d 100755 --- a/testing/contract/scorpio/test.sh +++ b/testing/contract/scorpio/test.sh @@ -3,12 +3,17 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -mkdir -p ${test_dir} -cd ${test_dir} +# Fail if is not set +build_dir="${build_dir:?}" +test_dir="${test_dir:?}" -mpiexec --oversubscribe -np 4 ${build_dir}/examples/adios/example3 -v +mkdir -p "${test_dir}" +cd "${test_dir}" + +mpiexec --oversubscribe -np 4 "${build_dir}/examples/adios/example3" -v bpls -d example3_1.nc.bp.dir/example3_1.nc.bp.0 > 0.dump diff -u 0.dump /opt/adios2/source/testing/contract/scorpio/0.dump diff --git a/testing/contract/tau/build.sh b/testing/contract/tau/build.sh index 0290ec8f3d..436861e621 100755 --- a/testing/contract/tau/build.sh +++ b/testing/contract/tau/build.sh @@ -3,6 +3,10 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -cmake --build ${build_dir} -j8 +# Fail if is not set +build_dir="${build_dir:?}" + +cmake --build "${build_dir}" -j8 diff --git a/testing/contract/tau/config.sh b/testing/contract/tau/config.sh index a89b2deece..0fd803a1a6 100755 --- a/testing/contract/tau/config.sh +++ b/testing/contract/tau/config.sh @@ -3,11 +3,15 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -mkdir -p ${build_dir} -cd ${build_dir} +# Fail if is not set +source_dir="${source_dir:?}" +build_dir="${build_dir:?}" +install_dir="${install_dir:?}" -cmake \ - -DCMAKE_INSTALL_PREFIX=${install_dir} \ - ${source_dir} +mkdir -p "${build_dir}" +cd "${build_dir}" + +cmake -DCMAKE_INSTALL_PREFIX="${install_dir}" "${source_dir}" diff --git a/testing/contract/tau/install.sh b/testing/contract/tau/install.sh index f319d25356..26b65c1592 100755 --- a/testing/contract/tau/install.sh +++ b/testing/contract/tau/install.sh @@ -3,6 +3,10 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -cmake --install ${build_dir} +# Fail if is not set +build_dir="${build_dir:?}" + +cmake --install "${build_dir}" diff --git a/testing/contract/tau/setup.sh b/testing/contract/tau/setup.sh index d79a4d9ee9..a9e1aff92d 100755 --- a/testing/contract/tau/setup.sh +++ b/testing/contract/tau/setup.sh @@ -1,7 +1,14 @@ +#!/bin/bash + source_dir="/opt/adios2/source/examples/basics/variablesShapes" -build_dir=$(readlink -f ${PWD})/build -install_dir=$(readlink -f ${PWD})/install -test_dir=$(readlink -f ${PWD})/test +build_dir=$(readlink -f "${PWD}")/build +install_dir=$(readlink -f "${PWD}")/install +test_dir=$(readlink -f "${PWD}")/test + +export source_dir +export build_dir +export install_dir +export test_dir echo "source_dir = \"${source_dir}\"" echo "build_dir = \"${build_dir}\"" diff --git a/testing/contract/tau/test.sh b/testing/contract/tau/test.sh index a696145de3..47ac7b1769 100755 --- a/testing/contract/tau/test.sh +++ b/testing/contract/tau/test.sh @@ -3,14 +3,19 @@ set -x set -e -source $(dirname $(readlink -f ${BASH_SOURCE}))/setup.sh +# shellcheck disable=SC1091 +source "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/setup.sh" -mkdir -p ${test_dir} -cd ${test_dir} +# Fail if is not set +install_dir="${install_dir:?}" +test_dir="${test_dir:?}" + +mkdir -p "${test_dir}" +cd "${test_dir}" TAU=$(spack location -i tau)/bin/tau_exec -mpiexec -np 2 ${TAU} ${install_dir}/bin/adios2_basics_variablesShapes +mpiexec -np 2 "${TAU}" "${install_dir}/bin/adios2_basics_variablesShapes" [ ! -f profile.0.0.0 ] || [ ! -s profile.0.0.0 ] && { echo "Error: file profile.0.0.0 not found or empty"; exit 1; } [ ! -f profile.1.0.0 ] || [ ! -s profile.1.0.0 ] && { echo "Error: file profile.1.0.0 not found or empty"; exit 1; }