aboutsummaryrefslogtreecommitdiffstats
path: root/tests/decode
diff options
context:
space:
mode:
authorTimos Ampelikiotis <t.ampelikiotis@virtualopensystems.com>2023-10-10 11:40:56 +0000
committerTimos Ampelikiotis <t.ampelikiotis@virtualopensystems.com>2023-10-10 11:40:56 +0000
commite02cda008591317b1625707ff8e115a4841aa889 (patch)
treeaee302e3cf8b59ec2d32ec481be3d1afddfc8968 /tests/decode
parentcc668e6b7e0ffd8c9d130513d12053cf5eda1d3b (diff)
Introduce Virtio-loopback epsilon release:
Epsilon release introduces a new compatibility layer which make virtio-loopback design to work with QEMU and rust-vmm vhost-user backend without require any changes. Signed-off-by: Timos Ampelikiotis <t.ampelikiotis@virtualopensystems.com> Change-Id: I52e57563e08a7d0bdc002f8e928ee61ba0c53dd9
Diffstat (limited to 'tests/decode')
-rwxr-xr-xtests/decode/check.sh24
-rw-r--r--tests/decode/err_argset1.decode5
-rw-r--r--tests/decode/err_argset2.decode5
-rw-r--r--tests/decode/err_field1.decode5
-rw-r--r--tests/decode/err_field2.decode5
-rw-r--r--tests/decode/err_field3.decode5
-rw-r--r--tests/decode/err_field4.decode6
-rw-r--r--tests/decode/err_field5.decode5
-rw-r--r--tests/decode/err_field6.decode5
-rw-r--r--tests/decode/err_init1.decode6
-rw-r--r--tests/decode/err_init2.decode6
-rw-r--r--tests/decode/err_init3.decode7
-rw-r--r--tests/decode/err_init4.decode7
-rw-r--r--tests/decode/err_overlap1.decode6
-rw-r--r--tests/decode/err_overlap2.decode6
-rw-r--r--tests/decode/err_overlap3.decode6
-rw-r--r--tests/decode/err_overlap4.decode6
-rw-r--r--tests/decode/err_overlap5.decode5
-rw-r--r--tests/decode/err_overlap6.decode6
-rw-r--r--tests/decode/err_overlap7.decode6
-rw-r--r--tests/decode/err_overlap8.decode5
-rw-r--r--tests/decode/err_overlap9.decode6
-rw-r--r--tests/decode/err_pattern_group_empty.decode6
-rw-r--r--tests/decode/err_pattern_group_ident1.decode10
-rw-r--r--tests/decode/err_pattern_group_ident2.decode11
-rw-r--r--tests/decode/err_pattern_group_nest1.decode14
-rw-r--r--tests/decode/err_pattern_group_nest2.decode6
-rw-r--r--tests/decode/err_pattern_group_nest3.decode14
-rw-r--r--tests/decode/err_pattern_group_overlap1.decode6
-rw-r--r--tests/decode/err_width1.decode5
-rw-r--r--tests/decode/err_width2.decode5
-rw-r--r--tests/decode/err_width3.decode5
-rw-r--r--tests/decode/err_width4.decode5
-rw-r--r--tests/decode/succ_argset_type1.decode1
-rw-r--r--tests/decode/succ_function.decode6
-rw-r--r--tests/decode/succ_ident1.decode7
-rw-r--r--tests/decode/succ_pattern_group_nest1.decode22
-rw-r--r--tests/decode/succ_pattern_group_nest2.decode13
-rw-r--r--tests/decode/succ_pattern_group_nest3.decode11
-rw-r--r--tests/decode/succ_pattern_group_nest4.decode13
40 files changed, 303 insertions, 0 deletions
diff --git a/tests/decode/check.sh b/tests/decode/check.sh
new file mode 100755
index 000000000..95445a011
--- /dev/null
+++ b/tests/decode/check.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+PYTHON=$1
+DECODETREE=$2
+E=0
+
+# All of these tests should produce errors
+for i in err_*.decode; do
+ if $PYTHON $DECODETREE $i > /dev/null 2> /dev/null; then
+ # Pass, aka failed to fail.
+ echo FAIL: $i 1>&2
+ E=1
+ fi
+done
+
+for i in succ_*.decode; do
+ if ! $PYTHON $DECODETREE $i > /dev/null 2> /dev/null; then
+ echo FAIL:$i 1>&2
+ fi
+done
+
+exit $E
diff --git a/tests/decode/err_argset1.decode b/tests/decode/err_argset1.decode
new file mode 100644
index 000000000..fcaebcce7
--- /dev/null
+++ b/tests/decode/err_argset1.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose duplicate member names
+&args a a
diff --git a/tests/decode/err_argset2.decode b/tests/decode/err_argset2.decode
new file mode 100644
index 000000000..256b2f9b1
--- /dev/null
+++ b/tests/decode/err_argset2.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose invalid member names
+&args a b c d0 0e
diff --git a/tests/decode/err_field1.decode b/tests/decode/err_field1.decode
new file mode 100644
index 000000000..e07a5a73e
--- /dev/null
+++ b/tests/decode/err_field1.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose invalid field syntax
+%field asdf
diff --git a/tests/decode/err_field2.decode b/tests/decode/err_field2.decode
new file mode 100644
index 000000000..7664a3ebe
--- /dev/null
+++ b/tests/decode/err_field2.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose invalid field width.
+%field 0:33
diff --git a/tests/decode/err_field3.decode b/tests/decode/err_field3.decode
new file mode 100644
index 000000000..87e680f10
--- /dev/null
+++ b/tests/decode/err_field3.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose invalid field position.
+%field 31:2
diff --git a/tests/decode/err_field4.decode b/tests/decode/err_field4.decode
new file mode 100644
index 000000000..888ce4729
--- /dev/null
+++ b/tests/decode/err_field4.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose duplicate field name.
+%field 0:1
+%field 0:1
diff --git a/tests/decode/err_field5.decode b/tests/decode/err_field5.decode
new file mode 100644
index 000000000..b0c62af86
--- /dev/null
+++ b/tests/decode/err_field5.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose duplicate function specifier.
+%field 0:1 !function=a !function=a
diff --git a/tests/decode/err_field6.decode b/tests/decode/err_field6.decode
new file mode 100644
index 000000000..a71988457
--- /dev/null
+++ b/tests/decode/err_field6.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose no bits in field
+%field
diff --git a/tests/decode/err_init1.decode b/tests/decode/err_init1.decode
new file mode 100644
index 000000000..da855bd00
--- /dev/null
+++ b/tests/decode/err_init1.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose uninitialized member in pattern.
+&args a b
+insn 00000000 00000000 00000000 b:8 &args
diff --git a/tests/decode/err_init2.decode b/tests/decode/err_init2.decode
new file mode 100644
index 000000000..b58de3009
--- /dev/null
+++ b/tests/decode/err_init2.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose member initialized twice in pattern.
+&args a b
+insn 00000000 00000000 a:8 b:8 &args a=1
diff --git a/tests/decode/err_init3.decode b/tests/decode/err_init3.decode
new file mode 100644
index 000000000..96790abfd
--- /dev/null
+++ b/tests/decode/err_init3.decode
@@ -0,0 +1,7 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose member initialized twice in pattern + format.
+&args a
+@format ........ ........ a:16 &args
+insn 00000000 00000000 a:16 @format
diff --git a/tests/decode/err_init4.decode b/tests/decode/err_init4.decode
new file mode 100644
index 000000000..4336d4632
--- /dev/null
+++ b/tests/decode/err_init4.decode
@@ -0,0 +1,7 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose uninitialized member in pattern + format.
+&args a b
+@format ........ ........ a:16 &args
+insn 00000000 00000000 ........ ........ @format
diff --git a/tests/decode/err_overlap1.decode b/tests/decode/err_overlap1.decode
new file mode 100644
index 000000000..1ae63472d
--- /dev/null
+++ b/tests/decode/err_overlap1.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose field overlapping fixedbits.
+%field 0:1
+insn 00000000 00000000 00000000 00000000 %field
diff --git a/tests/decode/err_overlap2.decode b/tests/decode/err_overlap2.decode
new file mode 100644
index 000000000..1d6d7a393
--- /dev/null
+++ b/tests/decode/err_overlap2.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose field overlapping fixedbits w/format.
+@format ........ ........ ........ ....... fld:1
+insn 00000000 00000000 00000000 00000000 @format
diff --git a/tests/decode/err_overlap3.decode b/tests/decode/err_overlap3.decode
new file mode 100644
index 000000000..3ab0c4850
--- /dev/null
+++ b/tests/decode/err_overlap3.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose field overlapping unspecified bits.
+%field 0:1
+insn 00000000 00000000 00000000 -------- %field
diff --git a/tests/decode/err_overlap4.decode b/tests/decode/err_overlap4.decode
new file mode 100644
index 000000000..53c5399d3
--- /dev/null
+++ b/tests/decode/err_overlap4.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose fixed bits overlapping unspecified bits.
+@format ........ ........ ........ .......-
+insn 00000000 00000000 00000000 00000000 @format
diff --git a/tests/decode/err_overlap5.decode b/tests/decode/err_overlap5.decode
new file mode 100644
index 000000000..df0e31fff
--- /dev/null
+++ b/tests/decode/err_overlap5.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose overlapping sub-fields.
+%field 3:5 0:5
diff --git a/tests/decode/err_overlap6.decode b/tests/decode/err_overlap6.decode
new file mode 100644
index 000000000..cc69fc8fd
--- /dev/null
+++ b/tests/decode/err_overlap6.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose overlapping fixed bits w/format.
+@format ........ ........ ........ .......1
+insn 00000000 00000000 00000000 00000000 @format
diff --git a/tests/decode/err_overlap7.decode b/tests/decode/err_overlap7.decode
new file mode 100644
index 000000000..6f555295a
--- /dev/null
+++ b/tests/decode/err_overlap7.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose overlapping patterns.
+insn1 00000000 00000000 00000000 00000000
+insn2 00000000 00000000 00000000 00000000
diff --git a/tests/decode/err_overlap8.decode b/tests/decode/err_overlap8.decode
new file mode 100644
index 000000000..df4bae8f1
--- /dev/null
+++ b/tests/decode/err_overlap8.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose not specified bit (. vs -).
+insn 00000000 00000000 00000000 0000000.
diff --git a/tests/decode/err_overlap9.decode b/tests/decode/err_overlap9.decode
new file mode 100644
index 000000000..58b6ac121
--- /dev/null
+++ b/tests/decode/err_overlap9.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose not specified bit (. vs -) w/format.
+@format ........ a:8 ........ b:7 .
+insn 00000000 ........ 00000000 ........ @format
diff --git a/tests/decode/err_pattern_group_empty.decode b/tests/decode/err_pattern_group_empty.decode
new file mode 100644
index 000000000..abbff6b52
--- /dev/null
+++ b/tests/decode/err_pattern_group_empty.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# empty groups are not allowed
+{
+}
diff --git a/tests/decode/err_pattern_group_ident1.decode b/tests/decode/err_pattern_group_ident1.decode
new file mode 100644
index 000000000..3e65fab2f
--- /dev/null
+++ b/tests/decode/err_pattern_group_ident1.decode
@@ -0,0 +1,10 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+%sub1 0:8
+
+# Make sure that indentation is enforced
+{
+ top 00000000 00000000 00000000 00000000
+ sub1 00000000 00000000 00000000 ........ %sub1
+}
diff --git a/tests/decode/err_pattern_group_ident2.decode b/tests/decode/err_pattern_group_ident2.decode
new file mode 100644
index 000000000..bc859233b
--- /dev/null
+++ b/tests/decode/err_pattern_group_ident2.decode
@@ -0,0 +1,11 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+%sub1 0:8
+
+# Make sure that indentation is enforced
+{
+ top 00000000 00000000 00000000 00000000
+ sub1 00000000 00000000 00000000 ........ %sub1
+# comments are suposed to be indented
+}
diff --git a/tests/decode/err_pattern_group_nest1.decode b/tests/decode/err_pattern_group_nest1.decode
new file mode 100644
index 000000000..7d09891a1
--- /dev/null
+++ b/tests/decode/err_pattern_group_nest1.decode
@@ -0,0 +1,14 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+%sub1 0:8
+%sub2 8:8
+
+# Make sure braces are matched
+{
+ top 00000000 00000000 00000000 00000000
+ [
+ sub1 00000000 00000000 00000000 ........ %sub1
+ sub2 00000000 00000000 ........ ........ %sub1 %sub2
+ }
+}
diff --git a/tests/decode/err_pattern_group_nest2.decode b/tests/decode/err_pattern_group_nest2.decode
new file mode 100644
index 000000000..c172239e9
--- /dev/null
+++ b/tests/decode/err_pattern_group_nest2.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Make sure braces are matched
+{
+ [
diff --git a/tests/decode/err_pattern_group_nest3.decode b/tests/decode/err_pattern_group_nest3.decode
new file mode 100644
index 000000000..b085d0141
--- /dev/null
+++ b/tests/decode/err_pattern_group_nest3.decode
@@ -0,0 +1,14 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+%sub1 0:8
+%sub2 8:8
+
+# The exclusive group should error for overlap.
+{
+ top 00000000 00000000 00000000 00000000
+ [
+ sub1 00000000 00000000 00000000 ........ %sub1
+ sub2 00000000 00000000 ........ ........ %sub1 %sub2
+ ]
+}
diff --git a/tests/decode/err_pattern_group_overlap1.decode b/tests/decode/err_pattern_group_overlap1.decode
new file mode 100644
index 000000000..ebe3030d2
--- /dev/null
+++ b/tests/decode/err_pattern_group_overlap1.decode
@@ -0,0 +1,6 @@
+one 00000000000000000000000000000000
+{
+ two 0000000000000000000000000000000 s:1
+ three 000000000000000000000000000000 s:1 0
+}
+
diff --git a/tests/decode/err_width1.decode b/tests/decode/err_width1.decode
new file mode 100644
index 000000000..0c14f6d73
--- /dev/null
+++ b/tests/decode/err_width1.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose too many bits (33 of 32)
+one 000000000000000000000000000000000
diff --git a/tests/decode/err_width2.decode b/tests/decode/err_width2.decode
new file mode 100644
index 000000000..47f0acf32
--- /dev/null
+++ b/tests/decode/err_width2.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose too few bits (31 of 32)
+one 0000000000000000000000000000000
diff --git a/tests/decode/err_width3.decode b/tests/decode/err_width3.decode
new file mode 100644
index 000000000..c5fb6b369
--- /dev/null
+++ b/tests/decode/err_width3.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose too many bits (33 of 32)
+one 0 s:32
diff --git a/tests/decode/err_width4.decode b/tests/decode/err_width4.decode
new file mode 100644
index 000000000..1588a6369
--- /dev/null
+++ b/tests/decode/err_width4.decode
@@ -0,0 +1,5 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Diagnose too few bits (31 of 32)
+one 0 s:30
diff --git a/tests/decode/succ_argset_type1.decode b/tests/decode/succ_argset_type1.decode
new file mode 100644
index 000000000..ed946b420
--- /dev/null
+++ b/tests/decode/succ_argset_type1.decode
@@ -0,0 +1 @@
+&asdf b:bool c:uint64_t a
diff --git a/tests/decode/succ_function.decode b/tests/decode/succ_function.decode
new file mode 100644
index 000000000..7751b1784
--- /dev/null
+++ b/tests/decode/succ_function.decode
@@ -0,0 +1,6 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# "Field" as parameter pulled from DisasContext.
+%foo !function=foo
+foo 00000000000000000000000000000000 %foo
diff --git a/tests/decode/succ_ident1.decode b/tests/decode/succ_ident1.decode
new file mode 100644
index 000000000..f15cfbe14
--- /dev/null
+++ b/tests/decode/succ_ident1.decode
@@ -0,0 +1,7 @@
+%1f 0:8
+%2f 8:8
+%3f 16:8
+
+&3arg a b c
+@3arg ........ ........ ........ ........ &3arg a=%1f b=%2f c=%3f
+3insn 00000000 ........ ........ ........ @3arg
diff --git a/tests/decode/succ_pattern_group_nest1.decode b/tests/decode/succ_pattern_group_nest1.decode
new file mode 100644
index 000000000..77b0f48b4
--- /dev/null
+++ b/tests/decode/succ_pattern_group_nest1.decode
@@ -0,0 +1,22 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+%sub1 0:8
+%sub2 8:8
+%sub3 16:8
+%sub4 24:7
+
+# Make sure deep netsting works, as few targets will actually exercise it
+{
+ top 00000000 00000000 00000000 00000000
+ {
+ sub1 00000000 00000000 00000000 ........ %sub1
+ {
+ sub2 00000000 00000000 ........ ........ %sub1 %sub2
+ {
+ sub3 00000000 ........ ........ ........ %sub1 %sub2 %sub3
+ sub4 0....... ........ ........ ........ %sub1 %sub2 %sub3 %sub4
+ }
+ }
+ }
+}
diff --git a/tests/decode/succ_pattern_group_nest2.decode b/tests/decode/succ_pattern_group_nest2.decode
new file mode 100644
index 000000000..8d5ab4b2d
--- /dev/null
+++ b/tests/decode/succ_pattern_group_nest2.decode
@@ -0,0 +1,13 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+%sub1 0:8
+%sub2 8:8
+%sub3 16:8
+%sub4 24:8
+
+# Group with complete overlap of the two patterns
+{
+ top 00000000 00000000 00000000 00000000
+ sub4 ........ ........ ........ ........ %sub1 %sub2 %sub3 %sub4
+}
diff --git a/tests/decode/succ_pattern_group_nest3.decode b/tests/decode/succ_pattern_group_nest3.decode
new file mode 100644
index 000000000..156249f09
--- /dev/null
+++ b/tests/decode/succ_pattern_group_nest3.decode
@@ -0,0 +1,11 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+{
+ [
+ sub1 00000000 a:8 b:8 c:8
+ sub2 00000001 a:8 b:8 c:8
+ sub3 00000010 a:8 b:8 c:8
+ ]
+ sub4 000000 d:2 a:8 b:8 c:8
+}
diff --git a/tests/decode/succ_pattern_group_nest4.decode b/tests/decode/succ_pattern_group_nest4.decode
new file mode 100644
index 000000000..dc54a1d28
--- /dev/null
+++ b/tests/decode/succ_pattern_group_nest4.decode
@@ -0,0 +1,13 @@
+# This work is licensed under the terms of the GNU LGPL, version 2 or later.
+# See the COPYING.LIB file in the top-level directory.
+
+# Verify deeper nesting, and a single element in the groups.
+{
+ [
+ {
+ [
+ sub1 00000000 a:8 b:8 c:8
+ ]
+ }
+ ]
+}