Skip to content

Commit a853b6a

Browse files
authored
Merge pull request diffblue#174 from diffblue/smowton/feature/cbmc_subtree
Switch to git-subtree
2 parents 144de1c + 2ef8da5 commit a853b6a

File tree

6,692 files changed

+2655681
-79
lines changed

Some content is hidden

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

6,692 files changed

+2655681
-79
lines changed

.gitmodules

-3
This file was deleted.

.travis.yml

+112-45
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,51 @@
11
language: cpp
22

3-
# Disable the default submodule logic
4-
git:
5-
submodules: false
6-
73
matrix:
84
include:
95

6+
# LOCAL CHANGES: Added CBMC_ALPINE_BUILD so that regression tests (which require Python) can be skipped in this case.
7+
# We really only care about breaking core cbmc in this case anyhow.
8+
9+
# Alpine Linux with musl-libc using g++
10+
- os: linux
11+
sudo: required
12+
compiler: gcc
13+
cache: ccache
14+
services:
15+
- docker
16+
before_install:
17+
- docker pull diffblue/cbmc-builder:alpine-0.0.1
18+
env:
19+
- PRE_COMMAND="docker run --env CBMC_ALPINE_BUILD=yes -v ${TRAVIS_BUILD_DIR}:/cbmc -v ${HOME}/.ccache:/root/.ccache diffblue/cbmc-builder:alpine-0.0.1"
20+
- COMPILER="ccache g++"
21+
22+
# LOCAL CHANGES: Added 'ant' to the OSX package list (needed by security-scanner regression tests)
23+
1024
# OS X using g++
1125
- os: osx
1226
sudo: false
1327
compiler: gcc
1428
cache: ccache
1529
before_install:
16-
- HOMEBREW_NO_AUTO_UPDATE=1 brew install jq ccache ant
30+
#we create symlink to non-ccache gcc, to be used in tests
31+
- mkdir bin ; ln -s /usr/bin/gcc bin/gcc
32+
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache ant
1733
- export PATH=/usr/local/opt/ccache/libexec:$PATH
1834
- ccache -M 1G
19-
env: COMPILER="ccache g++"
35+
env: COMPILER=g++
2036

2137
# OS X using clang++
2238
- os: osx
2339
sudo: false
2440
compiler: clang
2541
cache: ccache
2642
before_install:
27-
- HOMEBREW_NO_AUTO_UPDATE=1 brew install jq ccache ant
43+
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache ant
2844
- export PATH=/usr/local/opt/ccache/libexec:$PATH
2945
- ccache -M 1G
30-
env: COMPILER="ccache clang++ -Qunused-arguments -fcolor-diagnostics"
46+
env:
47+
- COMPILER="ccache clang++ -Qunused-arguments -fcolor-diagnostics"
48+
- CCACHE_CPP2=yes
3149

3250
# Ubuntu Linux with glibc using g++-5
3351
- os: linux
@@ -44,7 +62,29 @@ matrix:
4462
- libubsan0
4563
before_install:
4664
- mkdir bin ; ln -s /usr/bin/gcc-5 bin/gcc
47-
env: COMPILER="ccache g++-5"
65+
# env: COMPILER=g++-5 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover -fno-omit-frame-pointer"
66+
env: COMPILER="g++-5"
67+
68+
# Ubuntu Linux with glibc using g++-5, debug mode
69+
- os: linux
70+
sudo: false
71+
compiler: gcc
72+
cache: ccache
73+
addons:
74+
apt:
75+
sources:
76+
- ubuntu-toolchain-r-test
77+
packages:
78+
- libwww-perl
79+
- g++-5
80+
- libubsan0
81+
before_install:
82+
- mkdir bin ; ln -s /usr/bin/gcc-5 bin/gcc
83+
# env: COMPILER=g++-5 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover -fno-omit-frame-pointer"
84+
env:
85+
- COMPILER="g++-5"
86+
- EXTRA_CXXFLAGS="-DDEBUG"
87+
script: echo "Not running any tests for a debug build."
4888

4989
# Ubuntu Linux with glibc using clang++-3.7
5090
- os: linux
@@ -63,59 +103,86 @@ matrix:
63103
- libubsan0
64104
before_install:
65105
- mkdir bin ; ln -s /usr/bin/clang-3.7 bin/gcc
106+
- export CCACHE_CPP2=yes
107+
# env: COMPILER=clang++-3.7 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined,integer -fno-omit-frame-pointer"
66108
env:
67109
- COMPILER="ccache clang++-3.7 -Qunused-arguments -fcolor-diagnostics"
68110
- CCACHE_CPP2=yes
69111

70-
- env: NAME="CPP-LINT"
112+
# Ubuntu Linux with glibc using clang++-3.7, debug mode
113+
- os: linux
114+
sudo: false
115+
compiler: clang
116+
cache: ccache
71117
addons:
72118
apt:
119+
sources:
120+
- ubuntu-toolchain-r-test
121+
- llvm-toolchain-precise-3.7
73122
packages:
74123
- libwww-perl
75-
script:
76-
- git fetch origin $TRAVIS_BRANCH && git branch $TRAVIS_BRANCH FETCH_HEAD && cbmc/scripts/travis_lint.sh
124+
- clang-3.7
125+
- libstdc++-5-dev
126+
- libubsan0
127+
before_install:
128+
- mkdir bin ; ln -s /usr/bin/clang-3.7 bin/gcc
129+
- export CCACHE_CPP2=yes
130+
# env: COMPILER=clang++-3.7 SAN_FLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined,integer -fno-omit-frame-pointer"
131+
env:
132+
- COMPILER="ccache clang++-3.7 -Qunused-arguments -fcolor-diagnostics"
133+
- CCACHE_CPP2=yes
134+
- EXTRA_CXXFLAGS="-DDEBUG"
135+
script: echo "Not running any tests for a debug build."
136+
137+
# LOCAL CHANGES: added cbmc/ prefix to both these scripts (and the allow_failures entry for cpp-lint)
77138

78-
allow_failures:
79139
- env: NAME="CPP-LINT"
140+
install:
141+
script: cbmc/scripts/travis_lint.sh
142+
before_cache:
143+
144+
- env: NAME="DOXYGEN-CHECK"
80145
addons:
81146
apt:
82147
packages:
83-
- libwww-perl
84-
script:
85-
- git fetch origin $TRAVIS_BRANCH && git branch $TRAVIS_BRANCH FETCH_HEAD && cbmc/scripts/travis_lint.sh
148+
- doxygen
149+
install:
150+
script: cbmc/scripts/travis_doxygen.sh
151+
before_cache:
152+
153+
allow_failures:
154+
- env: NAME="CPP-LINT"
155+
install:
156+
script: cbmc/scripts/travis_lint.sh
86157
before_cache:
87158

159+
# LOCAL CHANGES: added cbmc/ prefix to some of the following commands
160+
# 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)
161+
88162
install:
89-
- if [ -L bin/gcc ] ; then export PATH=$PWD/bin:$PATH ; fi ;
90-
- |
91-
# If this is a PR, CBMC submodule has to refer to 'diffblue/cbmc' not to a fork
92-
if [[ ${TRAVIS_PULL_REQUEST} == "false" ]]
93-
then
94-
# Export list of all contributors to know which forks to pull
95-
export USERS=$(curl -H "Authorization: token ${GITHUB_TOKEN}" \
96-
https://api.github.com/repos/diffblue/security-scanner/contributors \
97-
| jq -r '.[] | .login' \
98-
| tr "\n" " ")
99-
echo "List of forks to pull >${USERS}<"
100-
else
101-
echo "List of forks to pull >${USERS}<"
102-
fi
103-
# Run within host machine to setup CBMC remotes
104-
- make setup-cbmc
105-
106-
before_cache: ccache -s
163+
- COMMAND="make -C cbmc/src minisat2-download" &&
164+
eval ${PRE_COMMAND} ${COMMAND}
165+
- COMMAND="make -C cbmc/src boost-download" &&
166+
eval ${PRE_COMMAND} ${COMMAND}
167+
- COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g -DUSE_BOOST $EXTRA_CXXFLAGS\" -j2" &&
168+
eval ${PRE_COMMAND} ${COMMAND}
169+
- 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" &&
170+
eval ${PRE_COMMAND} ${COMMAND}
171+
172+
# LOCAL CHANGES: added cbmc/ prefix to CBMC's test commands and appended security-scanner test commands
107173

108174
script:
109-
- |
110-
# Compile in host machine/container & run tests in host machine/container
111-
if [ -L bin/gcc ] ; then export PATH=$PWD/bin:$PATH ; fi ;
112-
COMMAND="make -C src CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -O2 -g -Werror -Wno-deprecated-register -pedantic -Wno-sign-compare -DUSE_BOOST\"" &&
113-
eval ${PRE_COMMAND} ${COMMAND} &&
114-
COMMAND="make -C unit test CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -O2 -g -Werror -Wno-deprecated-register -pedantic -Wno-sign-compare -DUSE_BOOST\"" &&
115-
eval ${PRE_COMMAND} ${COMMAND} &&
116-
COMMAND="make regression" &&
175+
- if [ -e bin/gcc ] ; then export PATH=$PWD/bin:$PATH ; fi ;
176+
COMMAND="env UBSAN_OPTIONS=print_stacktrace=1 make -C cbmc/regression test CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\"" &&
177+
eval ${PRE_COMMAND} ${COMMAND}
178+
- COMMAND="make -C cbmc/unit CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g $EXTRA_CXXFLAGS\" -j2" &&
179+
eval ${PRE_COMMAND} ${COMMAND}
180+
- COMMAND="make -C cbmc/unit test" &&
181+
eval ${PRE_COMMAND} ${COMMAND}
182+
- COMMAND="make -C unit test CXX=\"$COMPILER\" CXXFLAGS=\"-Wall -Werror -pedantic -O2 -g -DUSE_BOOST $EXTRA_CXXFLAGS\"" &&
183+
eval ${PRE_COMMAND} ${COMMAND}
184+
- COMMAND="scripts/travis_run_regression_tests.sh" &&
117185
eval ${PRE_COMMAND} ${COMMAND}
118186

119-
notifications:
120-
slack:
121-
secure: "W/ZrxvFs/OiNYwD9BdtgM5HYMzBL6aBJ62wHwMjF4TKfkbpb05GgYQtwvNRy6cBPOfY4TxECPUzqKiJ6cpGoi4hyST0pye0pCbvZ0CEipT0JkaxtrOkssqmb9ezBpoE7qnPMgQ3eJKpg0DSpP9oE7y5SaUcCajzN7TcY1K4gRnUiyixNyH0fRpCYKLYB8p9Y/RmGMOcmTfWxuGa4TjKLRyI85tS1wZBe6WDkRj4uU7FaRPh88q6zTTFO4AJWBVQsEuP1x4Go0hsZ4r9dsG43hL2OVCVKZtQQVURXRAr7pOAE9mWwJNsAqkoiv/6eriZyJPALUcmEHvvqOJSQWB4iKWrRM+k8aarukcCzr86huLNwnSSWLhMz7Gaq5qe6GihTkCf16j5+6AqfYwIOcECzpNCF/8Sq/5H83/SGSCuT6j9RSpoiGD/fo03zCgp7TXEErUqfmtxJjOHPhBjKp9o0dYj/aBwX2/vBT8PWIrji1GLUoVEd4yGWzbaOk6koVEx3++qHt90SstuerWUQ9ln7n4p1ZLYws+jbJRX1Iadug/7i8mYjElF2/rnA5hqPxcyoF/e1AZ5sktxkSX3wIdEjLa48QaWKhom0mfZb+sIjDKp2GawPGIbN1uVqAmdHiPjIAsn3PxaKzZg/Lm94d+NyVqtzIuxTZJ70T/4Gycry8m0="
187+
before_cache:
188+
- ccache -s

Makefile

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ clean:
88
$(MAKE) $(MAKEARGS) -C src clean
99

1010
setup-cbmc:
11-
# Configure any extra remotes that are needed before updating the submodule
12-
./setup_submodules.sh $(USERS)
13-
git submodule update
14-
1511
# To make a single step build, proactively do the dependency downloads:
1612
$(MAKE) $(MAKEARGS) -C cbmc/src minisat2-download
1713
$(MAKE) $(MAKEARGS) -C cbmc/src boost-download
18-
14+
1915
regression:
2016
ifndef single
2117
python ./benchmarks/evaluator.py

cbmc

-1
This file was deleted.

cbmc/.editorconfig

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
6+
indent_style = space
7+
indent_size = 2
8+
9+
trim_trailing_whitespace = true
10+
11+
max_line_length = 80
12+
end_of_line = lf
13+
insert_final_newline = true
14+
15+
[*patch]
16+
# Trailing spaces are significant in patch files
17+
trim_trailing_whitespace = false

cbmc/.gitattributes

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.cpp text
2+
*.c text
3+
*.h text
4+
*.y text
5+
*.tex text
6+
*.shtml text
7+
*.html text
8+
*.css text
9+
*.inc text
10+
test.desc text
11+
Makefile text

cbmc/.githooks/pre-commit

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
# Runs scripts/cpplint.py on the modified files
3+
# Based on https://github.com/s0enke/git-hooks/
4+
#
5+
# @author Peter Schrammel <[email protected]>
6+
7+
gitRoot="$(dirname $0)/../.."
8+
9+
# this is the magic:
10+
# retrieve all files in staging area that are added, modified or renamed
11+
# but no deletions etc
12+
files=$(git diff-index --name-only --cached --diff-filter=ACMR HEAD -- )
13+
14+
if [ "$files" == "" ]; then
15+
exit 0
16+
fi
17+
18+
# create temporary copy of staging area and delete upon exit
19+
cleanup()
20+
{
21+
rm -rf $tmpStaging
22+
}
23+
24+
trap cleanup EXIT
25+
26+
tmpStaging=$(mktemp -d)
27+
touch $tmpStaging/.git
28+
29+
# Copy contents of staged version of files to temporary staging area
30+
# because we only want the staged version that will be commited and not
31+
# the version in the working directory
32+
stagedFiles=""
33+
for file in $files
34+
do
35+
id=$(git diff-index --cached HEAD $file | cut -d " " -f4)
36+
37+
# create staged version of file in temporary staging area with the same
38+
# path as the original file
39+
mkdir -p "$tmpStaging/$(dirname $file)"
40+
git cat-file blob $id > "$tmpStaging/$file"
41+
stagedFiles="$stagedFiles $tmpStaging/$file"
42+
done
43+
44+
output=$(cd $gitRoot; scripts/cpplint.py $stagedFiles 2>&1)
45+
retval=$?
46+
47+
if [ $retval -ne 0 ]
48+
then
49+
echo "$output"
50+
exit 1
51+
fi

0 commit comments

Comments
 (0)