[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/27] tests/decode: Add tests for various named-field cases
|
From: |
Richard Henderson |
|
Subject: |
[PULL 27/27] tests/decode: Add tests for various named-field cases |
|
Date: |
Tue, 30 May 2023 11:59:49 -0700 |
From: Peter Maydell <peter.maydell@linaro.org>
Add some tests for various cases of named-field use, both ones that
should work and ones that should be diagnosed as errors.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230523120447.728365-7-peter.maydell@linaro.org>
---
tests/decode/err_field10.decode | 7 +++++++
tests/decode/err_field7.decode | 7 +++++++
tests/decode/err_field8.decode | 8 ++++++++
tests/decode/err_field9.decode | 14 ++++++++++++++
tests/decode/succ_named_field.decode | 19 +++++++++++++++++++
tests/decode/meson.build | 5 +++++
6 files changed, 60 insertions(+)
create mode 100644 tests/decode/err_field10.decode
create mode 100644 tests/decode/err_field7.decode
create mode 100644 tests/decode/err_field8.decode
create mode 100644 tests/decode/err_field9.decode
create mode 100644 tests/decode/succ_named_field.decode
diff --git a/tests/decode/err_field10.decode b/tests/decode/err_field10.decode
new file mode 100644
index 0000000000..3e672b7459
--- /dev/null
+++ b/tests/decode/err_field10.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 formats which refer to undefined fields
+%field1 field2:3
+@fmt ........ ........ ........ ........ %field1
+insn 00000000 00000000 00000000 00000000 @fmt
diff --git a/tests/decode/err_field7.decode b/tests/decode/err_field7.decode
new file mode 100644
index 0000000000..51fad7ccea
--- /dev/null
+++ b/tests/decode/err_field7.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 fields whose definitions form a loop
+%field1 field2:3
+%field2 field1:4
+insn 00000000 00000000 00000000 00000000 %field1 %field2
diff --git a/tests/decode/err_field8.decode b/tests/decode/err_field8.decode
new file mode 100644
index 0000000000..cc47c08a45
--- /dev/null
+++ b/tests/decode/err_field8.decode
@@ -0,0 +1,8 @@
+# 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 patterns which refer to undefined fields
+&f1 f1 a
+%field1 field2:3
+@fmt ........ ........ ........ .... a:4 &f1
+insn 00000000 00000000 00000000 0000 .... @fmt f1=%field1
diff --git a/tests/decode/err_field9.decode b/tests/decode/err_field9.decode
new file mode 100644
index 0000000000..e7361d521b
--- /dev/null
+++ b/tests/decode/err_field9.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.
+
+# Diagnose fields where the format refers to a field defined in the
+# pattern and the pattern refers to a field defined in the format.
+# This is theoretically not impossible to implement, but is not
+# supported by the script at this time.
+&abcd a b c d
+%refa a:3
+%refc c:4
+# Format defines 'c' and sets 'b' to an indirect ref to 'a'
+@fmt ........ ........ ........ c:8 &abcd b=%refa
+# Pattern defines 'a' and sets 'd' to an indirect ref to 'c'
+insn 00000000 00000000 00000000 ........ @fmt d=%refc a=6
diff --git a/tests/decode/succ_named_field.decode
b/tests/decode/succ_named_field.decode
new file mode 100644
index 0000000000..e64b3f9356
--- /dev/null
+++ b/tests/decode/succ_named_field.decode
@@ -0,0 +1,19 @@
+# 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 using a named_field
+%imm_sz 8:8 sz:3
+insn 00000000 00000000 ........ 00000000 imm_sz=%imm_sz sz=1
+
+# Ditto, via a format. Here a field in the format
+# references a named field defined in the insn pattern:
+&imm_a imm alpha
+%foo 0:16 alpha:4
+@foo 00000001 ........ ........ ........ &imm_a imm=%foo
+i1 ........ 00000000 ........ ........ @foo alpha=1
+i2 ........ 00000001 ........ ........ @foo alpha=2
+
+# Here the named field is defined in the format and referenced
+# from the insn pattern:
+@bar 00000010 ........ ........ ........ &imm_a alpha=4
+i3 ........ 00000000 ........ ........ @bar imm=%foo
diff --git a/tests/decode/meson.build b/tests/decode/meson.build
index b4850562f9..38a0629d67 100644
--- a/tests/decode/meson.build
+++ b/tests/decode/meson.build
@@ -7,6 +7,10 @@ err_tests = [
'err_field4.decode',
'err_field5.decode',
'err_field6.decode',
+ 'err_field7.decode',
+ 'err_field8.decode',
+ 'err_field9.decode',
+ 'err_field10.decode',
'err_init1.decode',
'err_init2.decode',
'err_init3.decode',
@@ -37,6 +41,7 @@ succ_tests = [
'succ_argset_type1.decode',
'succ_function.decode',
'succ_ident1.decode',
+ 'succ_named_field.decode',
'succ_pattern_group_nest1.decode',
'succ_pattern_group_nest2.decode',
'succ_pattern_group_nest3.decode',
--
2.34.1
- [PULL 04/27] qemu/atomic128: Add x86_64 atomic128-ldst.h, (continued)
- [PULL 04/27] qemu/atomic128: Add x86_64 atomic128-ldst.h, Richard Henderson, 2023/05/30
- [PULL 14/27] accel/tcg: Add x86_64 load_atom_extract_al16_or_al8, Richard Henderson, 2023/05/30
- [PULL 17/27] tcg: Remove TCG_TARGET_TLB_DISPLACEMENT_BITS, Richard Henderson, 2023/05/30
- [PULL 21/27] decodetree: Do not remove output_file from /dev, Richard Henderson, 2023/05/30
- [PULL 22/27] tests/decode: Convert tests to meson, Richard Henderson, 2023/05/30
- [PULL 24/27] scripts/decodetree: Pass lvalue-formatter function to str_extract(), Richard Henderson, 2023/05/30
- [PULL 13/27] accel/tcg: Extract store_atom_insert_al16 to host header, Richard Henderson, 2023/05/30
- [PULL 18/27] decodetree: Add --test-for-error, Richard Henderson, 2023/05/30
- [PULL 15/27] accel/tcg: Add aarch64 lse2 load_atom_extract_al16_or_al8, Richard Henderson, 2023/05/30
- [PULL 19/27] decodetree: Fix recursion in prop_format and build_tree, Richard Henderson, 2023/05/30
- [PULL 27/27] tests/decode: Add tests for various named-field cases,
Richard Henderson <=
- [PULL 26/27] scripts/decodetree: Implement named field support, Richard Henderson, 2023/05/30
- [PULL 05/27] tcg/i386: Support 128-bit load/store, Richard Henderson, 2023/05/30
- [PULL 09/27] tcg/aarch64: Support 128-bit load/store, Richard Henderson, 2023/05/30
- [PULL 11/27] tcg/s390x: Support 128-bit load/store, Richard Henderson, 2023/05/30
- [PULL 10/27] tcg/ppc: Support 128-bit load/store, Richard Henderson, 2023/05/30
- [PULL 08/27] tcg/aarch64: Simplify constraints on qemu_ld/st, Richard Henderson, 2023/05/30
- [PULL 07/27] tcg/aarch64: Reserve TCG_REG_TMP1, TCG_REG_TMP2, Richard Henderson, 2023/05/30
- [PULL 16/27] accel/tcg: Add aarch64 store_atom_insert_al16, Richard Henderson, 2023/05/30
- [PULL 12/27] accel/tcg: Extract load_atom_extract_al16_or_al8 to host header, Richard Henderson, 2023/05/30
- [PULL 20/27] decodetree: Diagnose empty pattern group, Richard Henderson, 2023/05/30