Skip to content

Commit

Permalink
do not copy config files to build directory (#745)
Browse files Browse the repository at this point in the history
Add the path to the config files in the sources instead.

Ref #743
  • Loading branch information
rjodinchr authored Nov 30, 2024
1 parent adba303 commit 8efb406
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
13 changes: 0 additions & 13 deletions tests/config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
22 changes: 12 additions & 10 deletions tests/config/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} <config_test-path> <config_files-path>"
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

0 comments on commit 8efb406

Please sign in to comment.