From 409a0d1adb3206cf4ad8256526ebed377dfde202 Mon Sep 17 00:00:00 2001 From: Jussi Pekonen Date: Fri, 7 Aug 2020 11:24:10 +0300 Subject: [PATCH] bash: Move test generator file to a separate directory --- bash/CMakeLists.txt | 3 ++- bash/test/CMakeLists.txt | 6 +++--- bash/{test => tools}/generate-test-master.bash | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) rename bash/{test => tools}/generate-test-master.bash (69%) diff --git a/bash/CMakeLists.txt b/bash/CMakeLists.txt index 8c48d63..d122593 100644 --- a/bash/CMakeLists.txt +++ b/bash/CMakeLists.txt @@ -1,4 +1,5 @@ project(bib2web-bash) add_subdirectory(src) -add_subdirectory(test) \ No newline at end of file +add_subdirectory(tools) +add_subdirectory(test) diff --git a/bash/test/CMakeLists.txt b/bash/test/CMakeLists.txt index 28f9bd6..cb23d06 100644 --- a/bash/test/CMakeLists.txt +++ b/bash/test/CMakeLists.txt @@ -11,8 +11,8 @@ if(BIB2WEB_SHUNIT2_EXISTS) set(BASH_TEST_MASTER_FILE "${CMAKE_CURRENT_BINARY_DIR}/.bash-test.sh") add_custom_command( OUTPUT "${BASH_TEST_MASTER_FILE}" - COMMAND /bin/bash ARGS "${CMAKE_CURRENT_SOURCE_DIR}/generate-test-master.bash" "${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" "${BIB2WEB_SHUNIT2}" "${BASH_TEST_MASTER_FILE}" ${BASH_TEST_FILES} - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/generate-test-master.bash" "${BASH_TEST_FILES}") + COMMAND /bin/bash ARGS "${CMAKE_CURRENT_SOURCE_DIR}/../tools/generate-test-master.bash" "${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" "${BIB2WEB_SHUNIT2}" "${BASH_TEST_MASTER_FILE}" ${BASH_TEST_FILES} + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../tools/generate-test-master.bash" "${BASH_TEST_FILES}") add_custom_target(bash-test DEPENDS "${BASH_TEST_MASTER_FILE}") @@ -32,7 +32,7 @@ if(BIB2WEB_SHELLCHECK_EXISTS) add_custom_target(bash-test-lint) add_custom_command( TARGET bash-test-lint - COMMAND shellcheck ARGS "-x" "${CMAKE_CURRENT_SOURCE_DIR}/generate-test-master.bash" ${BASH_TEST_FILES} + COMMAND shellcheck ARGS "-x" ${BASH_TEST_FILES} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") # Set the version, just in case diff --git a/bash/test/generate-test-master.bash b/bash/tools/generate-test-master.bash similarity index 69% rename from bash/test/generate-test-master.bash rename to bash/tools/generate-test-master.bash index b6b6f84..8ca2b13 100644 --- a/bash/test/generate-test-master.bash +++ b/bash/tools/generate-test-master.bash @@ -15,7 +15,7 @@ shunit2File="$1" shift testFile="$1" shift -awkFile="${testDir}/test-gen.awk" +awkFile="${outDir}/.test-gen.awk" cat < "${awkFile}" /^#!.*/ { print \$0 @@ -31,7 +31,7 @@ END { EOF echo "#!/bin/bash" > "${testFile}" for file in "$@"; do - outputfile=$(basename "${file}") - awk -f "${awkFile}" "${testDir}/${file}" > "${outDir}/${outputfile}" - echo "/bin/bash ${outDir}/${outputfile}" >> "${testFile}" + filebase=$(basename "${file}") + awk -f "${awkFile}" "${testDir}/${filebase}" > "${outDir}/${filebase}" + echo "/bin/bash ${outDir}/${filebase}" >> "${testFile}" done