Skip to content

split test suite generation out of cbmc/jbmc #2144

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

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ src/memory-models/mm_y.tab.h
# binaries
src/cbmc/cbmc
src/cbmc/cbmc.exe
src/ccover/ccover
src/ccover/ccover.exe
src/goto-analyzer/goto-analyzer
src/goto-analyzer/goto-analyzer.exe
src/goto-cc/goto-cc
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ set_target_properties(
big-int
cbmc
cbmc-lib
ccover
ccover-lib
cpp
driver
goto-analyzer
Expand Down
1 change: 0 additions & 1 deletion jbmc/src/jbmc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ OBJ += ../$(CPROVER_DIR)/src/ansi-c/ansi-c$(LIBEXT) \
../$(CPROVER_DIR)/src/json/json$(LIBEXT) \
../$(CPROVER_DIR)/src/cbmc/all_properties$(OBJEXT) \
../$(CPROVER_DIR)/src/cbmc/bmc$(OBJEXT) \
../$(CPROVER_DIR)/src/cbmc/bmc_cover$(OBJEXT) \
../$(CPROVER_DIR)/src/cbmc/bv_cbmc$(OBJEXT) \
../$(CPROVER_DIR)/src/cbmc/cbmc_dimacs$(OBJEXT) \
../$(CPROVER_DIR)/src/cbmc/cbmc_solvers$(OBJEXT) \
Expand Down
27 changes: 5 additions & 22 deletions jbmc/src/jbmc/jbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
if(cmdline.isset("show-vcc"))
options.set_option("show-vcc", true);

if(cmdline.isset("cover"))
parse_cover_options(cmdline, options);

if(cmdline.isset("nondet-static"))
options.set_option("nondet-static", true);

Expand Down Expand Up @@ -189,14 +186,9 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
options.set_option("assumptions", false);

// generate unwinding assertions
if(cmdline.isset("cover"))
options.set_option("unwinding-assertions", false);
else
{
options.set_option(
"unwinding-assertions",
cmdline.isset("unwinding-assertions"));
}
options.set_option(
"unwinding-assertions",
cmdline.isset("unwinding-assertions"));

// generate unwinding assumptions otherwise
options.set_option(
Expand Down Expand Up @@ -916,17 +908,9 @@ bool jbmc_parse_optionst::process_goto_functions(
remove_unused_functions(goto_model, get_message_handler());
}

// remove skips such that trivial GOTOs are deleted and not considered
// for coverage annotation:
// remove skips such that trivial GOTOs are deleted
remove_skip(goto_model);

// instrument cover goals
if(cmdline.isset("cover"))
{
if(instrument_cover_goals(options, goto_model, get_message_handler()))
return true;
}

// label the assertions
// This must be done after adding assertions and
// before using the argument of the "property" option.
Expand Down Expand Up @@ -970,7 +954,7 @@ bool jbmc_parse_optionst::process_goto_functions(
full_slicer(goto_model);
}

// remove any skips introduced since coverage instrumentation
// remove any skips
remove_skip(goto_model);
}

Expand Down Expand Up @@ -1079,7 +1063,6 @@ void jbmc_parse_optionst::help()
" --no-assertions ignore user assertions\n"
" --no-assumptions ignore user assumptions\n"
" --error-label label check that label is unreachable\n"
" --cover CC create test-suite with coverage criterion CC\n" // NOLINT(*)
" --mm MM memory consistency model for concurrent programs\n" // NOLINT(*)
HELP_REACHABILITY_SLICER
" --full-slice run full slicer (experimental)\n" // NOLINT(*)
Expand Down
4 changes: 2 additions & 2 deletions regression/cbmc-cover/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
default: tests.log

test:
@../test.pl -p -c ../../../src/cbmc/cbmc
@../test.pl -p -c ../../../src/ccover/ccover

tests.log: ../test.pl
@../test.pl -p -c ../../../src/cbmc/cbmc
@../test.pl -p -c ../../../src/ccover/ccover

show:
@for dir in *; do \
Expand Down
19 changes: 19 additions & 0 deletions regression/ccover/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
default: tests.log

test:
@../test.pl -p -c ../../../src/ccover/ccover -X smt-backend

tests.log: ../test.pl
@../test.pl -p -c ../../../src/ccover/ccover -X smt-backend

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
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ add_subdirectory(util)
add_subdirectory(xmllang)

add_subdirectory(cbmc)
add_subdirectory(ccover)
add_subdirectory(goto-cc)
add_subdirectory(goto-instrument)
add_subdirectory(goto-analyzer)
Expand Down
4 changes: 4 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ DIRS = analyses \
assembler \
big-int \
cbmc \
ccover \
cpp \
goto-analyzer \
goto-cc \
Expand All @@ -21,6 +22,7 @@ DIRS = analyses \
# Empty last line

all: cbmc.dir \
ccover.dir \
goto-analyzer.dir \
goto-cc.dir \
goto-diff.dir \
Expand Down Expand Up @@ -53,6 +55,8 @@ cbmc.dir: languages solvers.dir goto-symex.dir analyses.dir \
pointer-analysis.dir goto-programs.dir linking.dir \
goto-instrument.dir

ccover.dir: cbmc.dir

goto-analyzer.dir: languages analyses.dir goto-programs.dir linking.dir \
json.dir goto-instrument.dir

Expand Down
1 change: 0 additions & 1 deletion src/cbmc/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
SRC = all_properties.cpp \
bmc.cpp \
bmc_cover.cpp \
Copy link
Collaborator

Choose a reason for hiding this comment

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

This has already been moved in the previous commit, hence the prior commit yields an inconsistent state.

bv_cbmc.cpp \
cbmc_dimacs.cpp \
cbmc_languages.cpp \
Expand Down
6 changes: 0 additions & 6 deletions src/cbmc/bmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,6 @@ safety_checkert::resultt bmct::execute(
return safety_checkert::resultt::SAFE; // to indicate non-error
}

if(!options.get_list_option("cover").empty())
{
return cover(goto_functions)?
safety_checkert::resultt::ERROR:safety_checkert::resultt::SAFE;
}

if(options.get_option("localize-faults")!="")
{
fault_localizationt fault_localization(
Expand Down
5 changes: 0 additions & 5 deletions src/cbmc/bmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,7 @@ class bmct:public safety_checkert
void slice();
void show();

bool cover(const goto_functionst &goto_functions);

friend class bmc_all_propertiest;
friend class bmc_covert;
template <template <class goalt> class covert>
friend class bmc_goal_covert;
friend class fault_localizationt;

private:
Expand Down
14 changes: 1 addition & 13 deletions src/cbmc/cbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Author: Daniel Kroening, kroening@kroening.com
#include <goto-instrument/reachability_slicer.h>
#include <goto-instrument/full_slicer.h>
#include <goto-instrument/nondet_static.h>
#include <goto-instrument/cover.h>

#include <pointer-analysis/add_failed_symbols.h>

Expand Down Expand Up @@ -151,9 +150,6 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
if(cmdline.isset("show-vcc"))
options.set_option("show-vcc", true);

if(cmdline.isset("cover"))
parse_cover_options(cmdline, options);

if(cmdline.isset("mm"))
options.set_option("mm", cmdline.get_value("mm"));

Expand Down Expand Up @@ -786,13 +782,6 @@ bool cbmc_parse_optionst::process_goto_program(
// for coverage annotation:
remove_skip(goto_model);

// instrument cover goals
if(options.is_set("cover"))
{
if(instrument_cover_goals(options, goto_model, log.get_message_handler()))
return true;
}

// label the assertions
// This must be done after adding assertions and
// before using the argument of the "property" option.
Expand Down Expand Up @@ -831,7 +820,7 @@ bool cbmc_parse_optionst::process_goto_program(
full_slicer(goto_model);
}

// remove any skips introduced since coverage instrumentation
// remove any skips
remove_skip(goto_model);
}

Expand Down Expand Up @@ -937,7 +926,6 @@ void cbmc_parse_optionst::help()
" --no-assertions ignore user assertions\n"
" --no-assumptions ignore user assumptions\n"
" --error-label label check that label is unreachable\n"
" --cover CC create test-suite with coverage criterion CC\n" // NOLINT(*)
" --mm MM memory consistency model for concurrent programs\n" // NOLINT(*)
HELP_REACHABILITY_SLICER
" --full-slice run full slicer (experimental)\n" // NOLINT(*)
Expand Down
2 changes: 1 addition & 1 deletion src/cbmc/cbmc_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class optionst;
"(error-label):(verbosity):(no-library)" \
"(nondet-static)" \
"(version)" \
"(cover):(symex-coverage-report):" \
"(symex-coverage-report):" \
"(mm):" \
OPT_TIMESTAMP \
"(i386-linux)(i386-macos)(i386-win32)(win32)(winx64)(gcc)" \
Expand Down
35 changes: 35 additions & 0 deletions src/ccover/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Library
file(GLOB_RECURSE sources "*.cpp" "*.h")
list(REMOVE_ITEM sources
${CMAKE_CURRENT_SOURCE_DIR}/ccover_main.cpp
)
add_library(ccover-lib ${sources})

generic_includes(ccover-lib)

target_link_libraries(ccover-lib
analyses
ansi-c
assembler
big-int
cbmc-lib
cpp
goto-instrument-lib
goto-programs
goto-symex
java_bytecode
json
langapi
linking
pointer-analysis
solvers
util
xml
)

add_if_library(ccover-lib bv_refinement)
add_if_library(ccover-lib jsil)

# Executable
add_executable(ccover ccover_main.cpp)
target_link_libraries(ccover ccover-lib)
76 changes: 76 additions & 0 deletions src/ccover/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
SRC = ccover_bmc.cpp \
bmc_cover.cpp \
ccover_main.cpp \
ccover_parse_options.cpp \
# Empty last line

OBJ += ../ansi-c/ansi-c$(LIBEXT) \
../cpp/cpp$(LIBEXT) \
../linking/linking$(LIBEXT) \
../big-int/big-int$(LIBEXT) \
../goto-programs/goto-programs$(LIBEXT) \
../goto-symex/goto-symex$(LIBEXT) \
../pointer-analysis/value_set$(OBJEXT) \
../pointer-analysis/value_set_analysis_fi$(OBJEXT) \
../pointer-analysis/value_set_domain_fi$(OBJEXT) \
../pointer-analysis/value_set_fi$(OBJEXT) \
../pointer-analysis/value_set_dereference$(OBJEXT) \
../pointer-analysis/dereference_callback$(OBJEXT) \
../pointer-analysis/add_failed_symbols$(OBJEXT) \
../pointer-analysis/rewrite_index$(OBJEXT) \
../pointer-analysis/goto_program_dereference$(OBJEXT) \
../goto-instrument/full_slicer$(OBJEXT) \
../goto-instrument/nondet_static$(OBJEXT) \
../goto-instrument/cover$(OBJEXT) \
../goto-instrument/cover_basic_blocks$(OBJEXT) \
../goto-instrument/cover_filter$(OBJEXT) \
../goto-instrument/cover_instrument_branch$(OBJEXT) \
../goto-instrument/cover_instrument_condition$(OBJEXT) \
../goto-instrument/cover_instrument_decision$(OBJEXT) \
../goto-instrument/cover_instrument_location$(OBJEXT) \
../goto-instrument/cover_instrument_mcdc$(OBJEXT) \
../goto-instrument/cover_instrument_other$(OBJEXT) \
../goto-instrument/cover_util$(OBJEXT) \
../goto-instrument/unwindset$(OBJEXT) \
../analyses/analyses$(LIBEXT) \
../langapi/langapi$(LIBEXT) \
../xmllang/xmllang$(LIBEXT) \
../assembler/assembler$(LIBEXT) \
../solvers/solvers$(LIBEXT) \
../util/util$(LIBEXT) \
../json/json$(LIBEXT) \
../cbmc/bv_cbmc$(OBJEXT) \
../cbmc/cbmc_dimacs$(OBJEXT) \
../cbmc/cbmc_solvers$(OBJEXT) \
../cbmc/symex_bmc$(OBJEXT)

INCLUDES= -I ..

LIBS =

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

CLEANFILES = ccover$(EXEEXT)

all: ccover$(EXEEXT)

ifneq ($(wildcard ../bv_refinement/Makefile),)
OBJ += ../bv_refinement/bv_refinement$(LIBEXT)
CP_CXXFLAGS += -DHAVE_BV_REFINEMENT
endif

ifneq ($(wildcard ../jsil/Makefile),)
OBJ += ../jsil/jsil$(LIBEXT)
CP_CXXFLAGS += -DHAVE_JSIL
endif

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

ccover$(EXEEXT): $(OBJ)
$(LINKBIN)

.PHONY: ccover-mac-signed

ccover-mac-signed: ccover$(EXEEXT)
strip ccover$(EXEEXT) ; codesign -v -s $(OSX_IDENTITY) ccover$(EXEEXT)
Loading