Skip to content

Add stub for new goto-harness tool [depends-on: #3920] #3875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ set_target_properties(
goto-checker
goto-diff
goto-diff-lib
goto-harness
goto-instrument
goto-instrument-lib
goto-programs
Expand Down
1 change: 1 addition & 0 deletions regression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ add_subdirectory(cbmc-cpp)
add_subdirectory(goto-cc-goto-analyzer)
add_subdirectory(systemc)
add_subdirectory(contracts)
add_subdirectory(goto-harness)
1 change: 1 addition & 0 deletions regression/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DIRS = cbmc \
test-script \
goto-analyzer-taint \
goto-gcc \
goto-harness \
goto-cl \
goto-cc-cbmc \
cbmc-cpp \
Expand Down
2 changes: 2 additions & 0 deletions regression/goto-harness/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_test_pl_tests(
"$<TARGET_FILE:goto-harness>")
21 changes: 21 additions & 0 deletions regression/goto-harness/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
default: tests.log

GOTO_HARNESS_EXE=../../../src/goto-harness/goto-harness

test:
@../test.pl -p -c ${GOTO_HARNESS_EXE}

tests.log: ../test.pl
@../test.pl -p -c ${GOTO_HARNESS_EXE}

show:
@for dir in *; do \
if [ -d "$$dir" ]; then \
vim -o "$$dir/*.c" "$$dir/*.out"; \
fi; \
done;

clean:
find -name '*.out' -execdir $(RM) '{}' \;
find -name '*.gb' -execdir $(RM) {} \;
$(RM) tests.log
6 changes: 6 additions & 0 deletions regression/goto-harness/goto-harness-exists/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CORE
dummy
--version
^\d+\.\d+ \([^)]+\)
^EXIT=0$
^SIGNAL=0$
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ add_subdirectory(goto-cc)
add_subdirectory(goto-instrument)
add_subdirectory(goto-analyzer)
add_subdirectory(goto-diff)
add_subdirectory(goto-harness)
4 changes: 4 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ DIRS = analyses \
goto-cc \
goto-checker \
goto-diff \
goto-harness \
goto-instrument \
goto-programs \
goto-symex \
Expand All @@ -27,6 +28,7 @@ all: cbmc.dir \
goto-cc.dir \
goto-diff.dir \
goto-instrument.dir \
goto-harness.dir \
# Empty last line

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

solvers.dir: util.dir

goto-harness.dir: util.dir

goto-instrument.dir: languages goto-programs.dir pointer-analysis.dir \
goto-symex.dir linking.dir analyses.dir solvers.dir

Expand Down
7 changes: 7 additions & 0 deletions src/goto-harness/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
file(GLOB_RECURSE sources "*.cpp" "*.h")
add_executable(goto-harness ${sources})
generic_includes(goto-harness)

target_link_libraries(goto-harness
util
)
29 changes: 29 additions & 0 deletions src/goto-harness/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
SRC = \
goto_harness_main.cpp \
goto_harness_parse_options.cpp \
# Empty last line

OBJ += \
../util/util$(LIBEXT) \
# Empty last line

INCLUDES= -I ..

LIBS =

CLEANFILES = goto-harness$(EXEEXT)

include ../config.inc
include ../common

all: goto-harness$(EXEEXT)

###############################################################################

goto-harness$(EXEEXT): $(OBJ)
$(LINKBIN)

.PHONY: goto-harness-mac-signed

goto-harness-mac-signed: goto-harness$(EXEEXT)
codesign -v -s $(OSX_IDENTITY) goto-harness$(EXEEXT)
15 changes: 15 additions & 0 deletions src/goto-harness/goto_harness_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/******************************************************************\

Module: goto_harness_main

Author: Diffblue Ltd.

\******************************************************************/

#include "goto_harness_parse_options.h"

int main(int argc, const char *argv[])
{
auto parse_options = goto_harness_parse_optionst(argc, argv);
return parse_options.main();
}
51 changes: 51 additions & 0 deletions src/goto-harness/goto_harness_parse_options.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/******************************************************************\

Module: goto_harness_parse_options

Author: Diffblue Ltd.

\******************************************************************/

#include <cstddef>
#include <iostream>
#include <string>

#include <util/exit_codes.h>
#include <util/version.h>

#include "goto_harness_parse_options.h"

int goto_harness_parse_optionst::doit()
{
if(cmdline.isset("version"))
{
std::cout << CBMC_VERSION << '\n';
return CPROVER_EXIT_SUCCESS;
}

help();
return CPROVER_EXIT_USAGE_ERROR;
}

void goto_harness_parse_optionst::help()
{
std::cout << '\n'
<< banner_string("Goto-Harness", CBMC_VERSION) << '\n'
<< align_center_with_border("Copyright (C) 2019") << '\n'
<< align_center_with_border("Diffblue Ltd.") << '\n'
<< align_center_with_border("[email protected]")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should likely have this align_center_with_border code for everyone...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// ^--- No idea if this is the right email address
<< '\n'
<< '\n'
<< "Usage: Purpose:\n"
<< '\n'
<< " goto-harness [-?] [-h] [--help] show help\n"
<< " goto-harness --version show version\n";
}

goto_harness_parse_optionst::goto_harness_parse_optionst(
int argc,
const char *argv[])
: parse_options_baset{GOTO_HARNESS_OPTIONS, argc, argv}
{
}
25 changes: 25 additions & 0 deletions src/goto-harness/goto_harness_parse_options.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/******************************************************************\

Module: goto_harness_parse_options

Author: Diffblue Ltd.

\******************************************************************/

#ifndef CPROVER_GOTO_HARNESS_GOTO_HARNESS_PARSE_OPTIONS_H
#define CPROVER_GOTO_HARNESS_GOTO_HARNESS_PARSE_OPTIONS_H

#include <util/parse_options.h>

#define GOTO_HARNESS_OPTIONS "(version)" // end GOTO_HARNESS_OPTIONS

class goto_harness_parse_optionst : public parse_options_baset
{
public:
int doit() override;
void help() override;

goto_harness_parse_optionst(int argc, const char *argv[]);
};

#endif // CPROVER_GOTO_HARNESS_GOTO_HARNESS_PARSE_OPTIONS_H
2 changes: 2 additions & 0 deletions src/goto-harness/module_dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
util
goto-harness