Skip to content

Commit 192142b

Browse files
committed
Add tests of error handling on reading invalid goto binaries
1 parent 4322d61 commit 192142b

File tree

6 files changed

+37
-0
lines changed

6 files changed

+37
-0
lines changed

regression/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ add_subdirectory(test-script)
5656
add_subdirectory(goto-analyzer-taint)
5757
add_subdirectory(goto-bmc/goto-bmc-symex-ready-goto)
5858
add_subdirectory(goto-bmc/goto-bmc-non-symex-ready-goto)
59+
add_subdirectory(goto-bmc)
5960
if(NOT WIN32)
6061
add_subdirectory(goto-gcc)
6162
else()

regression/goto-bmc/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_test_pl_tests(
2+
"$<TARGET_FILE:goto-bmc>"
3+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
not-goto-no-header.goto
3+
4+
^EXIT=6$
5+
^SIGNAL=0$
6+
Please give exactly one binary file
7+
--
8+
not a goto binary
9+
Unable to read goto-binary from file not-goto-no-header\.goto
10+
--
11+
This test confirms that an appropriate error message is displayed in the case
12+
where a single input file is specified which does not pass the header check.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This is not a goto binary. A header would be required to pass the
2+
`is_goto_binary` check.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CORE
2+
not-goto-with-header.goto
3+
4+
^EXIT=2$
5+
^SIGNAL=0$
6+
Unable to read goto-binary from file not-goto-with-header\.goto
7+
--
8+
Please give exactly one binary file
9+
not a goto binary
10+
--
11+
This test confirms that an appropriate error message is displayed in the case
12+
where an input file is specified which passed the header check used to
13+
determine if the file is a goto binary or not, but which is not followed by
14+
data of a valid goto binary file. Note that the `is_goto_binary` check works
15+
based on checking if the first four bytes of the file are the byte 7F followed
16+
by the characters "GBF".
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
GBF
2+
This is not a valid goto binary. It does have a header which should pass the
3+
`is_goto_binary` check though.

0 commit comments

Comments
 (0)