Skip to content

Commit f03f252

Browse files
committed
Add cram test for vojdani privatization flow-insensitive invariants
1 parent 919731d commit f03f252

File tree

2 files changed

+258
-1
lines changed

2 files changed

+258
-1
lines changed

tests/regression/13-privatized/74-mutex.t

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,102 @@ Same with ghost_instrumentation and invariant_set entries.
277277
value: '! multithreaded || (m_locked || used == 0)'
278278
format: c_expression
279279

280-
Same with mutex-meet.
280+
Same protected invariant with vojdani but no unprotected invariant.
281+
282+
$ goblint --enable ana.sv-comp.functions --set ana.base.privatization vojdani --enable witness.yaml.enabled --set ana.activated[+] mutexGhosts --set witness.yaml.entry-types '["flow_insensitive_invariant", "ghost_instrumentation"]' 74-mutex.c
283+
[Success][Assert] Assertion "used == 0" will succeed (74-mutex.c:37:3-37:29)
284+
[Warning][Deadcode] Function 'producer' has dead code:
285+
on line 26 (74-mutex.c:26-26)
286+
[Warning][Deadcode] Logical lines of code (LLoC) summary:
287+
live: 14
288+
dead: 1
289+
total lines: 15
290+
[Warning][Deadcode][CWE-571] condition '1' (possibly inserted by CIL) is always true (74-mutex.c:19:10-19:11)
291+
[Info][Witness] witness generation summary:
292+
location invariants: 0
293+
loop invariants: 0
294+
flow-insensitive invariants: 1
295+
total generation entries: 2
296+
[Info][Race] Memory locations race summary:
297+
safe: 1
298+
vulnerable: 0
299+
unsafe: 0
300+
total memory locations: 1
301+
302+
$ yamlWitnessStrip < witness.yml
303+
- entry_type: ghost_instrumentation
304+
content:
305+
ghost_variables:
306+
- name: m_locked
307+
scope: global
308+
type: int
309+
initial:
310+
value: "0"
311+
format: c_expression
312+
- name: multithreaded
313+
scope: global
314+
type: int
315+
initial:
316+
value: "0"
317+
format: c_expression
318+
ghost_updates:
319+
- location:
320+
file_name: 74-mutex.c
321+
file_hash: $FILE_HASH
322+
line: 20
323+
column: 5
324+
function: producer
325+
updates:
326+
- variable: m_locked
327+
value: "1"
328+
format: c_expression
329+
- location:
330+
file_name: 74-mutex.c
331+
file_hash: $FILE_HASH
332+
line: 23
333+
column: 5
334+
function: producer
335+
updates:
336+
- variable: m_locked
337+
value: "0"
338+
format: c_expression
339+
- location:
340+
file_name: 74-mutex.c
341+
file_hash: $FILE_HASH
342+
line: 34
343+
column: 3
344+
function: main
345+
updates:
346+
- variable: multithreaded
347+
value: "1"
348+
format: c_expression
349+
- location:
350+
file_name: 74-mutex.c
351+
file_hash: $FILE_HASH
352+
line: 36
353+
column: 3
354+
function: main
355+
updates:
356+
- variable: m_locked
357+
value: "1"
358+
format: c_expression
359+
- location:
360+
file_name: 74-mutex.c
361+
file_hash: $FILE_HASH
362+
line: 38
363+
column: 3
364+
function: main
365+
updates:
366+
- variable: m_locked
367+
value: "0"
368+
format: c_expression
369+
- entry_type: flow_insensitive_invariant
370+
flow_insensitive_invariant:
371+
string: '! multithreaded || (m_locked || used == 0)'
372+
type: assertion
373+
format: C
374+
375+
Same as protection with mutex-meet.
281376

282377
$ goblint --enable ana.sv-comp.functions --set ana.base.privatization mutex-meet --enable witness.yaml.enabled --set ana.activated[+] mutexGhosts --set witness.yaml.entry-types '["flow_insensitive_invariant", "ghost_instrumentation"]' 74-mutex.c
283378
[Success][Assert] Assertion "used == 0" will succeed (74-mutex.c:37:3-37:29)

tests/regression/56-witness/64-ghost-multiple-protecting.t

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,168 @@ protection-read has precise protected invariant for g2.
337337
type: assertion
338338
format: C
339339
340+
$ goblint --set ana.base.privatization vojdani --enable witness.yaml.enabled --set ana.activated[+] mutexGhosts --set witness.yaml.entry-types '["flow_insensitive_invariant", "ghost_instrumentation"]' 64-ghost-multiple-protecting.c
341+
[Info][Deadcode] Logical lines of code (LLoC) summary:
342+
live: 19
343+
dead: 0
344+
total lines: 19
345+
[Info][Witness] witness generation summary:
346+
location invariants: 0
347+
loop invariants: 0
348+
flow-insensitive invariants: 2
349+
total generation entries: 3
350+
[Info][Race] Memory locations race summary:
351+
safe: 2
352+
vulnerable: 0
353+
unsafe: 0
354+
total memory locations: 2
355+
356+
vojdani has precise protected invariant for g2, but no unprotected invariants.
357+
358+
$ yamlWitnessStrip < witness.yml
359+
- entry_type: ghost_instrumentation
360+
content:
361+
ghost_variables:
362+
- name: m1_locked
363+
scope: global
364+
type: int
365+
initial:
366+
value: "0"
367+
format: c_expression
368+
- name: m2_locked
369+
scope: global
370+
type: int
371+
initial:
372+
value: "0"
373+
format: c_expression
374+
- name: multithreaded
375+
scope: global
376+
type: int
377+
initial:
378+
value: "0"
379+
format: c_expression
380+
ghost_updates:
381+
- location:
382+
file_name: 64-ghost-multiple-protecting.c
383+
file_hash: $FILE_HASH
384+
line: 9
385+
column: 3
386+
function: t_fun
387+
updates:
388+
- variable: m1_locked
389+
value: "1"
390+
format: c_expression
391+
- location:
392+
file_name: 64-ghost-multiple-protecting.c
393+
file_hash: $FILE_HASH
394+
line: 10
395+
column: 3
396+
function: t_fun
397+
updates:
398+
- variable: m2_locked
399+
value: "1"
400+
format: c_expression
401+
- location:
402+
file_name: 64-ghost-multiple-protecting.c
403+
file_hash: $FILE_HASH
404+
line: 13
405+
column: 3
406+
function: t_fun
407+
updates:
408+
- variable: m2_locked
409+
value: "0"
410+
format: c_expression
411+
- location:
412+
file_name: 64-ghost-multiple-protecting.c
413+
file_hash: $FILE_HASH
414+
line: 14
415+
column: 3
416+
function: t_fun
417+
updates:
418+
- variable: m1_locked
419+
value: "0"
420+
format: c_expression
421+
- location:
422+
file_name: 64-ghost-multiple-protecting.c
423+
file_hash: $FILE_HASH
424+
line: 16
425+
column: 3
426+
function: t_fun
427+
updates:
428+
- variable: m1_locked
429+
value: "1"
430+
format: c_expression
431+
- location:
432+
file_name: 64-ghost-multiple-protecting.c
433+
file_hash: $FILE_HASH
434+
line: 17
435+
column: 3
436+
function: t_fun
437+
updates:
438+
- variable: m2_locked
439+
value: "1"
440+
format: c_expression
441+
- location:
442+
file_name: 64-ghost-multiple-protecting.c
443+
file_hash: $FILE_HASH
444+
line: 19
445+
column: 3
446+
function: t_fun
447+
updates:
448+
- variable: m2_locked
449+
value: "0"
450+
format: c_expression
451+
- location:
452+
file_name: 64-ghost-multiple-protecting.c
453+
file_hash: $FILE_HASH
454+
line: 20
455+
column: 3
456+
function: t_fun
457+
updates:
458+
- variable: m2_locked
459+
value: "1"
460+
format: c_expression
461+
- location:
462+
file_name: 64-ghost-multiple-protecting.c
463+
file_hash: $FILE_HASH
464+
line: 22
465+
column: 3
466+
function: t_fun
467+
updates:
468+
- variable: m2_locked
469+
value: "0"
470+
format: c_expression
471+
- location:
472+
file_name: 64-ghost-multiple-protecting.c
473+
file_hash: $FILE_HASH
474+
line: 23
475+
column: 3
476+
function: t_fun
477+
updates:
478+
- variable: m1_locked
479+
value: "0"
480+
format: c_expression
481+
- location:
482+
file_name: 64-ghost-multiple-protecting.c
483+
file_hash: $FILE_HASH
484+
line: 29
485+
column: 3
486+
function: main
487+
updates:
488+
- variable: multithreaded
489+
value: "1"
490+
format: c_expression
491+
- entry_type: flow_insensitive_invariant
492+
flow_insensitive_invariant:
493+
string: '! multithreaded || (m2_locked || (m1_locked || g2 == 0))'
494+
type: assertion
495+
format: C
496+
- entry_type: flow_insensitive_invariant
497+
flow_insensitive_invariant:
498+
string: '! multithreaded || (m2_locked || (m1_locked || g1 == 0))'
499+
type: assertion
500+
format: C
501+
340502
$ goblint --set ana.base.privatization mutex-meet --enable witness.yaml.enabled --set ana.activated[+] mutexGhosts --set witness.yaml.entry-types '["flow_insensitive_invariant", "ghost_instrumentation"]' 64-ghost-multiple-protecting.c
341503
[Info][Deadcode] Logical lines of code (LLoC) summary:
342504
live: 19

0 commit comments

Comments
 (0)