Skip to content

Commit d3d19f9

Browse files
Merge pull request #3875 from hannes-steffenhagen-diffblue/feature-goto_harness_stub
Add stub for new goto-harness tool [depends-on: #3920]
2 parents 8900b60 + 7a8d3a8 commit d3d19f9

14 files changed

+166
-0
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ set_target_properties(
9999
goto-checker
100100
goto-diff
101101
goto-diff-lib
102+
goto-harness
102103
goto-instrument
103104
goto-instrument-lib
104105
goto-programs

regression/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ add_subdirectory(cbmc-cpp)
4747
add_subdirectory(goto-cc-goto-analyzer)
4848
add_subdirectory(systemc)
4949
add_subdirectory(contracts)
50+
add_subdirectory(goto-harness)

regression/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ DIRS = cbmc \
1616
test-script \
1717
goto-analyzer-taint \
1818
goto-gcc \
19+
goto-harness \
1920
goto-cl \
2021
goto-cc-cbmc \
2122
cbmc-cpp \
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_test_pl_tests(
2+
"$<TARGET_FILE:goto-harness>")

regression/goto-harness/Makefile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
default: tests.log
2+
3+
GOTO_HARNESS_EXE=../../../src/goto-harness/goto-harness
4+
5+
test:
6+
@../test.pl -p -c ${GOTO_HARNESS_EXE}
7+
8+
tests.log: ../test.pl
9+
@../test.pl -p -c ${GOTO_HARNESS_EXE}
10+
11+
show:
12+
@for dir in *; do \
13+
if [ -d "$$dir" ]; then \
14+
vim -o "$$dir/*.c" "$$dir/*.out"; \
15+
fi; \
16+
done;
17+
18+
clean:
19+
find -name '*.out' -execdir $(RM) '{}' \;
20+
find -name '*.gb' -execdir $(RM) {} \;
21+
$(RM) tests.log
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
dummy
3+
--version
4+
^\d+\.\d+ \([^)]+\)
5+
^EXIT=0$
6+
^SIGNAL=0$

src/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,4 @@ add_subdirectory(goto-cc)
103103
add_subdirectory(goto-instrument)
104104
add_subdirectory(goto-analyzer)
105105
add_subdirectory(goto-diff)
106+
add_subdirectory(goto-harness)

src/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ DIRS = analyses \
88
goto-cc \
99
goto-checker \
1010
goto-diff \
11+
goto-harness \
1112
goto-instrument \
1213
goto-programs \
1314
goto-symex \
@@ -27,6 +28,7 @@ all: cbmc.dir \
2728
goto-cc.dir \
2829
goto-diff.dir \
2930
goto-instrument.dir \
31+
goto-harness.dir \
3032
# Empty last line
3133

3234
###############################################################################
@@ -47,6 +49,8 @@ languages: util.dir langapi.dir \
4749

4850
solvers.dir: util.dir
4951

52+
goto-harness.dir: util.dir
53+
5054
goto-instrument.dir: languages goto-programs.dir pointer-analysis.dir \
5155
goto-symex.dir linking.dir analyses.dir solvers.dir
5256

src/goto-harness/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
file(GLOB_RECURSE sources "*.cpp" "*.h")
2+
add_executable(goto-harness ${sources})
3+
generic_includes(goto-harness)
4+
5+
target_link_libraries(goto-harness
6+
util
7+
)

src/goto-harness/Makefile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
SRC = \
2+
goto_harness_main.cpp \
3+
goto_harness_parse_options.cpp \
4+
# Empty last line
5+
6+
OBJ += \
7+
../util/util$(LIBEXT) \
8+
# Empty last line
9+
10+
INCLUDES= -I ..
11+
12+
LIBS =
13+
14+
CLEANFILES = goto-harness$(EXEEXT)
15+
16+
include ../config.inc
17+
include ../common
18+
19+
all: goto-harness$(EXEEXT)
20+
21+
###############################################################################
22+
23+
goto-harness$(EXEEXT): $(OBJ)
24+
$(LINKBIN)
25+
26+
.PHONY: goto-harness-mac-signed
27+
28+
goto-harness-mac-signed: goto-harness$(EXEEXT)
29+
codesign -v -s $(OSX_IDENTITY) goto-harness$(EXEEXT)
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/******************************************************************\
2+
3+
Module: goto_harness_main
4+
5+
Author: Diffblue Ltd.
6+
7+
\******************************************************************/
8+
9+
#include "goto_harness_parse_options.h"
10+
11+
int main(int argc, const char *argv[])
12+
{
13+
auto parse_options = goto_harness_parse_optionst(argc, argv);
14+
return parse_options.main();
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/******************************************************************\
2+
3+
Module: goto_harness_parse_options
4+
5+
Author: Diffblue Ltd.
6+
7+
\******************************************************************/
8+
9+
#include <cstddef>
10+
#include <iostream>
11+
#include <string>
12+
13+
#include <util/exit_codes.h>
14+
#include <util/version.h>
15+
16+
#include "goto_harness_parse_options.h"
17+
18+
int goto_harness_parse_optionst::doit()
19+
{
20+
if(cmdline.isset("version"))
21+
{
22+
std::cout << CBMC_VERSION << '\n';
23+
return CPROVER_EXIT_SUCCESS;
24+
}
25+
26+
help();
27+
return CPROVER_EXIT_USAGE_ERROR;
28+
}
29+
30+
void goto_harness_parse_optionst::help()
31+
{
32+
std::cout << '\n'
33+
<< banner_string("Goto-Harness", CBMC_VERSION) << '\n'
34+
<< align_center_with_border("Copyright (C) 2019") << '\n'
35+
<< align_center_with_border("Diffblue Ltd.") << '\n'
36+
<< align_center_with_border("[email protected]")
37+
// ^--- No idea if this is the right email address
38+
<< '\n'
39+
<< '\n'
40+
<< "Usage: Purpose:\n"
41+
<< '\n'
42+
<< " goto-harness [-?] [-h] [--help] show help\n"
43+
<< " goto-harness --version show version\n";
44+
}
45+
46+
goto_harness_parse_optionst::goto_harness_parse_optionst(
47+
int argc,
48+
const char *argv[])
49+
: parse_options_baset{GOTO_HARNESS_OPTIONS, argc, argv}
50+
{
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/******************************************************************\
2+
3+
Module: goto_harness_parse_options
4+
5+
Author: Diffblue Ltd.
6+
7+
\******************************************************************/
8+
9+
#ifndef CPROVER_GOTO_HARNESS_GOTO_HARNESS_PARSE_OPTIONS_H
10+
#define CPROVER_GOTO_HARNESS_GOTO_HARNESS_PARSE_OPTIONS_H
11+
12+
#include <util/parse_options.h>
13+
14+
#define GOTO_HARNESS_OPTIONS "(version)" // end GOTO_HARNESS_OPTIONS
15+
16+
class goto_harness_parse_optionst : public parse_options_baset
17+
{
18+
public:
19+
int doit() override;
20+
void help() override;
21+
22+
goto_harness_parse_optionst(int argc, const char *argv[]);
23+
};
24+
25+
#endif // CPROVER_GOTO_HARNESS_GOTO_HARNESS_PARSE_OPTIONS_H
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
util
2+
goto-harness

0 commit comments

Comments
 (0)