Skip to content

Commit bc7894a

Browse files
authored
Merge branch 'develop' into feature/malloc-may-fail
2 parents 0f2f62f + 7405bfb commit bc7894a

File tree

637 files changed

+17202
-1672
lines changed

Some content is hidden

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

637 files changed

+17202
-1672
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Local files generated by IDEs
22
.vs/*
33
.vscode/*
4+
*.code-workspace
45
~AutoRecover.*
56
*.sln
67
*.vcxproj*

.travis.yml

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ jobs:
243243
- cmake -S . -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_CXX_COMPILER=/usr/bin/g++-7' '-DCMAKE_USE_CUDD=true' -DCMAKE_CXX_FLAGS="-DBDD_GUARDS" '-DWITH_MEMORY_ANALYZER=On'
244244
- git submodule update --init --recursive
245245
- cmake --build build -- -j4
246-
script: (cd build; ctest -V -L CORE -j2)
246+
script: (cd build; ctest -V -L CORE -j2; ctest -V -R unit-xfail -j2)
247247

248248
# cmake build using clang++-6
249249
- stage: Test different OS/CXX/Flags
@@ -280,7 +280,7 @@ jobs:
280280
- cmake -S . -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_CXX_COMPILER=/usr/bin/clang++-7' '-DCMAKE_CXX_FLAGS=-Qunused-arguments' '-DWITH_MEMORY_ANALYZER=On'
281281
- git submodule update --init --recursive
282282
- cmake --build build -- -j4
283-
script: (cd build; ctest -V -L CORE -j2)
283+
script: (cd build; ctest -V -L CORE -j2; ctest -V -R unit-xfail -j2)
284284

285285
# cmake build on OSX, using default clang
286286
- stage: Test different OS/CXX/Flags
@@ -300,7 +300,7 @@ jobs:
300300
- cmake -S . -Bbuild '-DCMAKE_BUILD_TYPE=Release' '-DCMAKE_OSX_ARCHITECTURES=x86_64'
301301
- git submodule update --init --recursive
302302
- cmake --build build -- -j4
303-
script: (cd build; ctest -V -L CORE -j2)
303+
script: (cd build; ctest -V -L CORE -j2; ctest -V -R unit-xfail -j2)
304304

305305

306306
# Run Coverity
@@ -338,6 +338,37 @@ jobs:
338338
- WITH_MEMORY_ANALYZER=1
339339
script: echo "This is coverity build. No need for tests."
340340

341+
# cmake install test
342+
- stage: Test different OS/CXX/Flags
343+
os: linux
344+
dist: trusty
345+
sudo: false
346+
compiler: gcc
347+
cache: ccache
348+
env:
349+
- NAME="cmake install test"
350+
- BINARIES="cbmc goto-cc goto-gcc goto-ld goto-instrument goto-analyzer goto-diff goto-harness jbmc janalyzer jdiff"
351+
addons:
352+
apt:
353+
sources:
354+
- ubuntu-toolchain-r-test
355+
packages:
356+
- g++-5
357+
- maven
358+
install:
359+
- ccache -z
360+
- ccache --max-size=1G
361+
- cmake --version
362+
- cmake -S . -Bbuild '-DCMAKE_CXX_COMPILER=/usr/bin/g++-5' '-DCMAKE_INSTALL_PREFIX=install'
363+
- cmake --build build -- -j4
364+
- pushd build; make install; popd
365+
script: |
366+
for b in $BINARIES; do
367+
( echo === $b === &&
368+
install/bin/$b --version &&
369+
man -M install/share/man $b | head ) || exit 1 ;
370+
done
371+
341372
install:
342373
- ccache -z
343374
- ccache --max-size=1G
@@ -355,9 +386,13 @@ script:
355386
- env PATH=$PATH:`pwd`/src/solvers UBSAN_OPTIONS=print_stacktrace=1 make -C regression/cbmc test-cprover-smt2
356387
- make -C unit "CXX=${COMPILER} ${EXTRA_CXXFLAGS}" -j2
357388
- make -C unit test
389+
- echo "Running expected failure tests"
390+
- make TAGS="[!shouldfail]" -C unit test
358391
- env UBSAN_OPTIONS=print_stacktrace=1 make -C jbmc/regression test-parallel "CXX=${COMPILER} ${EXTRA_CXXFLAGS}" -j2 JOBS=2
359392
- make -C jbmc/unit "CXX=${COMPILER} ${EXTRA_CXXFLAGS}" -j2
360393
- make -C jbmc/unit test
394+
- echo "Running expected failure tests"
395+
- make TAGS="[!shouldfail]" -C jbmc/unit test
361396

362397
before_cache:
363398
- ccache -s

COMPILING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@ require manual modification of build files.
255255
to generate IDE projects by supplying the `-G` flag. Run `cmake -G` for a
256256
comprehensive list of supported back-ends.
257257
258+
On macOS >10.14, the build will fail unless you explicitly specify
259+
the full path to the compiler. This issue is being tracked
260+
[here](https://github.com/diffblue/cbmc/issues/4956). The invocation thus
261+
looks like this:
262+
```
263+
cmake -S. -Bbuild -DCMAKE_C_COMPILER=/usr/bin/clang
264+
```
265+
258266
Generally it is not necessary to manually specify individual compiler or
259267
linker flags, as CMake defines a number of "build modes" including Debug and
260268
Release modes. To build in a particular mode, add the flag

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Build Status][travis_img]][travis]
2-
![Build Status][codebuild_img]
3-
![Build Status][codebuild_windows_img]
2+
[![Build Status][codebuild_img]][codebuild]
3+
[![Build Status][codebuild_windows_img]][codebuild_windows]
44
[![Build Status][coverity_img]][coverity]
55
[![Build Status][codecov_img]][codecov]
66

@@ -56,7 +56,9 @@ License
5656

5757
[travis]: https://travis-ci.org/diffblue/cbmc
5858
[travis_img]: https://travis-ci.org/diffblue/cbmc.svg?branch=master
59+
[codebuild]: https://us-east-1.console.aws.amazon.com/codesuite/codebuild/projects/cbmc/history?region=us-east-1
5960
[codebuild_img]: https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiajhxcmNGUEgyV0xZa2ZFaVd3czJmbm1DdEt3QVdJRVdZaGJuMTUwOHFrZUM3eERwS1g4VEQ3Ymw3bmFncldVQXArajlYL1pXbGZNVTdXdndzUHU4Ly9JPSIsIml2UGFyYW1ldGVyU3BlYyI6IkVUUEdWVEt0SUFONlhyNVAiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=develop
61+
[codebuild_windows]: https://us-east-1.console.aws.amazon.com/codesuite/codebuild/projects/cbmc-windows/history?region=us-east-1
6062
[codebuild_windows_img]: https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiTFQ4Q0lCSEc1Rk5NcmlzaFZDdU44Vk8zY0c1VCtIVWMwWnJMRitmVFI5bE94Q3dhekVPMWRobFU2Q0xTTlpDSWZUQ3J1eksrWW1rSll1OExXdll2bExZPSIsIml2UGFyYW1ldGVyU3BlYyI6InpqcloyaEdxbjBiQUtvNysiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=develop
6163
[coverity]: https://scan.coverity.com/projects/diffblue-cbmc
6264
[coverity_img]: https://scan.coverity.com/projects/13552/badge.svg

buildspec-linux-clang.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ phases:
2727
post_build:
2828
commands:
2929
- make -C unit test
30+
- echo "Running expected failure tests"
31+
- make TAGS="[!shouldfail]" -C unit test
3032
- make -C regression test CXX='ccache /usr/bin/clang++-8' CXX_FLAGS='-Qunused-arguments'
3133
- make -C regression/cbmc test-paths-lifo
3234
- env PATH=$PATH:`pwd`/src/solvers make -C regression/cbmc test-cprover-smt2
3335
- make -C jbmc/unit test
36+
- echo "Running expected failure tests"
37+
- make TAGS="[!shouldfail]" -C jbmc/unit test
3438
- make -C jbmc/regression test
3539
- echo Build completed on `date`
3640
cache:

buildspec-linux-cmake-gcc.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ phases:
1212
commands:
1313
- sed -i 's#/archive.ubuntu.com#/us-east-1.ec2.archive.ubuntu.com#g' /etc/apt/sources.list
1414
- apt-get update -y
15-
- apt-get install -y flex bison make git libwww-perl patch ccache libc6-dev-i386 jq
15+
- apt-get install -y flex bison make git libwww-perl patch ccache libc6-dev-i386 jq cmake
1616
build:
1717
commands:
1818
- echo Build started on `date`
@@ -22,6 +22,7 @@ phases:
2222
post_build:
2323
commands:
2424
- cd build; ctest -V -L CORE -j2
25+
- cd build; ctest -V -R unit-xfail -j2
2526
- echo Build completed on `date`
2627
cache:
2728
paths:

buildspec-windows.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ phases:
5757
$env:Path = "C:\tools\cygwin\bin;$env:Path"
5858
cmd /c 'call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && bash -c "make -C unit test BUILD_ENV=MSVC" '
5959
60+
- |
61+
$env:Path = "C:\tools\cygwin\bin;$env:Path"
62+
cmd /c 'call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && bash -c "make TAGS=[!shouldfail] -C unit test BUILD_ENV=MSVC" '
63+
6064
- |
6165
$env:Path = "C:\tools\cygwin\bin;$env:Path"
6266
cmd /c 'call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && bash -c "make -C jbmc/regression test BUILD_ENV=MSVC" '
@@ -65,6 +69,10 @@ phases:
6569
$env:Path = "C:\tools\cygwin\bin;$env:Path"
6670
cmd /c 'call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && bash -c "make -C jbmc/unit test BUILD_ENV=MSVC" '
6771
72+
- |
73+
$env:Path = "C:\tools\cygwin\bin;$env:Path"
74+
cmd /c 'call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && bash -c "make TAGS=[!shouldfail] -C jbmc/unit test BUILD_ENV=MSVC" '
75+
6876
cache:
6977
paths:
7078
- 'c:\clcache\**\*'

buildspec.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ phases:
1313
commands:
1414
- sed -i 's#/archive.ubuntu.com#/us-east-1.ec2.archive.ubuntu.com#g' /etc/apt/sources.list
1515
- apt-get update -y
16-
- apt-get install -y flex bison make git libwww-perl patch ccache libc6-dev-i386 jq gdb
16+
- apt-get install -y flex bison make git libwww-perl patch ccache libc6-dev-i386 jq gdb libxml2-utils
1717
build:
1818
commands:
1919
- echo Build started on `date`
@@ -26,10 +26,14 @@ phases:
2626
post_build:
2727
commands:
2828
- make -C unit test
29+
- echo "Running expected failure tests"
30+
- make TAGS="[!shouldfail]" -C unit test
2931
- make -C regression test
3032
- make -C regression/cbmc test-paths-lifo
3133
- env PATH=$PATH:`pwd`/src/solvers make -C regression/cbmc test-cprover-smt2
3234
- make -C jbmc/unit test
35+
- echo "Running expected failure tests"
36+
- make TAGS="[!shouldfail]" -C jbmc/unit test
3337
- make -C jbmc/regression test
3438
- echo Build completed on `date`
3539
cache:

doc/architectural/howto.md

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,32 @@ to the basic data structures and workflow needed for contributing to
1616

1717
## Initial setup
1818

19-
Clone the [CBMC repository][cbmc-repo] and build it:
19+
Clone the [CBMC repository][cbmc-repo] and build it. The build instructions are
20+
written in a file called COMPILING.md in the top level of the repository. I
21+
recommend that you build using CMake---this will place all of the CBMC tools in
22+
a single directory, which you can add to your `$PATH`. For example, if you built
23+
the codebase with the following two commands at the top level of the repository:
2024

21-
git clone https://github.com/diffblue/cbmc.git
22-
cd cbmc/src
23-
make minisat2-download
24-
make
25+
cmake -DCMAKE_BUILD_TYPE=Debug \
26+
-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
27+
-DCMAKE_C_COMPILER=/usr/bin/clang \
28+
-B build -S .
29+
cmake --build build
30+
31+
then all the CBMC binaries will be built into `build/bin`, and you can run the
32+
following commands to make CBMC invokable from your terminal.
33+
34+
# Assuming you cloned CBMC into ~/code
35+
export PATH=~/code/cbmc/build/bin:$PATH
36+
# Add to your shell's startup configuration file so that you don't have to run that command every time.
37+
echo 'export PATH=~/code/cbmc/build/bin:$PATH' >> .bashrc
38+
39+
If you are using Make instead of CMake, the built binaries will be
40+
scattered throughout the source tree. This tutorial uses the binaries
41+
`src/cbmc/cbmc`, `src/goto-instrument/goto-instrument`, and
42+
`src/goto-cc/goto-gcc`, so you will need to add each of those
43+
directories to your `$PATH`, or symlink to those binaries from a
44+
directory that is already in your `$PATH`.
2545

2646
Ensure that [graphviz][graphviz] is installed on your system (in
2747
particular, you should be able to run a program called `dot`). Install
@@ -30,48 +50,29 @@ particular, you should be able to run a program called `dot`). Install
3050
# In the src directory
3151
doxygen doxyfile
3252
# View the documentation in a web browser
33-
firefox doxy/html/index.html
53+
firefox ~/code/cbmc/doc/html/index.html
3454

3555
If you've never used doxygen documentation before, get familiar with the
3656
layout. Open the generated HTML page in a web browser; search for the
3757
class `goto_programt` in the search bar, and jump to the documentation
3858
for that class; and read through the copious documentation.
3959

40-
The build writes executable programs into several of the source
41-
directories. In this tutorial, we'll be using binaries inside the
42-
`cbmc`, `goto-instrument`, and `goto-cc` directories. Add these
43-
directories to your `$PATH`:
44-
45-
# Assuming you cloned CBMC into ~/code
46-
export PATH=~/code/cbmc/src/goto-instrument:~/code/cbmc/src/goto-cc:~/code/cbmc/src/cbmc:$PATH
47-
# Add to your shell's startup configuration file so that you don't have to run that command every time.
48-
echo 'export PATH=~/code/cbmc/src/goto-instrument:~/code/cbmc/src/goto-cc:~/code/cbmc/src/cbmc:$PATH' >> .bashrc
49-
50-
Optional: install an image viewer that can read images on stdin.
51-
I use [feh][feh].
52-
5360
[cbmc-repo]: https://github.com/diffblue/cbmc/
5461
[doxygen]: http://www.stack.nl/~dimitri/doxygen/
5562
[graphviz]: http://www.graphviz.org/
56-
[feh]: https://feh.finalrewind.org/
57-
5863

5964

6065
## Whirlwind tour of the tools
6166

62-
CBMC's code is located under the `cbmc` directory. Even if you plan to
67+
CBMC's code is located under the `src` directory. Even if you plan to
6368
contribute only to CBMC, it is important to be familiar with several
6469
other of cprover's auxiliary tools.
6570

6671

6772
### Compiling with `goto-cc`
6873

69-
There should be an executable file called `goto-cc` in the `goto-cc`
70-
directory; make a symbolic link to it called `goto-gcc`:
71-
72-
cd cbmc/src/goto-cc
73-
ln -s "$(pwd)/goto-cc" goto-gcc
74-
74+
If you built using CMake on Unix, you should be able to run the
75+
`goto-gcc` command.
7576
Find or write a moderately-interesting C program; we'll call it `main.c`.
7677
Run the following commands:
7778

@@ -102,16 +103,10 @@ structured programming constructs.
102103

103104
Find or write a small C program (2 or 3 functions, each containing a few
104105
varied statements). Compile it using `goto-gcc` as above into an object
105-
file called `main`. If you installed `feh`, try the following command
106-
to dump a control-flow graph:
107-
108-
goto-instrument --dot main | tail -n +2 | dot -Tpng | feh -
109-
110-
If you didn't install `feh`, you can write the diagram to the file and
111-
then view it:
106+
file called `main`. You can write the diagram to a file and then view it:
112107

113-
goto-instrument --dot main | tail -n +2 | dot -Tpng > main.png
114-
Now open main.png with an image viewer
108+
goto-instrument --dot main.goto | tail -n +2 | dot -Tpng > main.png
109+
open main.png
115110

116111
(the invocation of `tail` is used to filter out the first line of
117112
`goto-instrument` output. If `goto-instrument` writes more or less
@@ -148,7 +143,7 @@ At some point in that function, there will be a long sequence of `if` statements
148143
**Task:** Add a `--greet` switch to `goto-instrument`, taking an optional
149144
argument, with the following behaviour:
150145

151-
$ goto-instrument --greet main
146+
$ goto-instrument --greet main.goto
152147
hello, world!
153148
$ goto-instrument --greet Leperina main
154149
hello, Leperina!

0 commit comments

Comments
 (0)