Skip to content

Commit b4a7f69

Browse files
committed
tests: fix csgrep/sync.sh with --filter-file tests
Related: 653f312 Resolves: #114
1 parent 8b908f7 commit b4a7f69

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

tests/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ set(jsfilter "sed -e 's|\"version\": \"[^\"]*\"|\"version\": \"\"|g'")
2929

3030
macro(add_test_wrap test_name cmd)
3131
add_test("${test_name}" bash -c "${cmd}")
32+
set_tests_properties(${test_name} PROPERTIES
33+
ENVIRONMENT "PROJECT_ROOT=${CMAKE_SOURCE_DIR}")
34+
3235
set_tests_properties(${test_name} PROPERTIES COST ${test_cost})
3336
math(EXPR test_cost "${test_cost} - 1")
3437
endmacro()
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--remove-duplicates --filter-file ../../../tests/csgrep/0076-filter-file-basic-filter.json
1+
--remove-duplicates --filter-file "$PROJECT_ROOT/tests/csgrep/0076-filter-file-basic-filter.json"
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--remove-duplicates --filter-file ../../../tests/csgrep/0077-filter-file-checker-regex-filter.json
1+
--remove-duplicates --filter-file "$PROJECT_ROOT/tests/csgrep/0077-filter-file-checker-regex-filter.json"

tests/csgrep/sync.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/zsh
22
set -exo pipefail
33

4+
# set path to project root
5+
PROJECT_ROOT="../../"
6+
47
# import ${JSFILTER_CMD}
58
. ../test-lib.sh
69

@@ -12,7 +15,7 @@ fi
1215

1316
for tst in "${tests[@]}"; do
1417
tst=${tst%-args.txt}
15-
eval "../../csdiff_build/src/csgrep $(<${tst}-args.txt) ${tst}-stdin.txt" \
18+
eval "$PROJECT_ROOT/csdiff_build/src/csgrep $(<${tst}-args.txt) ${tst}-stdin.txt" \
1619
| eval "${JSFILTER_CMD}" \
1720
> ${tst}-stdout.txt
1821
done

0 commit comments

Comments
 (0)