Skip to content

Commit 1f193b1

Browse files
committed
Update existing memory analyzer regression tests
This adds an updated chain.sh file, and disables the existing regression tests. They currently fail due to two issues: goto code to c conversion currently ignores array sizes (i.e., even int arrays of known sizes are output as int[]), and void pointers are not handled (i.e., analyze_symbol() may try to zero initialize an object of type void, yielding an invariant violation).
1 parent 8e02317 commit 1f193b1

File tree

7 files changed

+36
-72
lines changed

7 files changed

+36
-72
lines changed

regression/memory-analyzer/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ clean:
77

88
test:
99
-@ln -s goto-cc ../../src/goto-cc/goto-gcc
10-
@../test.pl -p -c ../compile_example.sh
10+
@../test.pl -p -c ../chain.sh
1111

1212
tests.log: ../test.pl
1313
-@ln -s goto-cc ../../src/goto-cc/goto-gcc
14-
@../test.pl -p -c ../compile_example.sh
14+
@../test.pl -p -c ../chain.sh
1515

1616
show:
1717
@for dir in *; do \

regression/memory-analyzer/arrays/test.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
FUTURE
22
arrays.exe
33
--breakpoint manipulate_data --symbols test_struct
44
analyzing symbol: test_struct
@@ -20,5 +20,5 @@ GENERATED CODE:
2020
\{ .text=\(char \*\)&_test_struct_childs3_options1_text_5 \} \} \} \} \};
2121
test_struct = &test_struct_0;
2222
\}
23-
--
24-
--
23+
^EXIT=0$
24+
^SIGNAL=0$

regression/memory-analyzer/chain.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
MEMORY_ANALYZER="../../../src/memory-analyzer/memory-analyzer"
4+
5+
set -e
6+
7+
NAME=${*:$#}
8+
NAME=${NAME%.exe}
9+
10+
../../../src/goto-cc/goto-gcc -g -std=c11 -o $NAME.exe $NAME.c
11+
$MEMORY_ANALYZER $@

regression/memory-analyzer/compile_example.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
1-
CORE
1+
FUTURE
22
cycles.exe
33
--breakpoint process_buffer --symbols buffer
4-
analyzing symbol: buffer
5-
GENERATED CODE:
6-
\{
7-
char _buffer_start_data_1\[\]="snow";
8-
char __buffer_start_next_data_3\[\]="sun";
9-
char ___buffer_start_next_next_data_5\[\]="rain";
10-
char ____buffer_start_next_next_next_data_7\[\]="thunder storm";
11-
struct cycle_buffer_entry ___buffer_start_next_next_next_6=\{ .data=\(char \*\)&____buffer_start_next_next_next_data_7, .next=\(\(struct cycle_buffer_entry \*\)NULL\) \};
12-
struct cycle_buffer_entry __buffer_start_next_next_4=\{ .data=\(char \*\)&___buffer_start_next_next_data_5, .next=&___buffer_start_next_next_next_6 \};
13-
struct cycle_buffer_entry _buffer_start_next_2=\{ .data=\(char \*\)&__buffer_start_next_data_3, .next=&__buffer_start_next_next_4 \};
14-
struct cycle_buffer_entry buffer_start_0=\{ .data=\(char \*\)&_buffer_start_data_1, .next=&_buffer_start_next_2 \};
15-
buffer.start = &buffer_start_0;
16-
buffer.end = &___buffer_start_next_next_next_6;
17-
\(\*\(\*\(\*\(\*buffer.start\).next\).next\).next\).next = &buffer_start_0;
18-
\}
19-
--
20-
--
4+
char buffer_start__data_1\[\]="snow";
5+
char buffer_start__next__data_3\[\]="sun";
6+
char buffer_start__next__next__data_5\[\]="rain";
7+
char buffer_start__next__next__next__data_7\[\]="thunder storm";
8+
struct cycle_buffer_entry buffer_start__next__next__next_6\=\{ \.data\=\(char \*\)&buffer_start__next__next__next__data_7, \.next\=\(\(struct cycle_buffer_entry \*\)NULL\) \};
9+
struct cycle_buffer_entry buffer_start__next__next_4\=\{ \.data\=\(char \*\)&buffer_start__next__next__data_5, \.next\=&buffer_start__next__next__next_6 \};
10+
struct cycle_buffer_entry buffer_start__next_2\=\{ \.data\=\(char \*\)&buffer_start__next__data_3, \.next\=&buffer_start__next__next_4 \};
11+
cycle_buffer_entry_t buffer_start_0\=\{ \.data\=\(char \*\)&buffer_start__data_1, \.next\=&buffer_start__next_2 \};
12+
buffer\.start \= &buffer_start_0;
13+
buffer\.end \= &buffer_start__next__next__next_6;
14+
buffer\.start\-\>next\-\>next\-\>next\-\>next \= &buffer_start_0;
15+
^EXIT=0$
16+
^SIGNAL=0$
Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
1-
CORE
1+
FUTURE
22
primitive_types.exe
33
--breakpoint my_function --symbols e,f,f_1,d,g,h
4-
analyzing symbol: e
5-
analyzing symbol: f
6-
analyzing symbol: f_1
7-
analyzing symbol: d
8-
analyzing symbol: g
9-
analyzing symbol: h
10-
GENERATED CODE:
11-
\{
12-
e = 17;
13-
f = &e;
14-
f_1 = &e;
15-
char d_b_0\[\]="test2";
16-
d.a = 4;
17-
d.b = \(char \*\)&d_b_0;
18-
d.c = -32;
19-
struct mapping_things g_1=\{ .a=0, .b=\(\(char \*\)NULL\), .c=0 \};
20-
g = &g_1;
21-
char h_2\[\]="test";
22-
h = \(char \*\)&h_2;
23-
}
24-
^EXIT=0
25-
^SIGNAL=0
26-
--
27-
--
4+
^EXIT=0$
5+
^SIGNAL=0$
Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
CORE
1+
KNOWNBUG
22
void_pointer.exe
33
--breakpoint void_pointer.c:17 --symbols a_void_pointer,a_second_void_pointer,a_third_void_pointer,blob
4-
analyzing symbol: blob
5-
GENERATED CODE:
6-
\{
7-
a_void_pointer = NULL;
8-
char char_a_second_void_pointer_0\[\]="test_string";
9-
a_second_void_pointer = \(char \*\)&char_a_second_void_pointer_0;
10-
char char_a_third_void_pointer_1\[\]=\{ -13, -13, 'H', -1, '\\\\', '\\\\', -1 \};
11-
a_third_void_pointer = \(char \*\)&char_a_third_void_pointer_1;
12-
blob.size = 7;
13-
blob.data = \(char \*\)&char_a_third_void_pointer_1;
14-
\}
15-
--
16-
--
4+
^EXIT=0$
5+
^SIGNAL=0$

0 commit comments

Comments
 (0)