From fc1a2fc13c450697dc4196a6bd09fd3db00dcf3e Mon Sep 17 00:00:00 2001 From: larsevj Date: Wed, 2 Oct 2024 10:19:25 +0200 Subject: [PATCH 1/2] Fix wrong variable name in testkomodo.sh --- ci/testkomodo.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ci/testkomodo.sh b/ci/testkomodo.sh index 2a551fbea29..a7192570ad9 100755 --- a/ci/testkomodo.sh +++ b/ci/testkomodo.sh @@ -1,14 +1,14 @@ copy_test_files () { - cp -r ${CI_SOURCE_ROOT}/tests ${CI_TEST_ROOT} - ln -s ${CI_SOURCE_ROOT}/test-data ${CI_TEST_ROOT}/test-data + cp -r "${CI_SOURCE_ROOT}"/tests "${CI_TEST_ROOT}" + ln -s "${CI_SOURCE_ROOT}"/test-data "${CI_TEST_ROOT}"/test-data - ln -s ${CI_SOURCE_ROOT}/src ${CI_TEST_ROOT}/src + ln -s "${CI_SOURCE_ROOT}"/src "${CI_TEST_ROOT}"/src # Trick ERT to find a fake source root - mkdir ${CI_TEST_ROOT}/.git + mkdir "${CI_TEST_ROOT}"/.git # Keep pytest configuration: - ln -s ${CI_SOURCE_ROOT}/pyproject.toml ${CI_TEST_ROOT}/pyproject.toml + ln -s "${CI_SOURCE_ROOT}"/pyproject.toml "${CI_TEST_ROOT}"/pyproject.toml } install_test_dependencies () { @@ -38,40 +38,40 @@ start_tests () { export ECL_SKIP_SIGNAL=ON - pushd ${CI_TEST_ROOT}/tests/ert + pushd "${CI_TEST_ROOT}"/tests/ert set +e pytest --eclipse-simulator -n logical --show-capture=stderr -v --max-worker-restart 0 \ -m "not limit_memory and not requires_window_manager" --benchmark-disable --dist loadgroup - retun_code_0=$? + return_code_0=$? pytest --eclipse-simulator -v --mpl \ -m "not limit_memory and requires_window_manager" --benchmark-disable - retun_code_1=$? + return_code_1=$? # Restricting the number of threads utilized by numpy to control memory consumption, as some tests evaluate memory usage and additional threads increase it. export OMP_NUM_THREADS=1 pytest -n 2 --durations=0 -m "limit_memory" --memray - retun_code_2=$? + return_code_2=$? unset OMP_NUM_THREADS - basetemp=$(mktemp -d -p $_ERT_TESTS_SHARED_TMP) - pytest --timeout=3600 -v --$_ERT_TESTS_QUEUE_SYSTEM --basetemp="$basetemp" unit_tests/scheduler - retun_code_3=$? + basetemp=$(mktemp -d -p "$_ERT_TESTS_SHARED_TMP") + pytest --timeout=3600 -v --"$_ERT_TESTS_QUEUE_SYSTEM" --basetemp="$basetemp" unit_tests/scheduler + return_code_3=$? rm -rf "$basetemp" || true popd run_ert_with_opm - retun_code_4=$? + return_code_4=$? set -e # We error if one or more returncodes are nonzero for code in $return_code_0 $return_code_1 $return_code_2 $return_code_3 $return_code_4; do - if [ $code -ne 0 ]; then + if [ "$code" -ne 0 ]; then echo "One or more tests failed." return 1 fi From 8ae6597faa3a4961721f8dfa556859858340e207 Mon Sep 17 00:00:00 2001 From: larsevj Date: Wed, 2 Oct 2024 10:19:51 +0200 Subject: [PATCH 2/2] Shellcheck testkomodo.sh in github workflow --- .github/workflows/actionlint.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 2a95b3f9fe5..596c9b11269 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -15,7 +15,15 @@ jobs: - name: Download actionlint id: get_actionlint run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + - name: Download shellcheck + id: get_shellcheck + run: | + sudo apt-get update + sudo apt-get install shellcheck shell: bash - name: Check workflow files run: ${{ steps.get_actionlint.outputs.executable }} -color shell: bash + - name: Check testkomodo.sh + run: shellcheck -s bash ci/testkomodo.sh + shell: bash