Skip to content

Commit d0d3620

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into security-scanner-support
2 parents ae83e4e + 875d554 commit d0d3620

File tree

276 files changed

+2873
-8383
lines changed

Some content is hidden

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

276 files changed

+2873
-8383
lines changed

.travis.yml

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +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-
# OS X using g++
43-
- stage: Test different OS/CXX/Flags
44-
os: osx
45-
sudo: false
46-
compiler: gcc
47-
cache: ccache
48-
before_install:
49-
#we create symlink to non-ccache gcc, to be used in tests
50-
- mkdir bin ; ln -s /usr/bin/gcc bin/gcc
51-
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
52-
- export PATH=/usr/local/opt/ccache/libexec:$PATH
53-
env: COMPILER="ccache g++"
54-
55-
# OS X using clang++
56-
- stage: Test different OS/CXX/Flags
57-
os: osx
58-
sudo: false
59-
compiler: clang
60-
cache: ccache
61-
before_install:
62-
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
63-
- export PATH=/usr/local/opt/ccache/libexec:$PATH
64-
env:
65-
- COMPILER="ccache clang++ -Qunused-arguments -fcolor-diagnostics"
66-
- CCACHE_CPP2=yes
67-
6842
# Ubuntu Linux with glibc using g++-5, debug mode
6943
- stage: Test different OS/CXX/Flags
7044
os: linux
@@ -153,17 +127,42 @@ jobs:
153127
- cmake --build build -- -j4
154128
script: (cd build; ctest -V -L CORE)
155129

130+
# Run Coverity
156131
- stage: Test different OS/CXX/Flags
157-
os: osx
132+
os: linux
133+
sudo: required
134+
compiler: gcc
158135
cache: ccache
136+
addons:
137+
apt:
138+
sources:
139+
- ubuntu-toolchain-r-test
140+
packages:
141+
- libwww-perl
142+
- g++-5
143+
coverity_scan:
144+
project:
145+
name: "diffblue/cbmc"
146+
description: "Travis build of ${TRAVIS_COMMIT}"
147+
notification_email: "[email protected]"
148+
build_command_prepend: "make -C src minisat2-download"
149+
build_command: "make -C src -j2"
150+
branch_pattern: "develop"
151+
before_install:
152+
- |
153+
if [[ "${TRAVIS_EVENT_TYPE}" != "cron" ]]
154+
then
155+
echo "This is not a cron build and build is not needed."
156+
travis_terminate 0
157+
fi
158+
- mkdir bin ; ln -s /usr/bin/gcc-5 bin/gcc
159+
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 90
160+
- g++ --version
161+
# Coverity runs as part of before_script
159162
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-
163+
- NAME="COVERITY_SCAN"
164+
- COMPILER="ccache g++"
165+
script: echo "This is coverity build. No need for tests."
167166

168167
allow_failures:
169168
- <<: *linter-stage

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ if(CCACHE_PROGRAM)
66
message(STATUS "Rule launch compile: ${CCACHE_PROGRAM}")
77
endif()
88

9+
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
10+
911
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
1012

1113
include(GNUInstallDirs)

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[![Build Status][travis_img]][travis] [![Build Status][appveyor_img]][appveyor]
2+
[![Build Status][coverity_img]][coverity]
23

34
[CProver Wiki](http://www.cprover.org/wiki)
45

@@ -47,4 +48,6 @@ License
4748
[travis]: https://travis-ci.org/diffblue/cbmc
4849
[travis_img]: https://travis-ci.org/diffblue/cbmc.svg?branch=master
4950
[appveyor]: https://ci.appveyor.com/project/diffblue/cbmc/
50-
[appveyor_img]: https://ci.appveyor.com/api/projects/status/github/diffblue/cbmc?svg=true&branch=master
51+
[appveyor_img]: https://ci.appveyor.com/api/projects/status/github/diffblue/cbmc?svg=true&branch=master
52+
[coverity]: https://scan.coverity.com/projects/diffblue-cbmc
53+
[coverity_img]: https://scan.coverity.com/projects/13552/badge.svg

appveyor.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,6 @@ test_script:
6161
- cmd: |
6262
cd regression
6363
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
78-
7964
rem HACK disable failing tests
8065
rmdir /s /q ansi-c\arch_flags_mcpu_bad
8166
rmdir /s /q ansi-c\arch_flags_mcpu_good
@@ -113,11 +98,6 @@ test_script:
11398
rmdir /s /q cbmc-java\tableswitch2
11499
rmdir /s /q goto-gcc
115100
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
121101
122102
make test
123103

regression/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ macro(add_test_pl_profile name cmdline flag profile)
1414
)
1515
endmacro(add_test_pl_profile)
1616

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)
17+
macro(add_test_pl_tests cmdline)
18+
get_filename_component(TEST_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
19+
message(STATUS "Adding tests in directory: ${TEST_DIR_NAME}")
20+
add_test_pl_profile("${TEST_DIR_NAME}" "${cmdline}" -C CORE)
21+
add_test_pl_profile("${TEST_DIR_NAME}" "${cmdline}" -T THOROUGH)
22+
add_test_pl_profile("${TEST_DIR_NAME}" "${cmdline}" -F FUTURE)
23+
add_test_pl_profile("${TEST_DIR_NAME}" "${cmdline}" -K KNOWNBUG)
2224
endmacro(add_test_pl_tests)
2325

2426
add_subdirectory(ansi-c)
@@ -27,6 +29,8 @@ add_subdirectory(cbmc-java)
2729
add_subdirectory(cbmc-java-inheritance)
2830
add_subdirectory(cpp)
2931
add_subdirectory(goto-analyzer)
32+
add_subdirectory(goto-cc-cbmc)
33+
add_subdirectory(goto-cc-goto-analyzer)
3034
add_subdirectory(goto-diff)
3135
add_subdirectory(goto-instrument)
3236
add_subdirectory(goto-instrument-typedef)

regression/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ DIRS = ansi-c \
77
goto-analyzer \
88
goto-cc-cbmc \
99
goto-cc-goto-analyzer \
10-
goto-cc-goto-symex \
1110
goto-diff \
1211
goto-gcc \
1312
goto-instrument \
1413
goto-instrument-typedef \
1514
invariants \
1615
strings \
1716
strings-smoke-tests \
18-
symex \
1917
test-script \
2018
# Empty last line
2119

regression/ansi-c/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
add_test_pl_tests(
2-
"ansi-c"
32
"$<TARGET_FILE:goto-cc>"
43
)

regression/cbmc-cover/branch3/test.desc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ main.c
33
--cover branch --unwind 6
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* .* of .* covered \(100.0%\)$
6+
^\*\* .* of .* covered \(.*\)$
77
--
88
^warning: ignoring
9+
^\[main.coverage.*\] file main.c line .* function main block .* branch .*: FAILED$

regression/cbmc-cover/built-ins1/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
#include <string.h>
2+
13
int main()
24
{
35
char a[10];
46
__CPROVER_input("a[3]", a[3]);
57

6-
int len = strlen(a);
8+
int len=strlen(a);
79

810
if(len==3)
911
{
@@ -13,5 +15,6 @@ int main()
1315
{
1416
return -1;
1517
}
18+
1619
return 1;
1720
}

regression/cbmc-cover/built-ins1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ main.c
33
--cover location --unwind 1
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* 4 of 7 covered
6+
^\*\* 5 of 8 covered
77
--
88
^warning: ignoring
99
^\[.*<builtin-library-

regression/cbmc-cover/built-ins3/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ int main()
55
const char *s="test";
66
int ret=puts(s); //return value is nondet (internal to built-in, thus non-controllable)
77

8+
__CPROVER_input("return value puts", ret);
9+
810
if(ret<0)
911
{
1012
return 1;

regression/cbmc-cover/built-ins3/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ main.c
33
--cover location --unwind 10
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\*\* 4 of 4 covered
6+
^\*\* 5 of .* covered
77
--
88
^warning: ignoring
99
^\[.*<builtin-library-

regression/cbmc-cover/built-ins4/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <string.h>
2+
13
int main()
24
{
35
char a[10];

regression/cbmc-cover/built-ins5/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <string.h>
2+
13
int main()
24
{
35
char a[10];

regression/cbmc-cover/built-ins6/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <string.h>
2+
13
int main()
24
{
35
char a[10];

regression/cbmc-cover/built-ins7/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <string.h>
2+
13
int main()
24
{
35
char a[10];

regression/cbmc-cover/inlining1/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Discussion point: is the branch below one goal or two?
2+
13
inline void my_func(int x)
24
{
35
if(x)

regression/cbmc-cover/inlining1/test.desc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ main.c
33
--cover branch
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\[my_func.coverage.1\] file main.c line 3 function my_func block 1 branch false: SATISFIED$
7-
^\[my_func.coverage.2\] file main.c line 3 function my_func block 1 branch true: FAILED$
8-
^\[my_func.coverage.3\] file main.c line 3 function my_func block 2 branch false: FAILED$
9-
^\[my_func.coverage.4\] file main.c line 3 function my_func block 2 branch true: SATISFIED$
6+
^\[main.coverage.1\] file main.c line 15 function main entry point: SATISFIED$
7+
^\[my_func.coverage.1\] file main.c line 5 function my_func entry point: SATISFIED$
8+
^\[my_func.coverage.2\] file main.c line 5 function my_func block 1 branch false: SATISFIED$
9+
^\[my_func.coverage.3\] file main.c line 5 function my_func block 1 branch true: SATISFIED$
1010
--
1111
^warning: ignoring
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
add_test_pl_tests(
2-
"cbmc-java-inheritance"
32
"$<TARGET_FILE:cbmc>"
43
)

regression/cbmc-java/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
add_test_pl_tests(
2-
"cbmc-java"
32
"$<TARGET_FILE:cbmc>"
43
)

regression/cbmc/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
add_test_pl_tests(
2-
"cbmc"
32
"$<TARGET_FILE:cbmc>"
43
)

regression/cbmc/Free2/test.desc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
CORE
22
main.c
3-
--pointer-check
3+
44
^EXIT=10$
55
^SIGNAL=0$
6+
^.*free argument must be dynamic object: FAILURE$
7+
^.*free argument has offset zero: SUCCESS$
68
^VERIFICATION FAILED$
79
--
810
^warning: ignoring

regression/cbmc/String6/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
#include <assert.h>
22
#include <string.h>
3-
void free(void *);
3+
#include <stdlib.h>
44

55
int main()
66
{
77
char str[500]="Hello";
88

99
assert(strcmp(str, "Hello")==0);
1010
assert(strncmp(str, "Hello", 5)==0);
11+
12+
#ifndef _MSC_VER
1113
assert(strcasecmp(str, "HELLO")==0);
1214
assert(strncasecmp(str, "HELLO", 5)==0);
15+
#endif
16+
1317
assert(strcmp(str, "\xff")<0);
1418
assert(strncmp("ASDxx", "ASDyy", 3)==0);
1519

regression/cbmc/va_list3/main.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include <stdio.h>
2+
#include <stdarg.h>
3+
#include <assert.h>
4+
5+
void foo(int n, ...);
6+
7+
int main()
8+
{
9+
foo(1, 1u);
10+
foo(2, 2l);
11+
foo(3, 3.0);
12+
return 0;
13+
}
14+
15+
void foo(int n, ...)
16+
{
17+
va_list vl;
18+
19+
va_start(vl,n);
20+
21+
switch(n)
22+
{
23+
case 1: assert(va_arg(vl, unsigned)==1); break;
24+
case 2: assert(va_arg(vl, long)==2); break;
25+
case 3: assert(va_arg(vl, double)==3.0); break;
26+
}
27+
28+
va_end(vl);
29+
}

regression/symex-infeasibility/bst-safe/test.desc renamed to regression/cbmc/va_list3/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
KNOWNBUG
22
main.c
33

44
^EXIT=0$

regression/cpp/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
add_test_pl_tests(
2-
"cpp"
32
"$<TARGET_FILE:goto-cc>"
43
)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
add_test_pl_tests(
2-
"goto-analyzer"
32
"$<TARGET_FILE:goto-analyzer>"
43
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if(WIN32)
2+
set(is_windows true)
3+
else()
4+
set(is_windows false)
5+
endif()
6+
7+
add_test_pl_tests(
8+
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:goto-cc> $<TARGET_FILE:cbmc> ${is_windows}"
9+
)

0 commit comments

Comments
 (0)