From d278fa0ab0c5801043966674346cd3856653bc12 Mon Sep 17 00:00:00 2001 From: Romaric Jodin Date: Tue, 26 Nov 2024 21:16:45 +0100 Subject: [PATCH] do not copy config files to build directory Add the path to the config files in the sources instead. Ref #743 --- .github/workflows/presubmit.yml | 2 +- tests/config/CMakeLists.txt | 13 ------------- tests/config/run_test.sh | 22 ++++++++++++---------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index a7b15028..7ded460c 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -218,7 +218,7 @@ jobs: - name: Config tests shell: bash if: ${{ matrix.unit }} - run: ./tests/config/run_test.sh ${{ env.testbindir }} + run: ./tests/config/run_test.sh '${{ env.testbindir }}' '${{ github.workspace }}'/tests/config - name: SHA-1 tests if: ${{ matrix.android-abi == '' }} run: ${{ env.testbindir }}/sha1_tests${{ env.exe-ext }} diff --git a/tests/config/CMakeLists.txt b/tests/config/CMakeLists.txt index 123e052d..71b4bc82 100644 --- a/tests/config/CMakeLists.txt +++ b/tests/config/CMakeLists.txt @@ -15,16 +15,3 @@ add_gtest_executable(config_test main.cpp ) - -# Use the configure_file command to copy during configuration stage -configure_file( - clvk.conf - ${CMAKE_BINARY_DIR}/clvk.conf # Destination, including subfolder - COPYONLY # Just copy, don't process as a template -) - -configure_file( - conf_test.conf - ${CMAKE_BINARY_DIR}/conf_test.conf - COPYONLY -) diff --git a/tests/config/run_test.sh b/tests/config/run_test.sh index e3866a3e..80864e3c 100755 --- a/tests/config/run_test.sh +++ b/tests/config/run_test.sh @@ -2,27 +2,29 @@ set -xe -if [ $# -eq 0 ]; then - echo "Error: Please append path to the test binary path as a command-line argument." +if [ $# -ne 2 ]; then + echo "ERROR: USAGE: ${0} " exit 1 fi -TEMP_DIR="$(mktemp -d)" -pushd "${TEMP_DIR}" +# Assign the base path from the argument +binary_path="$(realpath $1)" +config_files_path=$2 +# Make temporary directory +TEMP_DIR="$(mktemp -d)" function clean() { rm -r "${TEMP_DIR}" } trap clean EXIT -# Assign the base path from the argument -binary_path="$1" - -cp "${binary_path}/clvk.conf" "${TEMP_DIR}" +# Copy assets to temporary directory +cp "${config_files_path}/conf_test.conf" "${TEMP_DIR}" +cp "${config_files_path}/clvk.conf" "${TEMP_DIR}" # Run test -CLVK_CONFIG_FILE="${binary_path}/conf_test.conf" \ +pushd "${TEMP_DIR}" +CLVK_CONFIG_FILE="${TEMP_DIR}/conf_test.conf" \ CLVK_LOG_COLOUR=1 \ "${binary_path}/config_test" - popd