diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5ea6691e..e7e516fe 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,6 +29,9 @@ set(jsfilter "sed -e 's|\"version\": \"[^\"]*\"|\"version\": \"\"|g'") macro(add_test_wrap test_name cmd) add_test("${test_name}" bash -c "${cmd}") + set_tests_properties(${test_name} PROPERTIES + ENVIRONMENT "PROJECT_ROOT=${CMAKE_SOURCE_DIR}") + set_tests_properties(${test_name} PROPERTIES COST ${test_cost}) math(EXPR test_cost "${test_cost} - 1") endmacro() diff --git a/tests/csgrep/0076-filter-file-basic-args.txt b/tests/csgrep/0076-filter-file-basic-args.txt index 1aeb9ec6..c961e3f1 100644 --- a/tests/csgrep/0076-filter-file-basic-args.txt +++ b/tests/csgrep/0076-filter-file-basic-args.txt @@ -1 +1 @@ ---remove-duplicates --filter-file ../../../tests/csgrep/0076-filter-file-basic-filter.json +--remove-duplicates --filter-file "$PROJECT_ROOT/tests/csgrep/0076-filter-file-basic-filter.json" diff --git a/tests/csgrep/0077-filter-file-checker-regex-args.txt b/tests/csgrep/0077-filter-file-checker-regex-args.txt index 88a9489f..7d1866c1 100644 --- a/tests/csgrep/0077-filter-file-checker-regex-args.txt +++ b/tests/csgrep/0077-filter-file-checker-regex-args.txt @@ -1 +1 @@ ---remove-duplicates --filter-file ../../../tests/csgrep/0077-filter-file-checker-regex-filter.json +--remove-duplicates --filter-file "$PROJECT_ROOT/tests/csgrep/0077-filter-file-checker-regex-filter.json" diff --git a/tests/csgrep/sync.sh b/tests/csgrep/sync.sh index fd111d79..3b281683 100755 --- a/tests/csgrep/sync.sh +++ b/tests/csgrep/sync.sh @@ -1,6 +1,9 @@ #!/bin/zsh set -exo pipefail +# set path to project root +PROJECT_ROOT="../../" + # import ${JSFILTER_CMD} . ../test-lib.sh @@ -12,7 +15,7 @@ fi for tst in "${tests[@]}"; do tst=${tst%-args.txt} - eval "../../csdiff_build/src/csgrep $(<${tst}-args.txt) ${tst}-stdin.txt" \ + eval "$PROJECT_ROOT/csdiff_build/src/csgrep $(<${tst}-args.txt) ${tst}-stdin.txt" \ | eval "${JSFILTER_CMD}" \ > ${tst}-stdout.txt done