Skip to content

Commit aa68f82

Browse files
committed
tests/cslinker: basic test coverage
1 parent d186d27 commit aa68f82

File tree

12 files changed

+30501
-0
lines changed

12 files changed

+30501
-0
lines changed

tests/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
set(csdiff "${CMAKE_BINARY_DIR}/src/csdiff")
2020
set(csgrep "${CMAKE_BINARY_DIR}/src/csgrep")
2121
set(cshtml "${CMAKE_BINARY_DIR}/src/cshtml")
22+
set(cslinker "${CMAKE_BINARY_DIR}/src/cslinker")
2223
set(cssort "${CMAKE_BINARY_DIR}/src/cssort")
2324
set(csjson "${csgrep} --mode=json")
2425
set(diffcmd "diff -up")
@@ -38,5 +39,6 @@ set(test_cost 1048576)
3839
add_subdirectory(csdiff)
3940
add_subdirectory(csgrep)
4041
add_subdirectory(cshtml)
42+
add_subdirectory(cslinker)
4143
add_subdirectory(cssort)
4244
add_subdirectory(cstrans-df-run)

tests/cslinker/0001-smoke/cwe-map.csv

Lines changed: 502 additions & 0 deletions
Large diffs are not rendered by default.

tests/cslinker/0001-smoke/runtest.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
set -e
3+
set -x
4+
5+
# FIXME: copy-pasted from ../../CMakeLists.txt
6+
export JSFILTER_CMD="sed -e ':a;N;\$!ba;s|:\\n *\\[|: [|g'"
7+
8+
# yet another conversion needed for scan properties on EPEL-7
9+
JSFILTER_CMD="${JSFILTER_CMD}';s|:\\n *{|: {|g'"
10+
11+
# run cshtml
12+
"${CSLINKER_BIN}" \
13+
--cwelist "${TEST_SRC_DIR}/cwe-map.csv" \
14+
--implist "${TEST_SRC_DIR}/scan-results-imp.js" \
15+
--inifile "${TEST_SRC_DIR}/scan.ini" \
16+
--reapply-parsing-rules \
17+
--quiet \
18+
"${TEST_SRC_DIR}/uni-results"/* \
19+
| eval "${JSFILTER_CMD}" \
20+
> scan-results.js
21+
22+
diff -up "${TEST_SRC_DIR}/scan-results.js" "${PWD}/scan-results.js"

0 commit comments

Comments
 (0)