Skip to content

Commit d9958f4

Browse files
author
H. Peter Anvin
committed
test/exitrep: test for proper %if and %rep evaluation suppression
If a line is suppressed, the %if or %rep condition must never be evaluated. Test for it, and add the exitrep test to travis. Signed-off-by: H. Peter Anvin (Intel) <[email protected]>
1 parent 2255ebb commit d9958f4

File tree

4 files changed

+67
-3
lines changed

4 files changed

+67
-3
lines changed

test/exitrep.asm

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
%rep %1 4
44
mov eax,i
55
%if i==3
6-
%exitrep
6+
%exitrep
7+
%if bull!shit ; Syntax error if evaluated
8+
nop
9+
%endif
10+
%rep other::bullshit ; Same
11+
nop
12+
%endrep
713
%endif
814
mov ebx,i
9-
%warning in %?%1 iteration i
15+
%note in %?%1 iteration i
1016
%if i >= 3
1117
%error iteration i should not be seen
1218
%endif
@@ -22,7 +28,7 @@
2228
%if i==3
2329
%exitrep
2430
%endif
25-
%warning in %?%1 iteration i
31+
%note in %?%1 iteration i
2632
mov ebx,i
2733
%if i >= 3
2834
%error iteration i should not be seen

travis/test/exitrep.asm

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
%macro testrep 0-1
2+
%assign i 1
3+
%rep %1 4
4+
mov eax,i
5+
%if i==3
6+
%exitrep
7+
%if bull!shit ; Syntax error if evaluated
8+
nop
9+
%endif
10+
%rep other::bullshit ; Same
11+
nop
12+
%endrep
13+
%endif
14+
mov ebx,i
15+
%note in %?%1 iteration i
16+
%if i >= 3
17+
%error iteration i should not be seen
18+
%endif
19+
%assign i i+1
20+
%endrep
21+
ret
22+
%endmacro
23+
24+
%macro testrep_nl 0-1.nolist
25+
%assign i 1
26+
%rep %1 4
27+
mov eax,i
28+
%if i==3
29+
%exitrep
30+
%endif
31+
%note in %?%1 iteration i
32+
mov ebx,i
33+
%if i >= 3
34+
%error iteration i should not be seen
35+
%endif
36+
%assign i i+1
37+
%endrep
38+
ret
39+
%endmacro
40+
41+
42+
testrep
43+
testrep .nolist
44+
45+
testrep_nl
46+
testrep_nl .nolist

travis/test/exitrep.bin.t

124 Bytes
Binary file not shown.

travis/test/exitrep.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"description": "Test %if and %rep suppression after %exitrep",
4+
"id": "exitrep",
5+
"format": "bin",
6+
"source": "exitrep.asm",
7+
"option": "-Ox",
8+
"target": [
9+
{ "output": "exitrep.bin" }
10+
]
11+
}
12+
]

0 commit comments

Comments
 (0)