Skip to content

Commit 211cd21

Browse files
author
thk123
committed
Simplify fp tests now checking the simplified GOTO
Due to high variation in the number of generated goto statements on different platforms, checking specific number simplified is unreliable. This changes the tests to first simplify then spit out the generated GOTO code. This is then checked to check the if statements generated by function pointer removal is removed by the simplify step
1 parent 79a8b9f commit 211cd21

File tree

24 files changed

+172
-80
lines changed

24 files changed

+172
-80
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
default: tests.log
3+
4+
test:
5+
@if ! ../test.pl -c ../chain.sh ; then \
6+
../failed-tests-printer.pl ; \
7+
exit 1; \
8+
fi
9+
10+
tests.log:
11+
@if ! ../test.pl -c ../chain.sh ; then \
12+
../failed-tests-printer.pl ; \
13+
exit 1; \
14+
fi
15+
16+
show:
17+
@for dir in *; do \
18+
if [ -d "$$dir" ]; then \
19+
vim -o "$$dir/*.c" "$$dir/*.out"; \
20+
fi; \
21+
done;
22+
23+
clean:
24+
@for dir in *; do \
25+
rm -f tests.log; \
26+
if [ -d "$$dir" ]; then \
27+
cd "$$dir"; \
28+
rm -f *.out *.gb; \
29+
cd ..; \
30+
fi \
31+
done
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
SRC=../../../src
6+
GA=$SRC/goto-analyzer/goto-analyzer
7+
8+
if [ -a $1_simplified.gb ]
9+
then
10+
rm $1_simplified.gb
11+
fi
12+
$GA $1 --simplify $1_simplified.gb --variable --arrays --structs --pointers
13+
$GA $1_simplified.gb --show-goto-functions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CORE
2+
main.c
3+
4+
^\s*f4\(\);$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^\s*\d+: f1\(\);$
9+
^\s*\d+: f2\(\);$
10+
^\s*\d+: f3\(\);$
11+
^\s*\d+: f5\(\);$
12+
^\s*\d+: f6\(\);$
13+
^\s*\d+: f7\(\);$
14+
^\s*\d+: f8\(\);$
15+
^\s*\d+: f9\(\);$
16+
--
17+
Check the simplified goto program doesn't call any of the other functions (i.e
18+
it has simplified all the unused cases generated by function pointer removal)
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
FUTURE
22
main.c
3-
--simplify out_simplified.gb --variable --arrays --structs --pointers
4-
^Simplified: .* goto: 8
5-
^Unmodified: .* goto: 10
3+
4+
^\s*f3\(\);$
65
^SIGNAL=0$
7-
^EXIT=0$
86
--
97
^warning: ignoring
8+
^\s*\d+: f1\(\);$
9+
^\s*\d+: f2\(\);$
10+
^\s*\d+: f4\(\);$
11+
^\s*\d+: f5\(\);$
12+
^\s*\d+: f6\(\);$
13+
^\s*\d+: f7\(\);$
14+
^\s*\d+: f8\(\);$
15+
^\s*\d+: f9\(\);$
1016
--
1117
Check the GOTOs generated by the function pointer removal are removed by the
1218
simplify step. This requires supporting tracking arrays assigned dynamically
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CORE
2+
main.c
3+
4+
^SIGNAL=0$
5+
^\s*f2\(\);$
6+
--
7+
^warning: ignoring
8+
^\s*\d+: f1\(\);$
9+
^\s*\d+: f3\(\);$
10+
^\s*\d+: f4\(\);$
11+
^\s*\d+: f5\(\);$
12+
^\s*\d+: f6\(\);$
13+
^\s*\d+: f7\(\);$
14+
^\s*\d+: f8\(\);$
15+
^\s*\d+: f9\(\);$
16+
--
17+
Check the GOTOs generated by the function pointer removal are removed by the
18+
simplify step.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FUTURE
2+
main.c
3+
4+
^SIGNAL=0$
5+
^\s*f5\(\);$
6+
--
7+
^warning: ignoring
8+
^\s*\d+: f1\(\);$
9+
^\s*\d+: f2\(\);$
10+
^\s*\d+: f3\(\);$
11+
^\s*\d+: f4\(\);$
12+
^\s*\d+: f6\(\);$
13+
^\s*\d+: f7\(\);$
14+
^\s*\d+: f8\(\);$
15+
^\s*\d+: f9\(\);$
16+
--
17+
Check the GOTOs generated by the function pointer removal are removed by the
18+
simplify step
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FUTURE
2+
main.c
3+
4+
^SIGNAL=0$
5+
^\s*f5\(\);$
6+
--
7+
^warning: ignoring
8+
^\s*\d+: f1\(\);$
9+
^\s*\d+: f2\(\);$
10+
^\s*\d+: f3\(\);$
11+
^\s*\d+: f4\(\);$
12+
^\s*\d+: f6\(\);$
13+
^\s*\d+: f7\(\);$
14+
^\s*\d+: f8\(\);$
15+
^\s*\d+: f9\(\);$
16+
--
17+
Check the GOTOs generated by the function pointer removal are removed by the
18+
simplify step
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CORE
2+
main.c
3+
4+
^SIGNAL=0$
5+
^\s*f3\(\);$
6+
--
7+
^warning: ignoring
8+
^\s*\d+: f1\(\);$
9+
^\s*\d+: f2\(\);$
10+
^\s*\d+: f4\(\);$
11+
^\s*\d+: f5\(\);$
12+
^\s*\d+: f6\(\);$
13+
^\s*\d+: f7\(\);$
14+
^\s*\d+: f8\(\);$
15+
^\s*\d+: f9\(\);$
16+
--
17+
Check the GOTOs generated by the function pointer removal are removed by the
18+
simplify step
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CORE
2+
main.c
3+
4+
^SIGNAL=0$
5+
^\s*f4\(\);$
6+
--
7+
^warning: ignoring
8+
^\s*\d+: f1\(\);$
9+
^\s*\d+: f2\(\);$
10+
^\s*\d+: f3\(\);$
11+
^\s*\d+: f5\(\);$
12+
^\s*\d+: f6\(\);$
13+
^\s*\d+: f7\(\);$
14+
^\s*\d+: f8\(\);$
15+
^\s*\d+: f9\(\);$
16+
--
17+
Check the GOTOs generated by the function pointer removal are removed by the
18+
simplify step

regression/goto-analyzer/simplify-fp-variable-array/test.desc renamed to regression/goto-analyze-show-goto-functions/simplify-fp-variable-array/test.desc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
CORE
22
main.c
3-
--simplify out_simplified.gb --variable --arrays --structs --pointers
4-
^Simplified: .* goto: 3
5-
^Unmodified: .* goto: 15
3+
64
^SIGNAL=0$
7-
^EXIT=0$
5+
^\s*f2\(\);$
86
--
97
^warning: ignoring
8+
^\s*\d+: f1\(\);$
9+
^\s*\d+: f3\(\);$
10+
^\s*\d+: f4\(\);$
11+
^\s*\d+: f5\(\);$
12+
^\s*\d+: f6\(\);$
13+
^\s*\d+: f7\(\);$
14+
^\s*\d+: f8\(\);$
15+
^\s*\d+: f9\(\);$
1016
--
1117
Check the GOTOs generated by the function pointer removal are removed by the
1218
simplify step. The number fo removed goto statements doesn't seem correct,

regression/goto-analyzer/simplify-fp-const-lost/test.desc

Lines changed: 0 additions & 12 deletions
This file was deleted.

regression/goto-analyzer/simplify-fp-fp-param/test.desc

Lines changed: 0 additions & 12 deletions
This file was deleted.

regression/goto-analyzer/simplify-fp-modified-array-pointer-fp/test.desc

Lines changed: 0 additions & 12 deletions
This file was deleted.

regression/goto-analyzer/simplify-fp-modified-array/test.desc

Lines changed: 0 additions & 12 deletions
This file was deleted.

regression/goto-analyzer/simplify-fp-non-const-pointer/test.desc

Lines changed: 0 additions & 12 deletions
This file was deleted.

regression/goto-analyzer/simplify-fp-pointer-fp/test.desc

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)