Skip to content

Commit

Permalink
tests: fix csgrep/sync.sh with --filter-file tests
Browse files Browse the repository at this point in the history
Related: 653f312
Resolves: #114
  • Loading branch information
lzaoral committed Mar 6, 2023
1 parent 8b908f7 commit b4a7f69
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/csgrep/0076-filter-file-basic-args.txt
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion tests/csgrep/0077-filter-file-checker-regex-args.txt
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 4 additions & 1 deletion tests/csgrep/sync.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/zsh
set -exo pipefail

# set path to project root
PROJECT_ROOT="../../"

# import ${JSFILTER_CMD}
. ../test-lib.sh

Expand All @@ -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

0 comments on commit b4a7f69

Please sign in to comment.