aboutsummaryrefslogtreecommitdiffstats
path: root/travis/test
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-11-10 23:07:59 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2018-11-11 21:43:46 +0300
commitbfe17213e00a8397cf2e94b79ab30d98826c492e (patch)
tree62b0007018745702385becbc1fedf44bfeb823ac /travis/test
parent752c72e204825892c53cfb6af1be465af427c86e (diff)
downloadnasm-bfe17213e00a8397cf2e94b79ab30d98826c492e.tar.gz
nasm-bfe17213e00a8397cf2e94b79ab30d98826c492e.tar.xz
nasm-bfe17213e00a8397cf2e94b79ab30d98826c492e.zip
test: nasm-t -- Add immwarn
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'travis/test')
-rw-r--r--travis/test/immwarn-no.bin.tbin0 -> 188 bytes
-rw-r--r--travis/test/immwarn-o.bin.tbin0 -> 161 bytes
-rw-r--r--travis/test/immwarn-o.stderr10
-rw-r--r--travis/test/immwarn-ono.bin.tbin0 -> 132 bytes
-rw-r--r--travis/test/immwarn.asm91
-rw-r--r--travis/test/immwarn.bin.tbin0 -> 222 bytes
-rw-r--r--travis/test/immwarn.json38
-rw-r--r--travis/test/immwarn.stderr11
8 files changed, 150 insertions, 0 deletions
diff --git a/travis/test/immwarn-no.bin.t b/travis/test/immwarn-no.bin.t
new file mode 100644
index 00000000..3896674e
--- /dev/null
+++ b/travis/test/immwarn-no.bin.t
Binary files differ
diff --git a/travis/test/immwarn-o.bin.t b/travis/test/immwarn-o.bin.t
new file mode 100644
index 00000000..39723cd1
--- /dev/null
+++ b/travis/test/immwarn-o.bin.t
Binary files differ
diff --git a/travis/test/immwarn-o.stderr b/travis/test/immwarn-o.stderr
new file mode 100644
index 00000000..66291360
--- /dev/null
+++ b/travis/test/immwarn-o.stderr
@@ -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] \ No newline at end of file
diff --git a/travis/test/immwarn-ono.bin.t b/travis/test/immwarn-ono.bin.t
new file mode 100644
index 00000000..a1dd76ac
--- /dev/null
+++ b/travis/test/immwarn-ono.bin.t
Binary files differ
diff --git a/travis/test/immwarn.asm b/travis/test/immwarn.asm
new file mode 100644
index 00000000..8bffbfae
--- /dev/null
+++ b/travis/test/immwarn.asm
@@ -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
diff --git a/travis/test/immwarn.bin.t b/travis/test/immwarn.bin.t
new file mode 100644
index 00000000..71d1dc36
--- /dev/null
+++ b/travis/test/immwarn.bin.t
Binary files differ
diff --git a/travis/test/immwarn.json b/travis/test/immwarn.json
new file mode 100644
index 00000000..9a820318
--- /dev/null
+++ b/travis/test/immwarn.json
@@ -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" }
+ ]
+ }
+]
diff --git a/travis/test/immwarn.stderr b/travis/test/immwarn.stderr
new file mode 100644
index 00000000..95f34488
--- /dev/null
+++ b/travis/test/immwarn.stderr
@@ -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] \ No newline at end of file