Skip to content

Commit a8e476e

Browse files
authored
Merge pull request #787 from goblint/cram
Use Cram for tests
2 parents 9eb6bad + d9f5173 commit a8e476e

File tree

14 files changed

+98
-29
lines changed

14 files changed

+98
-29
lines changed

.github/workflows/locked.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ jobs:
5858
- name: Test apron regression (Mukherjee et. al SAS '17 paper') # skipped by default but CI has apron, so explicitly test group (which ignores skipping -- it's now a feature!)
5959
run: ruby scripts/update_suite.rb group apron-mukherjee -s
6060

61+
- name: Test regression cram
62+
run: opam exec -- dune runtest tests/regression
63+
6164
- name: Test unit
6265
run: opam exec -- dune runtest unittest
6366

@@ -101,7 +104,7 @@ jobs:
101104
run: ./make.sh nat
102105

103106
- name: Test extraction
104-
run: cd tests/extraction && ./test.sh
107+
run: opam exec -- dune runtest tests/extraction
105108

106109

107110
gobview:

.github/workflows/unlocked.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ jobs:
8383
if: ${{ matrix.apron }}
8484
run: ruby scripts/update_suite.rb group apron-mukherjee -s
8585

86+
- name: Test regression cram
87+
run: opam exec -- dune runtest tests/regression
88+
8689
- name: Test unit
8790
run: opam exec -- dune runtest unittest
8891

@@ -159,6 +162,9 @@ jobs:
159162
# if: ${{ matrix.apron }}
160163
run: ruby scripts/update_suite.rb group apron-mukherjee -s
161164

165+
- name: Test regression cram
166+
run: opam exec -- dune runtest tests/regression
167+
162168
- name: Test unit
163169
run: opam exec -- dune runtest unittest
164170

dune-project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(lang dune 2.9)
22
; need 2.9 for dune-site to work with opam install: https://github.com/ocaml/dune/issues/4212, https://github.com/ocaml/dune/pull/4645, https://github.com/ocaml/dune/pull/4774
33
(using dune_site 0.1)
4+
(cram enable)
45
(name goblint)
56
; build failed with: Files src/.maingoblint.eobjs/native/mutex.cmx and _opam/lib/ocaml/threads/threads.cmxa both define a module named Mutex
67
; maybe related: https://github.com/ocaml/dune/issues/1727, https://github.com/ocaml/dune/issues/597

tests/extraction/00-sanity.t

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Copy Promela model here.
2+
3+
$ cp -r ../../spin ./spin
4+
5+
Run Goblint extraction.
6+
7+
$ goblint --set ana.activated[+] extract-pthread 00-sanity.c > /dev/null 2>&1
8+
9+
Run spin.
10+
11+
$ (spin -a pml-result/pthread.pml && cc -o pan pan.c && ./pan -a) > out.txt 2>&1
12+
13+
Non-starving, should not have trail.
14+
15+
$ grep pthread.pml.trail out.txt
16+
[1]

tests/extraction/01-base.t

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Copy Promela model here.
2+
3+
$ cp -r ../../spin ./spin
4+
5+
Run Goblint extraction.
6+
7+
$ goblint --set ana.activated[+] extract-pthread 01-base.c > /dev/null 2>&1
8+
9+
Run spin.
10+
11+
$ (spin -a pml-result/pthread.pml && cc -o pan pan.c && ./pan -a) > out.txt 2>&1
12+
13+
Starving, should have trail.
14+
15+
$ grep pthread.pml.trail out.txt
16+
pan: wrote pthread.pml.trail

tests/extraction/02-starve.t

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Copy Promela model here.
2+
3+
$ cp -r ../../spin ./spin
4+
5+
Run Goblint extraction.
6+
7+
$ goblint --set ana.activated[+] extract-pthread 02-starve.c > /dev/null 2>&1
8+
9+
Run spin.
10+
11+
$ (spin -a pml-result/pthread.pml && cc -o pan pan.c && ./pan -a) > out.txt 2>&1
12+
13+
Starving, should have trail.
14+
15+
$ grep pthread.pml.trail out.txt
16+
pan: wrote pthread.pml.trail

tests/extraction/dune

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(cram
2+
(enabled_if %{bin-available:spin})
3+
(deps %{bin:goblint} (package goblint) (glob_files *.c) (source_tree ../../spin))) ; need entire package for includes/

tests/extraction/dune-project

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(lang dune 3.0)
2+
; need 3.0 for bin-available, but cannot use 3.0 for entire project because https://github.com/johnwhitington/ppx_blob/issues/23
3+
; TODO: remove when ppx_blob fixed

tests/extraction/test.sh

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
$ goblint 01-assert.c
2+
[Success][Assert] Assertion "success" will succeed (01-assert.c:10:3-10:28)
3+
[Warning][Assert] Assertion "unknown == 4" is unknown. (01-assert.c:11:3-11:33)
4+
[Error][Assert] Assertion "fail" will fail. (01-assert.c:12:3-12:25)
5+
Live lines: 7
6+
[Warning][Deadcode] Function 'main' has dead code:
7+
on lines 13..14 (01-assert.c:13-14)
8+
Found dead code on 2 lines!
9+
Total lines (logical LoC): 9

0 commit comments

Comments
 (0)