Skip to content

Commit ac8c34a

Browse files
committed
Add regression tests for new goto-inspect binary
1 parent 271fc32 commit ac8c34a

File tree

6 files changed

+63
-0
lines changed

6 files changed

+63
-0
lines changed

regression/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ add_subdirectory(goto-instrument-chc)
4646
add_subdirectory(goto-instrument-json)
4747
add_subdirectory(goto-instrument-wmm-core)
4848
add_subdirectory(goto-instrument-typedef)
49+
add_subdirectory(goto-inspect)
4950
add_subdirectory(smt2_solver)
5051
add_subdirectory(smt2_strings)
5152
add_subdirectory(strings)
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_test_pl_tests(
2+
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:goto-cc> $<TARGET_FILE:goto-inspect>"
3+
)

regression/goto-inspect/chain.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# A test instruction passed to this `chain.sh` file looks like this:
6+
#
7+
# build/bin/goto-cc build/bin/goto-inspect --show-goto-functions main.c
8+
#
9+
# This allows us to safely assume for now (as long as we're operating
10+
# goto-inspect with one binary and one inspection option, which seems
11+
# to be the case for now) that the option is going to be at $3.
12+
# If this is no longer the case in the future, this script will need
13+
# to be made significantly more sophisticated in terms of handling
14+
# a variable number of options for the goto-inspect binary.
15+
16+
echo $@
17+
18+
goto_cc_exe=$1
19+
goto_inspect_exe=$2
20+
21+
name=${*:$#}
22+
name=${name%.c}
23+
24+
$goto_cc_exe -o "${name}.gb" "${name}.c"
25+
$goto_inspect_exe $3 "${name}.gb"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
int main(int argc, char *argv[])
2+
{
3+
int arr[] = {0, 1, 2, 3, 4};
4+
__CPROVER_assert(arr[0] != 0, "Expected failure: 0 == 0");
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
CORE
2+
main.c
3+
" "
4+
^EXIT=6$
5+
^SIGNAL=0$
6+
--
7+
DECL main::1::arr : signedbv\[32\]\[5\]
8+
ASSIGN main::1::arr := \{ 0, 1, 2, 3, 4 \}
9+
ASSERT main::1::arr\[cast\(0, signedbv\[64\]\)\] ≠ 0 // Expected failure: 0 == 0
10+
DEAD main::1::arr
11+
SET RETURN VALUE side_effect statement="nondet" is_nondet_nullable="1"
12+
END_FUNCTION
13+
--
14+
This is testing the behaviour of the goto-inspect binary in case a binary
15+
is present, but no inspection option is present.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CORE
2+
main.c
3+
--show-goto-functions
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
main
7+
DECL main::1::arr : signedbv\[32\]\[5\]
8+
ASSIGN main::1::arr := \{ 0, 1, 2, 3, 4 \}
9+
ASSERT main::1::arr\[cast\(0, signedbv\[64\]\)\] ≠ 0 // Expected failure: 0 == 0
10+
DEAD main::1::arr
11+
SET RETURN VALUE side_effect statement="nondet" is_nondet_nullable="1"
12+
END_FUNCTION
13+
--
14+
--

0 commit comments

Comments
 (0)