qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: damien.hedde@greensocs.com,
	"Peter Maydell" <peter.maydell@linaro.org>,
	luis.machado@linaro.org,
	"open list:ARM TCG CPUs" <qemu-arm@nongnu.org>,
	alan.hayward@arm.com, "Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH v4 19/21] tests/tcg/aarch64: add test-sve-ioctl guest-debug test
Date: Fri, 20 Dec 2019 12:04:36 +0000	[thread overview]
Message-ID: <20191220120438.16114-20-alex.bennee@linaro.org> (raw)
In-Reply-To: <20191220120438.16114-1-alex.bennee@linaro.org>

This test exercises the gdbstub while runing the sve-iotcl test. I
haven't plubmed it into make system as we need a way of verifying if
gdb has the right support for SVE.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
v4
  - interrogate ZCR_EL1 directly as no longer have vg
---
 tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 71 +++++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 tests/tcg/aarch64/gdbstub/test-sve-ioctl.py

diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py
new file mode 100644
index 00000000000..6b6b6c83f2d
--- /dev/null
+++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py
@@ -0,0 +1,71 @@
+from __future__ import print_function
+#
+# Test the SVE ZReg reports the right amount of data. It uses the
+# sve-ioctl test and examines the register data each time the
+# __sve_ld_done breakpoint is hit.
+#
+# This is launched via tests/guest-debug/run-test.py
+#
+
+import gdb
+
+initial_vlen = 0
+failcount = 0
+
+def report(cond, msg):
+    "Report success/fail of test"
+    if cond:
+        print ("PASS: %s" % (msg))
+    else:
+        print ("FAIL: %s" % (msg))
+        global failcount
+        failcount += 1
+
+class TestBreakpoint(gdb.Breakpoint):
+    def __init__(self, sym_name="__sve_ld_done"):
+        super(TestBreakpoint, self).__init__(sym_name)
+        # self.sym, ok = gdb.lookup_symbol(sym_name)
+
+    def stop(self):
+        val_i = gdb.parse_and_eval('i')
+        global initial_vlen
+        for i in range(0, int(val_i)):
+            val_z = gdb.parse_and_eval("$z0.b.u[%d]" % i)
+            report(int(val_z) == i, "z0.b.u[%d] == %d" % (i, i))
+        for i in range(i + 1, initial_vlen):
+            val_z = gdb.parse_and_eval("$z0.b.u[%d]" % i)
+            report(int(val_z) == 0, "z0.b.u[%d] == 0" % (i))
+
+
+def run_test():
+    "Run through the tests one by one"
+
+    print ("Setup breakpoint")
+    bp = TestBreakpoint()
+
+    global initial_vlen
+    vg = gdb.parse_and_eval("$ZCR_EL1")
+    initial_vlen = int(vg) * 16
+
+    gdb.execute("c")
+
+#
+# This runs as the script it sourced (via -x, via run-test.py)
+#
+
+try:
+    # These are not very useful in scripts
+    gdb.execute("set pagination off")
+    gdb.execute("set confirm off")
+
+    # Run the actual tests
+    run_test()
+except:
+    print ("GDB Exception: %s" % (sys.exc_info()[0]))
+    failcount += 1
+    import code
+    code.InteractiveConsole(locals=globals()).interact()
+    raise
+
+print("All tests complete: %d failures" % failcount)
+exit(failcount)
-- 
2.20.1



  parent reply	other threads:[~2019-12-20 12:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 12:04 [PATCH v4 00/21] gdbstub refactor and SVE support (+check-tcg tweaks) Alex Bennée
2019-12-20 12:04 ` [PATCH v4 01/21] gdbstub: make GDBState static and have common init function Alex Bennée
2019-12-20 12:04 ` [PATCH v4 02/21] gdbstub: stop passing GDBState * around and use global Alex Bennée
2019-12-20 12:04 ` [PATCH v4 03/21] gdbstub: move str_buf to GDBState and use GString Alex Bennée
2019-12-20 12:04 ` [PATCH v4 04/21] gdbstub: move mem_buf to GDBState and use GByteArray Alex Bennée
2019-12-20 12:04 ` [PATCH v4 05/21] gdbstub: add helper for 128 bit registers Alex Bennée
2019-12-20 12:04 ` [PATCH v4 06/21] target/arm: use gdb_get_reg helpers Alex Bennée
2019-12-20 12:04 ` [PATCH v4 07/21] target/m68k: " Alex Bennée
2019-12-20 12:04 ` [PATCH v4 08/21] gdbstub: extend GByteArray to read register helpers Alex Bennée
2019-12-20 15:23   ` Damien Hedde
2019-12-20 12:04 ` [PATCH v4 09/21] target/arm: prepare for multiple dynamic XMLs Alex Bennée
2019-12-20 12:04 ` [PATCH v4 10/21] target/arm: explicitly encode regnum in our XML Alex Bennée
2019-12-20 12:04 ` [PATCH v4 11/21] target/arm: default SVE length to 64 bytes for linux-user Alex Bennée
2019-12-20 12:04 ` [PATCH v4 12/21] target/arm: generate xml description of our SVE registers Alex Bennée
2019-12-20 12:04 ` [PATCH v4 13/21] tests/tcg: add a configure compiler check for ARMv8.1 and SVE Alex Bennée
2019-12-20 12:04 ` [PATCH v4 14/21] target/arm: don't bother with id_aa64pfr0_read for USER_ONLY Alex Bennée
2019-12-20 12:04 ` [PATCH v4 15/21] tests/tcg/aarch64: userspace system register test Alex Bennée
2019-12-20 12:04 ` [PATCH v4 16/21] tests/guest-debug: add a simple test runner Alex Bennée
2019-12-20 12:04 ` [PATCH v4 17/21] tests/tcg/aarch64: add a gdbstub testcase for SVE registers Alex Bennée
2019-12-20 12:04 ` [PATCH v4 18/21] tests/tcg/aarch64: add SVE iotcl test Alex Bennée
2019-12-20 12:04 ` Alex Bennée [this message]
2019-12-20 12:04 ` [PATCH v4 20/21] gdbstub: change GDBState.last_packet to GByteArray Alex Bennée
2019-12-20 12:04 ` [PATCH v4 21/21] gdbstub: do not split gdb_monitor_write payload Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191220120438.16114-20-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=alan.hayward@arm.com \
    --cc=damien.hedde@greensocs.com \
    --cc=luis.machado@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).