test: nasm-t -- Add immwarn

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov 2018-11-10 23:07:59 +03:00
parent 752c72e204
commit bfe17213e0
8 changed files with 150 additions and 0 deletions

Binary file not shown.

BIN
travis/test/immwarn-o.bin.t Normal file

Binary file not shown.

View File

@ -0,0 +1,10 @@
./travis/test/immwarn.asm:13: warning: word value exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:21: warning: word value exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:26: warning: signed byte value exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:32: warning: word value exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:37: warning: signed byte value exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:49: warning: signed byte value exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:75: warning: signed dword immediate exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:75: warning: dword data exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:79: warning: signed dword value exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:89: warning: signed byte value exceeds bounds [-w+number-overflow]

Binary file not shown.

91
travis/test/immwarn.asm Normal file
View File

@ -0,0 +1,91 @@
;Testname=onowarn; Arguments=-Ox -DOPT=1 -DWARN=0 -fbin -oimmwarn.bin; Files=stdout stderr immwarn.bin
;Testname=owarn; Arguments=-Ox -DOPT=1 -DWARN=1 -fbin -oimmwarn.bin; Files=stdout stderr immwarn.bin
;Testname=nowarn; Arguments=-O0 -DOPT=0 -DWARN=0 -fbin -oimmwarn.bin; Files=stdout stderr immwarn.bin
;Testname=warn; Arguments=-O0 -DOPT=1 -DWARN=1 -fbin -oimmwarn.bin; Files=stdout stderr immwarn.bin
%ifndef WARN
%define WARN 1
%endif
bits 16
push 1
%if WARN
push 0ffffffffh
%endif
push -1
push 0ffffh
push byte 0FFFFh
add ax,0FFFFh
%if WARN
add ax,0FFFFFFFFh
%endif
add ax,-1
add ax,byte 0FFFFh
%if WARN
add ax,byte 0FFFFFFFFh
%endif
add ax,-1
add cx,0FFFFh
%if WARN
add cx,0FFFFFFFFh
%endif
add cx,-1
add cx,byte 0FFFFh
%if WARN
add cx,byte 0FFFFFFFFh
%endif
add cx,-1
bits 32
push 1
push 0ffffffffh
push -1
push 0ffffh
push byte 1
%if WARN
push byte 0ffffh
%endif
push byte -1
push word 1
push word 0ffffh
push word -1
push dword 1
push dword 0ffffffffh
push dword -1
add eax,0FFFFh
add eax,0FFFFFFFFh
add eax,-1
add ecx,0FFFFh
add ecx,0FFFFFFFFh
add ecx,-1
bits 64
mov eax,7fffffffh
mov eax,80000000h
mov rax,7fffffffh
mov rax,80000000h
%if WARN
mov rax,dword 80000000h
%endif
add rcx,0FFFFh
%if WARN
add rcx,0FFFFFFFFh
%endif
add rcx,-1
add ecx,0FFFFh
add ecx,0FFFFFFFFh
add ecx,-1
push byte 1
%if WARN
push byte 0ffffffffh
%endif
push byte -1

BIN
travis/test/immwarn.bin.t Normal file

Binary file not shown.

38
travis/test/immwarn.json Normal file
View File

@ -0,0 +1,38 @@
[
{
"description": "Test warns on immediate operands (-O0, warn)",
"id": "immwarn",
"format": "bin",
"source": "immwarn.asm",
"option": "-O0 -DOPT=1 -DWARN=1",
"target": [
{ "output": "immwarn.bin" },
{ "stderr": "immwarn.stderr" }
]
},
{
"description": "Test warns on immediate operands (-O0, nowarn)",
"ref": "immwarn",
"option": "-O0 -DOPT=1 -DWARN=0",
"target": [
{ "output": "immwarn-no.bin" }
]
},
{
"description": "Test warns on immediate operands (-Ox, warn)",
"ref": "immwarn",
"option": "-Ox -DOPT=1 -DWARN=1",
"target": [
{ "output": "immwarn-o.bin" },
{ "stderr": "immwarn-o.stderr" }
]
},
{
"description": "Test warns on immediate operands (-Ox, nowarn)",
"ref": "immwarn",
"option": "-Ox -DOPT=1 -DWARN=0",
"target": [
{ "output": "immwarn-ono.bin" }
]
}
]

View File

@ -0,0 +1,11 @@
./travis/test/immwarn.asm:13: warning: word data exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:21: warning: word data exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:26: warning: signed byte value exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:32: warning: word data exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:37: warning: signed byte value exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:49: warning: signed byte value exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:75: warning: signed dword immediate exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:75: warning: dword data exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:79: warning: signed dword immediate exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:79: warning: dword data exceeds bounds [-w+number-overflow]
./travis/test/immwarn.asm:89: warning: signed byte value exceeds bounds [-w+number-overflow]