From patchwork Sat Nov 30 08:46:02 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: 180524 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp2647368ile; Sat, 30 Nov 2019 00:58:15 -0800 (PST) X-Google-Smtp-Source: APXvYqyRfAXX+eLPwmNX4n37Z1YymXY627aVtKwQsoSeotr1R9Y1ReRhlUBnl9Pcu4AfIrfSnV+G X-Received: by 2002:a17:906:340f:: with SMTP id c15mr24646292ejb.197.1575104294992; Sat, 30 Nov 2019 00:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575104294; cv=none; d=google.com; s=arc-20160816; b=Mj+Q12sDp7NfLNKR/gJgsbJBGD2vb1tdtqRdPGKiFqC23PBkqJehHSd/d3pjsK6Gw2 gqN8XwODE0Yo7zUWSD3WXGtQcr1TiqAtedaRtI6UsvXRPZ5MR5Fxh2IPMVQ2sZ47zIIg NPvvY/mQBPipIboLYTU6hjPv7uFSEpreEkt8Bf9u0GS+YRDOqmGqClJV3Mysa8eZ58ZQ Bgn0A9dfeAOU+2qh7iZFJGBfqPTN9HE/3GR36gALCgDuWd3mx9PiXp2800Vyse2yQ9eJ TqfjPxyk2O9/GV179Xa4OFd1E9KU0weFdYS4J/KKy/9vpuVPXME09Pw748vIeLGlyKGQ xSyA== 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=g8CZVSVzqLSBmDkOGmYCT/Q+vIWHPn7LD7otlcWgibtNXw/VKqtND/3vj16BYk80sN vUtjnMXAxt43dKOaVrvcp7dApPNy52ljXb76MrAPNnBhKU0qwd7GUPw+FSDA6liharjb PiHp4yFbjoY/D3+bVJ/JosqpHbahiUYcpDdWdhiQrSWw8gBBPUhtgnFU522jyB5qxzwf c2f4EdNprUc0VnolK5ykaMeDwfY5ZptX3NWKFJgT8ayvVLKV69YZPQzd5ur1BPboZNUw mOf9YdpmiXZyBoGGX+pr8iNu7yyZ+qApFRgS2xWWGiegq3bz3lV8AfJ1glnQ+jcmqWFE UCXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cMp9bfAX; 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 x1si15167443ejd.109.2019.11.30.00.58.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 30 Nov 2019 00:58:14 -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=cMp9bfAX; 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]:38794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iayZx-0000FR-Jk for patch@linaro.org; Sat, 30 Nov 2019 03:58:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59113) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iayWl-0004zh-RU for qemu-devel@nongnu.org; Sat, 30 Nov 2019 03:54:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iayWk-0006b3-8S for qemu-devel@nongnu.org; Sat, 30 Nov 2019 03:54:55 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:36882) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iayWj-0006Zm-VC for qemu-devel@nongnu.org; Sat, 30 Nov 2019 03:54:54 -0500 Received: by mail-wm1-x333.google.com with SMTP id f129so17439228wmf.2 for ; Sat, 30 Nov 2019 00:54:53 -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=cMp9bfAX6rqIB9B9bf2a5nQ3fl7fPyda4CGBOZk4sL64+iVvB5aPrcwwCpm0s7B709 SzTtRU/A9MBvqB0cQeyPrElKy/2MbV+sfE1fLE5642k3h8E3eEccdZeE30KOJJ7U0h8Y 99ME+/AvgCp2IMQ6jtVUhcMdeJVaqVvG103jXmeHPnqB6T4CNX2fgGUHDsZiO562Ihif a1JNty+1bjBKidHVFsbby5RzNVVpxAebVh+Gr7U2dS77vE2XQKGnJJ2TGJQ62ZmuIivh igSCr4khpKw/7U+lahEkCJATRn79Tu4JmPzyVSrJ20dQ/wxa2o0LirT0ravvfIJZUBHR wFBA== 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=UEzyltEne2SNz1by58369Za0/1o0GjcvRfq+QNfM4B7OBm7jAOfeZYIR8KvgB4FH8x TkAcTBIZTUirdEy0Qlw2xyZ30pwDQP1ubXvgIU3hE+euc4PX5QT9jTc+7X8aZccKYkUr T5fA6wiha5CdDipA5D9A6BFwcrm1oBk3gFWfkFe+T/+m1Y8NrlS63gm+GUJQaWXf0t8P Utsji0QXx+p0d8pHn56Hy/GiMg2cW7rXvtVNS7SS3S/A4C4yxdaHF8E9pHswDmZR/1eP bo1Tbx93GmebW9NbE9qpHrnRXF/cVn7QQPzWFHYd2Gh6Pe4g9FqM+bs+u9c30UPYRS4+ afVg== X-Gm-Message-State: APjAAAWOd97HJ4WOdBrd8bdPxXhvGUnNjA14OW+R7gxlmRYxkceO7dUL H9+B/lS/5mXf/f0EcrZr3sQXlw== X-Received: by 2002:a1c:f702:: with SMTP id v2mr18384833wmh.157.1575104092674; Sat, 30 Nov 2019 00:54:52 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s19sm11896968wmc.4.2019.11.30.00.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Nov 2019 00:54:50 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 41F7C1FF9D; Sat, 30 Nov 2019 08:46:06 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 14/14] tests/tcg: add a gdbstub testcase for SVE registers Date: Sat, 30 Nov 2019 08:46:02 +0000 Message-Id: <20191130084602.10818-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191130084602.10818-1-alex.bennee@linaro.org> References: <20191130084602.10818-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::333 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, richard.henderson@linaro.org, "open list:ARM TCG CPUs" , alan.hayward@arm.com, =?utf-8?q?Alex?= =?utf-8?q?_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)