Skip to content

Commit 12dadf4

Browse files
committed
Wrap ghost_instrumentation in content
1 parent 2c99550 commit 12dadf4

File tree

2 files changed

+64
-60
lines changed

2 files changed

+64
-60
lines changed

src/witness/yamlWitnessType.ml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,15 +566,18 @@ struct
566566
let entry_type = "ghost_instrumentation"
567567

568568
let to_yaml' {ghost_variables; ghost_updates} =
569-
[
570-
("ghost_variables", `A (List.map Variable.to_yaml ghost_variables));
571-
("ghost_updates", `A (List.map LocationUpdate.to_yaml ghost_updates));
569+
[("content",
570+
`O [
571+
("ghost_variables", `A (List.map Variable.to_yaml ghost_variables));
572+
("ghost_updates", `A (List.map LocationUpdate.to_yaml ghost_updates));
573+
])
572574
]
573575

574576
let of_yaml y =
575577
let open GobYaml in
576-
let+ ghost_variables = y |> find "ghost_variables" >>= list >>= list_map Variable.of_yaml
577-
and+ ghost_updates = y |> find "ghost_updates" >>= list >>= list_map LocationUpdate.of_yaml in
578+
let* content = y |> find "content" in
579+
let+ ghost_variables = content |> find "ghost_variables" >>= list >>= list_map Variable.of_yaml
580+
and+ ghost_updates = content |> find "ghost_updates" >>= list >>= list_map LocationUpdate.of_yaml in
578581
{ghost_variables; ghost_updates}
579582
end
580583

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

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -169,61 +169,62 @@ Same with ghost_instrumentation and invariant_set entries.
169169

170170
$ yamlWitnessStrip < witness.yml
171171
- entry_type: ghost_instrumentation
172-
ghost_variables:
173-
- name: m_locked
174-
scope: global
175-
type: int
176-
initial: "0"
177-
- name: multithreaded
178-
scope: global
179-
type: int
180-
initial: "0"
181-
ghost_updates:
182-
- location:
183-
file_name: 74-mutex.c
184-
file_hash: $FILE_HASH
185-
line: 20
186-
column: 5
187-
function: producer
188-
updates:
189-
- variable: m_locked
190-
expression: "1"
191-
- location:
192-
file_name: 74-mutex.c
193-
file_hash: $FILE_HASH
194-
line: 23
195-
column: 5
196-
function: producer
197-
updates:
198-
- variable: m_locked
199-
expression: "0"
200-
- location:
201-
file_name: 74-mutex.c
202-
file_hash: $FILE_HASH
203-
line: 34
204-
column: 3
205-
function: main
206-
updates:
207-
- variable: multithreaded
208-
expression: "1"
209-
- location:
210-
file_name: 74-mutex.c
211-
file_hash: $FILE_HASH
212-
line: 36
213-
column: 3
214-
function: main
215-
updates:
216-
- variable: m_locked
217-
expression: "1"
218-
- location:
219-
file_name: 74-mutex.c
220-
file_hash: $FILE_HASH
221-
line: 38
222-
column: 3
223-
function: main
224-
updates:
225-
- variable: m_locked
226-
expression: "0"
172+
content:
173+
ghost_variables:
174+
- name: m_locked
175+
scope: global
176+
type: int
177+
initial: "0"
178+
- name: multithreaded
179+
scope: global
180+
type: int
181+
initial: "0"
182+
ghost_updates:
183+
- location:
184+
file_name: 74-mutex.c
185+
file_hash: $FILE_HASH
186+
line: 20
187+
column: 5
188+
function: producer
189+
updates:
190+
- variable: m_locked
191+
expression: "1"
192+
- location:
193+
file_name: 74-mutex.c
194+
file_hash: $FILE_HASH
195+
line: 23
196+
column: 5
197+
function: producer
198+
updates:
199+
- variable: m_locked
200+
expression: "0"
201+
- location:
202+
file_name: 74-mutex.c
203+
file_hash: $FILE_HASH
204+
line: 34
205+
column: 3
206+
function: main
207+
updates:
208+
- variable: multithreaded
209+
expression: "1"
210+
- location:
211+
file_name: 74-mutex.c
212+
file_hash: $FILE_HASH
213+
line: 36
214+
column: 3
215+
function: main
216+
updates:
217+
- variable: m_locked
218+
expression: "1"
219+
- location:
220+
file_name: 74-mutex.c
221+
file_hash: $FILE_HASH
222+
line: 38
223+
column: 3
224+
function: main
225+
updates:
226+
- variable: m_locked
227+
expression: "0"
227228
- entry_type: invariant_set
228229
content:
229230
- invariant:

0 commit comments

Comments
 (0)