Skip to content

Commit e7d0feb

Browse files
authored
Merge pull request diffblue#191 from diffblue/pull-support-20170914
Pull support 20170914
2 parents 1798af9 + 32a3f98 commit e7d0feb

File tree

355 files changed

+4537
-40410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

355 files changed

+4537
-40410
lines changed

.travis.yml

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
before_cache:
1414

1515
- &doxygen-stage
16-
stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
16+
- stage: Linter + Doxygen + non-debug Ubuntu/gcc-5 test
1717
env: NAME="DOXYGEN-CHECK"
1818
addons:
1919
apt:
@@ -42,22 +42,6 @@ jobs:
4242
# env: COMPILER=g++-5 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover -fno-omit-frame-pointer"
4343
env: COMPILER="ccache g++-5"
4444

45-
# LOCAL CHANGES: Upgraded to diffblue-builder:alpine-0.0.4 because it includes Python
46-
47-
# Alpine Linux with musl-libc using g++
48-
- stage: Test different OS/CXX/Flags
49-
os: linux
50-
sudo: required
51-
compiler: gcc
52-
cache: ccache
53-
services:
54-
- docker
55-
before_install:
56-
- docker pull diffblue/diffblue-builder:alpine-0.0.4
57-
env:
58-
- PRE_COMMAND="docker run -v ${TRAVIS_BUILD_DIR}:/cbmc -v ${HOME}/.ccache:/root/.ccache diffblue/diffblue-builder:alpine-0.0.4"
59-
- COMPILER="ccache g++"
60-
6145
# LOCAL CHANGES: Added 'ant' to the OSX package list (needed by security-scanner regression tests)
6246

6347
# OS X using g++
@@ -158,40 +142,57 @@ jobs:
158142
- EXTRA_CXXFLAGS="-DDEBUG"
159143
script: echo "Not running any tests for a debug build."
160144

145+
- stage: Test different OS/CXX/Flags
146+
os: linux
147+
cache: ccache
148+
env:
149+
- BUILD_SYSTEM=cmake
150+
addons:
151+
apt:
152+
sources:
153+
- ubuntu-toolchain-r-test
154+
packages:
155+
- g++-5
156+
install:
157+
- cmake -Hcbmc -Bcbmc/build '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_CXX_COMPILER=g++-5'
158+
- cmake --build cbmc/build -- -j4
159+
script: (cd cbmc/build; ctest -V -L CORE)
160+
161+
- stage: Test different OS/CXX/Flags
162+
os: osx
163+
cache: ccache
164+
env:
165+
- BUILD_SYSTEM=cmake
166+
- CCACHE_CPP2=yes
167+
install:
168+
- cmake -Hcbmc -Bcbmc/build '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_OSX_ARCHITECTURES=x86_64'
169+
- cmake --build cbmc/build -- -j4
170+
script: (cd cbmc/build; ctest -V -L CORE)
171+
172+
161173
allow_failures:
162174
- <<: *linter-stage
163-
- <<: *doxygen-stage
164175

165176
# LOCAL CHANGES: added cbmc/ prefix to some of the following commands
166177
# LOCAL CHANGES: added goto-analyzer.dir, goto-diff.dir and goto-cc.dir to the additional build list (needed for CBMC's regression tests, but not by the security-scanner product)
167178

168179
install:
169180
- ccache --max-size=1G
170-
- COMMAND="make -C cbmc/src minisat2-download" &&
171-
eval ${PRE_COMMAND} ${COMMAND}
172-
- COMMAND="make -C cbmc/src boost-download" &&
173-
eval ${PRE_COMMAND} ${COMMAND}
174-
- COMMAND="make -C cbmc/src/ansi-c library_check" &&
175-
eval ${PRE_COMMAND} ${COMMAND}
176-
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g -DUSE_BOOST $EXTRA_CXXFLAGS\" -j2" &&
177-
eval ${PRE_COMMAND} ${COMMAND}
178-
- COMMAND="make -C cbmc/src CXX=\"$COMPILER\" CXXFLAGS=\"$FLAGS $EXTRA_CXXFLAGS\" -j2 goto-analyzer.dir goto-cc.dir goto-diff.dir clobber.dir memory-models.dir musketeer.dir" &&
179-
eval ${PRE_COMMAND} ${COMMAND}
181+
- make -C cbmc/src minisat2-download
182+
- make -C cbmc/src boost-download
183+
- make -C cbmc/src/ansi-c library_check
184+
- make -C src "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g -DUSE_BOOST ${EXTRA_CXXFLAGS}" -j2
185+
- make -C cbmc/src "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g ${EXTRA_CXXFLAGS}" -j2 goto-analyzer.dir goto-cc.dir goto-diff.dir clobber.dir memory-models.dir
180186

181187
# LOCAL CHANGES: Added cbmc/ prefix, and added unit and regression tests to the end of the list.
182188

183189
script:
184190
- if [ -e bin/gcc ] ; then export PATH=$PWD/bin:$PATH ; fi ;
185-
COMMAND="env UBSAN_OPTIONS=print_stacktrace=1 make -C cbmc/regression test CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\"" &&
186-
eval ${PRE_COMMAND} ${COMMAND}
187-
- COMMAND="make -C cbmc/unit CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\" -j2" &&
188-
eval ${PRE_COMMAND} ${COMMAND}
189-
- COMMAND="make -C cbmc/unit test" &&
190-
eval ${PRE_COMMAND} ${COMMAND}
191-
- COMMAND="make -C unit test CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g -DUSE_BOOST $EXTRA_CXXFLAGS\"" &&
192-
eval ${PRE_COMMAND} ${COMMAND}
193-
- COMMAND="scripts/travis_run_regression_tests.sh" &&
194-
eval ${PRE_COMMAND} ${COMMAND}
191+
- env UBSAN_OPTIONS=print_stacktrace=1 make -C cbmc/regression test "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g ${EXTRA_CXXFLAGS}"
192+
- make -C cbmc/unit "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g ${EXTRA_CXXFLAGS}" -j2
193+
- make -C cbmc/unit test
194+
- make -C unit test "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g -DUSE_BOOST ${EXTRA_CXXFLAGS}"
195+
- scripts/travis_run_regression_tests.sh
195196

196197
before_cache:
197198
- ccache -s

cbmc/.travis.yml

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,6 @@ jobs:
3939
# env: COMPILER=g++-5 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover -fno-omit-frame-pointer"
4040
env: COMPILER="ccache g++-5"
4141

42-
# Alpine Linux with musl-libc using g++
43-
- stage: Test different OS/CXX/Flags
44-
os: linux
45-
sudo: required
46-
compiler: gcc
47-
cache: ccache
48-
services:
49-
- docker
50-
before_install:
51-
- docker pull diffblue/cbmc-builder:alpine-0.0.3
52-
env:
53-
- PRE_COMMAND="docker run -v ${TRAVIS_BUILD_DIR}:/cbmc -v ${HOME}/.ccache:/root/.ccache diffblue/cbmc-builder:alpine-0.0.3"
54-
- COMPILER="ccache g++"
55-
5642
# OS X using g++
5743
- stage: Test different OS/CXX/Flags
5844
os: osx
@@ -151,29 +137,50 @@ jobs:
151137
- EXTRA_CXXFLAGS="-DDEBUG"
152138
script: echo "Not running any tests for a debug build."
153139

140+
- stage: Test different OS/CXX/Flags
141+
os: linux
142+
cache: ccache
143+
env:
144+
- BUILD_SYSTEM=cmake
145+
addons:
146+
apt:
147+
sources:
148+
- ubuntu-toolchain-r-test
149+
packages:
150+
- g++-5
151+
install:
152+
- cmake -H. -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_CXX_COMPILER=g++-5'
153+
- cmake --build build -- -j4
154+
script: (cd build; ctest -V -L CORE)
155+
156+
- stage: Test different OS/CXX/Flags
157+
os: osx
158+
cache: ccache
159+
env:
160+
- BUILD_SYSTEM=cmake
161+
- CCACHE_CPP2=yes
162+
install:
163+
- cmake -H. -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_OSX_ARCHITECTURES=x86_64'
164+
- cmake --build build -- -j4
165+
script: (cd build; ctest -V -L CORE)
166+
167+
154168
allow_failures:
155169
- <<: *linter-stage
156170

157171
install:
158172
- ccache --max-size=1G
159-
- COMMAND="make -C src minisat2-download" &&
160-
eval ${PRE_COMMAND} ${COMMAND}
161-
- COMMAND="make -C src boost-download" &&
162-
eval ${PRE_COMMAND} ${COMMAND}
163-
- COMMAND="make -C src/ansi-c library_check" &&
164-
eval ${PRE_COMMAND} ${COMMAND}
165-
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g -DUSE_BOOST $EXTRA_CXXFLAGS\" -j2" &&
166-
eval ${PRE_COMMAND} ${COMMAND}
167-
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"$FLAGS $EXTRA_CXXFLAGS\" -j2 clobber.dir memory-models.dir musketeer.dir" &&
168-
eval ${PRE_COMMAND} ${COMMAND}
173+
- make -C src minisat2-download
174+
- make -C src boost-download
175+
- make -C src/ansi-c library_check
176+
- make -C src "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g -DUSE_BOOST ${EXTRA_CXXFLAGS}" -j2
177+
- make -C src "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g ${EXTRA_CXXFLAGS}" -j2 clobber.dir memory-models.dir
169178

170179
script:
171180
- if [ -e bin/gcc ] ; then export PATH=$PWD/bin:$PATH ; fi ;
172-
COMMAND="env UBSAN_OPTIONS=print_stacktrace=1 make -C regression test CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\"" &&
173-
eval ${PRE_COMMAND} ${COMMAND}
174-
- COMMAND="make -C unit CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\" -j2" &&
175-
eval ${PRE_COMMAND} ${COMMAND}
176-
- COMMAND="make -C unit test" && eval ${PRE_COMMAND} ${COMMAND}
181+
- env UBSAN_OPTIONS=print_stacktrace=1 make -C regression test "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g ${EXTRA_CXXFLAGS}"
182+
- make -C unit "CXX=${COMPILER}" "CXXFLAGS=-Wall -Werror -pedantic -O2 -g ${EXTRA_CXXFLAGS}" -j2
183+
- make -C unit test
177184

178185
before_cache:
179186
- ccache -s

cbmc/CMakeLists.txt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
cmake_minimum_required(VERSION 3.2)
2+
3+
find_program(CCACHE_PROGRAM ccache)
4+
if(CCACHE_PROGRAM)
5+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
6+
message(STATUS "Rule launch compile: ${CCACHE_PROGRAM}")
7+
endif()
8+
9+
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
10+
11+
include(GNUInstallDirs)
12+
13+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
14+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
15+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
16+
17+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
18+
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"
19+
)
20+
# Ensure NDEBUG is not set for release builds
21+
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
22+
# Enable lots of warnings
23+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wpedantic -Werror")
24+
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
25+
# This would be the place to enable warnings for Windows builds, although
26+
# config.inc doesn't seem to do that currently
27+
endif()
28+
29+
set(enable_cbmc_tests on CACHE BOOL "Whether CBMC tests should be enabled")
30+
31+
set(sat_impl "minisat2" CACHE STRING
32+
"This setting controls the SAT library which is used. Valid values are 'minisat2' and 'glucose'"
33+
)
34+
35+
add_subdirectory(src)
36+
37+
if(${enable_cbmc_tests})
38+
enable_testing()
39+
endif()
40+
add_subdirectory(unit)
41+
add_subdirectory(regression)

cbmc/COMPILING

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Follow these instructions:
171171
BUILD_ENV = MSVC
172172

173173
Open the Visual Studio Command prompt, and then bash.exe -login from
174-
Cygwin from in there.
174+
Cygwin from in there.
175175

176176
3) Type cd src; make - that should do it.
177177

@@ -183,6 +183,53 @@ can be used for building with MSBuild. Note that you still need to run
183183
flex/bison using "make generated_files" before opening the project.
184184

185185

186+
WORKING WITH CMAKE (EXPERIMENTAL)
187+
---------------------------------
188+
189+
There is an experimental build based on CMake instead of hand-written
190+
makefiles. It should work on a wider variety of systems than the standard
191+
makefile build, and can integrate better with IDEs and static-analysis tools.
192+
193+
0) Run `cmake --version`. If you get a command-not-found error, or the installed
194+
version is lower than 3.2, go and install a new version. Most Linux
195+
distributions have a package for CMake, and Mac users can get it through
196+
Homebrew. Windows users should download it manually from cmake.org.
197+
198+
1) Create a directory to store your build:
199+
`mkdir build`
200+
Run this from the *top level* folder of the project. This is different from
201+
the other builds, which require you to `cd src` first.
202+
203+
2) Generate build files with CMake:
204+
`cmake -H. -Bbuild`
205+
This command tells CMake to use the configuration in the current directory,
206+
and to generate build files into the `build` directory.
207+
This is the point to specify custom build settings, such as compilers and
208+
build back-ends. You can use clang (for example) by adding the argument
209+
`-DCMAKE_CXX_COMPILER=clang++` to the command line. You can also tell
210+
CMake to generate IDE projects by supplying the `-G` flag.
211+
Run `cmake -G` for a comprehensive list of supported back-ends.
212+
213+
Generally it is not necessary to manually specify individual compiler or
214+
linker flags, as CMake defines a number of "build modes" including Debug
215+
and Release modes. To build in a particular mode, add the flag
216+
`-DCMAKE_BUILD_TYPE=Debug` (or `Release`) to the initial invocation.
217+
218+
If you *do* need to manually add flags, use `-DCMAKE_CXX_FLAGS=...` and
219+
`-DCMAKE_EXE_LINKER_FLAGS=...`. This is useful for enabling clang's
220+
sanitizers.
221+
222+
Finally, to enable building universal binaries on macOS, you can pass the
223+
flag `-DCMAKE_OSX_ARCHITECTURES=i386;x86_64`. If you don't supply this flag,
224+
the build will just be for the architecture of your machine.
225+
226+
3) Run the build:
227+
`cmake --build build`
228+
This command tells CMake to invoke the correct tool to run the build in the
229+
`build` directory. You can also use the build back-end directly by invoking
230+
`make`, `ninja`, or opening the generated IDE project as appropriate.
231+
232+
186233
WORKING WITH ECLIPSE
187234
--------------------
188235

cbmc/appveyor.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,21 @@ build_script:
6060
test_script:
6161
- cmd: |
6262
cd regression
63-
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" ansi-c/Makefile
64-
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" cpp/Makefile
65-
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" goto-instrument/chain.sh
66-
sed -i "15s/.*/$goto_cc $name.c/" goto-instrument/chain.sh
67-
sed -i "16i mv $name.exe $name.gb" goto-instrument/chain.sh
68-
sed -i "23s/.*/ $goto_cc ${name}-mod.c/" goto-instrument/chain.sh
69-
sed -i "24i mv ${name}-mod.exe $name-mod.gb" goto-instrument/chain.sh
70-
cat goto-instrument/chain.sh
7163
72-
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" goto-instrument-typedef/chain.sh || true
73-
sed -i "12s/.*/$GC $NAME.c --function fun/" goto-instrument-typedef/chain.sh || true
74-
sed -i "13i mv $NAME.exe $NAME.gb" goto-instrument-typedef/chain.sh || true
75-
cat goto-instrument-typedef/chain.sh || true
64+
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" goto-cc-cbmc/chain.sh || true
65+
sed -i "11s/.*/$GC $NAME.c/" goto-cc-cbmc/chain.sh || true
66+
sed -i "12i mv $NAME.exe $NAME.gb" goto-cc-cbmc/chain.sh || true
67+
cat goto-cc-cbmc/chain.sh || true
68+
69+
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" goto-cc-goto-analyzer/chain.sh || true
70+
sed -i "11s/.*/$gc $name.c/" goto-cc-goto-analyzer/chain.sh || true
71+
sed -i "12i mv $name.exe $name.gb" goto-cc-goto-analyzer/chain.sh || true
72+
cat goto-cc-goto-analyzer/chain.sh || true
73+
74+
sed -i "s/goto-cc\/goto-cc/goto-cc\/goto-cl/" goto-cc-symex/chain.sh || true
75+
sed -i "11s/.*/$gc $name.c/" goto-cc-symex/chain.sh || true
76+
sed -i "12i mv $name.exe $name.gb" goto-cc-symex/chain.sh || true
77+
cat goto-cc-symex/chain.sh || true
7678
7779
rem HACK disable failing tests
7880
rmdir /s /q ansi-c\arch_flags_mcpu_bad
@@ -111,6 +113,11 @@ test_script:
111113
rmdir /s /q cbmc-java\tableswitch2
112114
rmdir /s /q goto-gcc
113115
rmdir /s /q goto-instrument\slice08
116+
rmdir /s /q symex\va_args_10
117+
rmdir /s /q symex\va_args_2
118+
rmdir /s /q symex\va_args_3
119+
rmdir /s /q symex\va_args_5
120+
rmdir /s /q symex\va_args_6
114121
115122
make test
116123

cbmc/regression/CMakeLists.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
set(CMAKE_CXX_STANDARD 11)
2+
set(CMAKE_CXX_STANDARD_REQUIRED true)
3+
4+
set(test_pl_path "${CMAKE_CURRENT_SOURCE_DIR}/test.pl")
5+
6+
macro(add_test_pl_profile name cmdline flag profile)
7+
add_test(
8+
NAME "${name}-${profile}"
9+
COMMAND ${test_pl_path} -c ${cmdline} ${flag}
10+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
11+
)
12+
set_tests_properties("${name}-${profile}" PROPERTIES
13+
LABELS "${profile}"
14+
)
15+
endmacro(add_test_pl_profile)
16+
17+
macro(add_test_pl_tests name cmdline)
18+
add_test_pl_profile("${name}" "${cmdline}" -C CORE)
19+
add_test_pl_profile("${name}" "${cmdline}" -T THOROUGH)
20+
add_test_pl_profile("${name}" "${cmdline}" -F FUTURE)
21+
add_test_pl_profile("${name}" "${cmdline}" -K KNOWNBUG)
22+
endmacro(add_test_pl_tests)
23+
24+
add_subdirectory(ansi-c)
25+
add_subdirectory(cbmc)
26+
add_subdirectory(cbmc-java)
27+
add_subdirectory(cbmc-java-inheritance)
28+
add_subdirectory(cpp)
29+
add_subdirectory(goto-analyzer)
30+
add_subdirectory(goto-diff)
31+
add_subdirectory(goto-instrument)
32+
add_subdirectory(goto-instrument-typedef)
33+
add_subdirectory(invariants)
34+
add_subdirectory(strings)
35+
add_subdirectory(strings-smoke-tests)
36+
add_subdirectory(test-script)

0 commit comments

Comments
 (0)