From patchwork Fri Dec 20 12:04:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 182252 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp447705ilf; Fri, 20 Dec 2019 04:16:31 -0800 (PST) X-Google-Smtp-Source: APXvYqx6hfmtgQH7Xdrl3PZdRFB6lcpSsFK94wa2k4ErzrFT7KhGnoIT9S7iHOhPynMtiDv4t/+/ X-Received: by 2002:a9d:ee2:: with SMTP id 89mr6242937otj.270.1576844190965; Fri, 20 Dec 2019 04:16:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576844190; cv=none; d=google.com; s=arc-20160816; b=ltCuOwjiENsKkNcn9Mceg7Spmnrt7nD76O5japNBxSM/k9Hb9LR8k/LDYC1KksNXUi meWSl6VZLdyi50WVUaYwyxkcZiwN9v7kQ9FE3Zkugg37O0PdJY6ZPXt9SvtmXryTN2Np 5B8S7yYSkpS62i8cR9aS6LzTwm3hL3VkmsZl7E94hefeCwdwhMMlVJojLErtYuGHbS3y wHjtDy6en7ow+2G+Ybrnn7dDSpi2dSfWtw9Tqvk6ijCYgW8nXJv82bMaBSXVHypOfAnp uf7m4QEH4xgSRHb+5li5GO0qhoFuURajWdGmkqB4Dg3dt6vp9173nagHQuWKkejYhPpi Oq1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=0hbLzhNEhCkMRqzYtd3EEZ7EkJxE7ghYQ9NzTVxAhLY=; b=zSc89nwbeab9AMBz8lgIA/ThPCdtLywWy6uucZhGaKRAAWHBDSXbzYf3EyoKbP0AUf ZihGItv85G7uNSH84SaCXCKUIk5mCuThg3/pPd67vNtoFdT8FORnRPR8jKPyDWMG4Idj kJQu4OEix7ORZIZDD+tnvKDJnENvmLC57IjOmv42nrD+zPRR5iIFkC3Iq0rTLL5f0SX8 IG7DgtoqxmPfTp5XYQTEWFdO+B1tG9MPCkB/PYQd7dms2v83KB2npnvCnPLpv9CkmeLI 8IyUB+KleirHhWlpU8KXJDZdXcHBseoSTiIGkLaGa00ZjRW9/kXRvA9dEOEAmcgIfl3N +4vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=A4H6UdB2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j24si2340037otn.110.2019.12.20.04.16.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Dec 2019 04:16:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=A4H6UdB2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiHCn-00039e-RZ for patch@linaro.org; Fri, 20 Dec 2019 07:16:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54274) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iiH1s-00051x-JR for qemu-devel@nongnu.org; Fri, 20 Dec 2019 07:05:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iiH1o-0008Px-Iw for qemu-devel@nongnu.org; Fri, 20 Dec 2019 07:05:11 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:41086) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iiH1o-0008Mv-0o for qemu-devel@nongnu.org; Fri, 20 Dec 2019 07:05:08 -0500 Received: by mail-wr1-x431.google.com with SMTP id c9so9181934wrw.8 for ; Fri, 20 Dec 2019 04:05:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0hbLzhNEhCkMRqzYtd3EEZ7EkJxE7ghYQ9NzTVxAhLY=; b=A4H6UdB2S/92fnWU47nEN9m9Bh7bPxF+RJJFgzvQ4fOYUptOB8ZpYYtR+DmKDQm47l iCMacMxkIhA3qGQiS0J154sHigRiXYwQSI3IgjloX8DCq0ZxnL6Dquh6j2t+t7/vSlkC siLoqhVr1KUINloRsgyCwzzhkVq9ldeHXO/J86PFms6wsBcQ9Zj38QUTCkGgR3u64S4i vN7c+AG6ET+xD6ChpMJB2xhJQxHEs8A7xEfin/iNCt1ulKetW1KwoWAJWhwht9z++vAh wxReIq7I7KnF24EvL/S8/46wHa+pff5kumdlN1Y4b1yG8pTl4H8lEkZMfDqjzsz4bkAR hcZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0hbLzhNEhCkMRqzYtd3EEZ7EkJxE7ghYQ9NzTVxAhLY=; b=GxC8bHC++ShKF+KerpLBQcRQvmNkkrS7AIRaorNpqXB+e8kxE8DQZk7FWerE/k/LqP 3jGTgxefdUi/LjAMlmF4JzdDeGgLvQPlsyMP+wwGh/lhtVqXrfsXjNamibpe5dMquViq d8t9o/D6v94kCAkOqghqzqT2C1Vo9G2qGkbcvElMVu9LYaaq90jyNOcbuYXXupoM3b16 WV/HUAIKtJwV3Bdf4YVCxSPyuIpoxsoEFYJQTH4NvTk1gdzVFS8fxE6Slm9h/bQIevLY dDiwme/Njknbu/HQsbv5Vx9EeHV7qVRbTY8QpL2SaCt7ZpOt8CQY4B+pBj+RIee2K7cR og5g== X-Gm-Message-State: APjAAAWug4kwx70D1ZD5ltvEuH0a7JDyKJ8DmYUC8gcX57cx8s8n6LwG qZCoAd1s3lCto2gbZJRks1y2Cg== X-Received: by 2002:a5d:4651:: with SMTP id j17mr15576168wrs.237.1576843505701; Fri, 20 Dec 2019 04:05:05 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s128sm9713941wme.39.2019.12.20.04.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 04:04:53 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AF5D61FFA5; Fri, 20 Dec 2019 12:04:40 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v4 17/21] tests/tcg/aarch64: add a gdbstub testcase for SVE registers Date: Fri, 20 Dec 2019 12:04:34 +0000 Message-Id: <20191220120438.16114-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191220120438.16114-1-alex.bennee@linaro.org> References: <20191220120438.16114-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: damien.hedde@greensocs.com, Peter Maydell , luis.machado@linaro.org, "open list:ARM TCG CPUs" , alan.hayward@arm.com, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We don't plumb this in yet as there are complications involved with binutils and cross-architectiure debugging but it is one step closer. Example: ./tests/guest-debug/run-test.py \ --qemu ./aarch64-linux-user/qemu-aarch64 \ --qargs "-cpu max" \ --bin ./tests/tcg/aarch64-linux-user/hello \ --test ~/lsrc/qemu.git/tests/tcg/aarch64/gdbstub/test-sve.py \ --gdb /home/alex/src/tools/binutils-gdb.git/install/bin/gdb Signed-off-by: Alex Bennée --- tests/.gitignore | 1 + tests/tcg/aarch64/gdbstub/test-sve.py | 75 +++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 tests/tcg/aarch64/gdbstub/test-sve.py -- 2.20.1 diff --git a/tests/.gitignore b/tests/.gitignore index f9c01708812..8cc428b58bb 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -10,6 +10,7 @@ qht-bench rcutorture test-* !test-*.c +!test-*.py !docker/test-* test-qapi-commands.[ch] include/test-qapi-commands-sub-module.[ch] diff --git a/tests/tcg/aarch64/gdbstub/test-sve.py b/tests/tcg/aarch64/gdbstub/test-sve.py new file mode 100644 index 00000000000..11bc96fc06d --- /dev/null +++ b/tests/tcg/aarch64/gdbstub/test-sve.py @@ -0,0 +1,75 @@ +from __future__ import print_function +# +# Test the SVE registers are visable and changeable via gdbstub +# +# This is launched via tests/guest-debug/run-test.py +# + +import gdb + +MAGIC = 0xDEADBEEF + +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 + +def run_test(): + "Run through the tests one by one" + + gdb.execute("info registers") + report(True, "info registers") + + gdb.execute("info registers vector") + report(True, "info registers vector") + + # Now all the zregs + frame = gdb.selected_frame() + for i in range(0, 32): + rname = "z%d" % (i) + zreg = frame.read_register(rname) + report(True, "Reading %s" % rname) + for j in range(0, 4): + cmd = "set $%s.q.u[%d] = 0x%x" % (rname, j, MAGIC) + gdb.execute(cmd) + report(True, "%s" % cmd) + for j in range(0, 4): + reg = "$%s.q.u[%d]" % (rname, j) + v = gdb.parse_and_eval(reg) + report(str(v.type) == "uint128_t", "size of %s" % (reg)) + for j in range(0, 8): + cmd = "set $%s.d.u[%d] = 0x%x" % (rname, j, MAGIC) + gdb.execute(cmd) + report(True, "%s" % cmd) + for j in range(0, 8): + reg = "$%s.d.u[%d]" % (rname, j) + v = gdb.parse_and_eval(reg) + report(str(v.type) == "uint64_t", "size of %s" % (reg)) + report(int(v) == MAGIC, "%s is 0x%x" % (reg, MAGIC)) + +# +# 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 + +print("All tests complete: %d failures" % failcount) + +# Finally kill the inferior and exit gdb with a count of failures +gdb.execute("kill") +exit(failcount)