Skip to content

Commit af7124f

Browse files
authored
Merge pull request #4278 from tautschnig/enable-concurrency-tests
Enable cbmc-concurrency regression tests by default
2 parents 5ab4e4a + 78437a1 commit af7124f

File tree

31 files changed

+77
-53
lines changed

31 files changed

+77
-53
lines changed

regression/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ add_subdirectory(goto-analyzer)
2929
add_subdirectory(ansi-c)
3030
add_subdirectory(goto-instrument)
3131
add_subdirectory(cpp)
32+
add_subdirectory(cbmc-concurrency)
3233
add_subdirectory(cbmc-cover)
3334
add_subdirectory(goto-instrument-typedef)
3435
add_subdirectory(smt2_solver)

regression/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ DIRS = cbmc \
77
ansi-c \
88
goto-instrument \
99
cpp \
10+
cbmc-concurrency \
1011
cbmc-cover \
1112
goto-instrument-typedef \
1213
smt2_solver \
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
if((NOT WIN32) AND (NOT APPLE))
2+
add_test_pl_tests(
3+
"$<TARGET_FILE:cbmc>"
4+
)
5+
else()
6+
add_test_pl_tests(
7+
"$<TARGET_FILE:cbmc>"
8+
"cbmc-concurrency"
9+
"$<TARGET_FILE:cbmc>"
10+
"-C;-X;pthread"
11+
"CORE"
12+
)
13+
endif()

regression/cbmc-concurrency/Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
default: tests.log
22

3+
include ../../src/config.inc
4+
include ../../src/common
5+
6+
ifeq ($(filter-out OSX MSVC,$(BUILD_ENV_)),)
7+
# no POSIX threads on Windows
8+
# for OSX we'd need sound handling of pointers in multi-threaded programs
9+
no_pthread = -X pthread
10+
endif
11+
312
test:
4-
@../test.pl -c ../../../src/cbmc/cbmc
13+
@../test.pl -e -p -c ../../../src/cbmc/cbmc $(no_pthread)
514

615
tests.log: ../test.pl
7-
@../test.pl -c ../../../src/cbmc/cbmc
16+
@../test.pl -e -p -c ../../../src/cbmc/cbmc $(no_pthread)
817

918
show:
1019
@for dir in *; do \
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
CORE
22
main.c
33

4-
^EXIT=10$
4+
^EXIT=6$
55
^SIGNAL=0$
6-
^file main.c line 12 function spawn: start_thread in atomic section detected$
6+
^spawning threads out of atomic sections is not allowed
77
--
88
^warning: ignoring

regression/cbmc-concurrency/conditional_spawn1/test.desc

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

44
^EXIT=10$

regression/cbmc-concurrency/deadlock1/test.desc

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

44
^EXIT=0$

regression/cbmc-concurrency/deadlock2/test.desc

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

44
^EXIT=10$

regression/cbmc-concurrency/malloc1/main.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <stdlib.h>
2-
#include <pthread.h>
32

43
#define BUG
54

@@ -13,12 +12,9 @@ void* set_x(void* arg) {
1312
}
1413

1514
int main() {
16-
pthread_t thread;
1715
x = malloc(sizeof(int));
1816
#ifdef BUG
1917
__CPROVER_ASYNC_1: set_x(NULL);
20-
//pthread_create(&thread,NULL,set_x,NULL);
21-
//pthread_join(thread,NULL);
2218
__CPROVER_assume(set_done);
2319
#else
2420
set_x(NULL);

regression/cbmc-concurrency/malloc2/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <stdlib.h>
2-
#include <pthread.h>
32

43
_Bool set_done;
54
int *ptr;

0 commit comments

Comments
 (0)