Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2228958/?format=api
{ "id": 2228958, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2228958/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260427150007.1185559-1-peter.maydell@linaro.org/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260427150007.1185559-1-peter.maydell@linaro.org>", "date": "2026-04-27T15:00:07", "name": "tests/qtest: Make qtest_get_arch() cleverer", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d7284222a4cfb50b7b504c4017626c026a732a4d", "submitter": { "id": 5111, "url": "http://patchwork.ozlabs.org/api/1.1/people/5111/?format=api", "name": "Peter Maydell", "email": "peter.maydell@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260427150007.1185559-1-peter.maydell@linaro.org/mbox/", "series": [ { "id": 501667, "url": "http://patchwork.ozlabs.org/api/1.1/series/501667/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501667", "date": "2026-04-27T15:00:07", "name": "tests/qtest: Make qtest_get_arch() cleverer", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501667/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2228958/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2228958/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=f3/jkErn;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g46Fq0jjdz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 01:01:03 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHNRk-00043l-H2; Mon, 27 Apr 2026 11:00:28 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)\n id 1wHNRd-000416-G0\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 11:00:26 -0400", "from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)\n id 1wHNRX-0000og-Pg\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 11:00:19 -0400", "by mail-wm1-x32f.google.com with SMTP id\n 5b1f17b1804b1-48984d29fe3so124411125e9.0\n for <qemu-devel@nongnu.org>; Mon, 27 Apr 2026 08:00:12 -0700 (PDT)", "from lanath.. (wildly.archaic.org.uk. [81.2.115.145])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48a5aa3ae83sm823445235e9.12.2026.04.27.08.00.07\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 27 Apr 2026 08:00:08 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1777302011; x=1777906811; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=81+HmGh6yQsX716mvnoroUOihJ8bUeMg8JRK/QkdGn0=;\n b=f3/jkErnc6i8zymkloaFYclwQEXLdEJ9xF4mWZANVR4zCj+iZGKnAQH1kUxNz79BQe\n d3NnjEXH1S2wY3kmUJ+oDcABSK5406SK/G8543Zqwuh+Q4BHlgwdfo2qswrFU0bZTtKe\n QWaFP/eQrJm+U8LpW6QhuY5WuOYfsGc9A77e/6MyGbF1LvWK4yblOMFIMVTM9SxU0V+u\n cJG/fyu6lvFJu7C4kljCooCKaofKBJKIT3AHB6QnnrjfXrmWios/Q6KJPSNlCBSJW/JB\n +HILT85HAIvv4KgI3/pTa8/7Nql5tkxl08mpGG70GA+XSp0zU3t5A1hPMh8T8THhqxgL\n oU6w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777302011; x=1777906811;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=81+HmGh6yQsX716mvnoroUOihJ8bUeMg8JRK/QkdGn0=;\n b=G/KwZhnJNvfRSH/PSDq8bU9+Cywgc2FZ/L4hiAxDyye35aTIv0WOeUVEkIi+z2V/72\n YDNhKBegucSQ0SgRkKltxNDt0odsw8awvEJy9oPaunRdjS+LK/S0C0GIZUvIOwp0YcBX\n KRNHEjWcbNoUh9DJ0POh8+bAEhLBOLYjumBmpC6ZoLqIDOI0ESjw2VR2caOehglgKK3q\n 3zxAZV62tKwanVUs9LKOCIrPgFLZV+Hdbgq/wxmzbipqNt8EsQh2rOCIscE5CK+TdENZ\n tWBHt5MyXA3TT3C/cbw3Sa/IxzGXVmB8vn6+b73uvmUdYGtTdyIc9LCXGDHn4JIue/tP\n 0fyQ==", "X-Gm-Message-State": "AOJu0YweBQlx6HlpsDj3j59eLh1eyAfSlbu8zkuyOCZt22RXtS4JwRaa\n UmWRNPci2Tqn4GcqoVgGR6UIhn8LnbHh+HpQ3vA3zJniWbu9JEr1g1rQuryU7U2aVhrGtKPAGP8\n 6a715", "X-Gm-Gg": "AeBDietAF4EFqArwPzdgcw/d+jQ4UGzSMWgoodCjb/EpXQ4tcY9fjxeYLMPThPmIKg0\n xJB2Z3uOK/yT2az02N1xO6uGtuYbGcxqGa5qZ4RCJrgxzacikZR7nTU6cJh+2trrDkVbn6jvNMd\n /k6upRYPasgeo5S40bP6h2U4yQePl37vkL1j6arWhEow2wAzqNDqoD3cw7Kk7x5qd/24N8+m/J2\n F6vWH/0WRUWMCMzxp8phb6eeRL4Vx8dfQHP/eu6ipp038nod1ltB1vlBoKJNfaUg1NJv5IpSak7\n ZyolRD+cjIVK07mbufwCSeJ92Cas/b79JdLmckAdqcsAupdrr6Ht8N92xXTHk0Uw4tS2ctu1c8A\n pRUH3H6Nfmx/euWUkuoKUDfSqIhHqDveWdd+j6tm745w5mwBdu4+sTJjyDf8xjfwtVPknDbXD2Z\n P0D3+9Ufk2bhhYKuqZaDS00uUNJp5JtTM//X+iGuUA2JeGKyhDltWb0MlrHvbwMj2jkP6bK3SOd\n HNOjbhV/ygLXs+4nHfjFPIVviRHf2kqfat3Rt+XJQ==", "X-Received": "by 2002:a05:600c:3553:b0:48a:52f2:a0f1 with SMTP id\n 5b1f17b1804b1-48a52f2a5f0mr417298315e9.18.1777302009543;\n Mon, 27 Apr 2026 08:00:09 -0700 (PDT)", "From": "Peter Maydell <peter.maydell@linaro.org>", "To": "qemu-devel@nongnu.org", "Cc": "Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>,\n Paolo Bonzini <pbonzini@redhat.com>", "Subject": "[PATCH] tests/qtest: Make qtest_get_arch() cleverer", "Date": "Mon, 27 Apr 2026 16:00:07 +0100", "Message-ID": "<20260427150007.1185559-1-peter.maydell@linaro.org>", "X-Mailer": "git-send-email 2.43.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2a00:1450:4864:20::32f;\n envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.google.com", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "The qtest_get_arch() function tries to determine the architecture\nunder test by extracting it from the binary name as provided in\nQTEST_QEMU_BINARY. The current logic finds the last '-' in the\nstring and assumes everything beyond it is the architecture name.\nAlthough we also look for the substring \"-system-\", the only effect\nthis check has is that we will exit with an error if it is not\npresent.\n\nBecause the logic at the moment is very simplistic, although\nit is possible to provide more complex commands than a bare\nQEMU binary path, such as:\n QTEST_QEMU_BINARY='rr record ./qemu-system-x86_64'\nit is not possible to provide extra arguments to QEMU, such as:\n QTEST_QEMU_BINARY='./qemu-system-x86_64 -d trace:foo'\n\nBecause the \"-system-\" check and the \"find the architecture\" check\nare not the same, the latter example will pass the \"we found\n-system-\" check and not notice that the \"architecture name\" it has\nfound starts further on in the string; so rather than printing an\nerror it will return \"d trace:foo\" to the test.\n\nImprove the \"find the architecture name\" logic to look for the\nrightmost occurrence of the substring \"-system-\" in\nQTEST_QEMU_BINARY, and take the architecture name as starting there\nand continuing until the first whitespace character or the end of the\nstring.\n\nBecause we now need to potentially modify the environment variable\nstring to terminate the architecture name if it is not the last part\nof the string, we make a copy of it which we cache in a static\nvariable. This lets us avoid having to modify all the callers to get\nthem to take ownership of the returned string.\n\nSigned-off-by: Peter Maydell <peter.maydell@linaro.org>\n---\nI wanted to be able to pass trace arguments to a QEMU to help\ndebug a failing test; in the past I've done this by writing\na little wrapper shell script with the right shaped name, but\nwe can do better than that.\n\n tests/qtest/libqtest.c | 43 +++++++++++++++++++++++++++++-------------\n 1 file changed, 30 insertions(+), 13 deletions(-)", "diff": "diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c\nindex 051faf31e1..116a8a3258 100644\n--- a/tests/qtest/libqtest.c\n+++ b/tests/qtest/libqtest.c\n@@ -1015,22 +1015,39 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...)\n \n const char *qtest_get_arch(void)\n {\n- const char *qemu = qtest_qemu_binary(NULL);\n- const char *end = strrchr(qemu, '-');\n+ /*\n+ * We find and cache the architecture name once, because we need to\n+ * allocate memory to hold it. This memory will stay around for\n+ * the lifetime of this test process.\n+ */\n+ static const char *arch;\n \n- if (!end) {\n- fprintf(stderr, \"Can't determine architecture from binary name.\\n\");\n- exit(1);\n+ if (!arch) {\n+ /*\n+ * Find the rightmost occurrence of \"-system-\"; the architecture\n+ * name runs from there to the next whitespace.\n+ */\n+ const char *qemu = qtest_qemu_binary(NULL);\n+ const char *sysstr = g_strrstr(qemu, \"-system-\");\n+\n+ if (sysstr) {\n+ g_auto(GStrv) tokens = g_strsplit_set(sysstr + strlen(\"-system-\"),\n+ \" \\t\", 2);\n+ if (tokens && tokens[0]) {\n+ arch = g_steal_pointer(&tokens[0]);\n+ }\n+ }\n+\n+ if (!arch) {\n+ fprintf(stderr, \"Can't determine architecture from binary name.\\n\"\n+ \"QTEST_QEMU_BINARY must include *-system-<arch> where \"\n+ \"'arch' is the target architecture \"\n+ \"(x86_64, aarch64, etc).\\n\");\n+ exit(1);\n+ }\n }\n \n- if (!strstr(qemu, \"-system-\")) {\n- fprintf(stderr, \"QTEST_QEMU_BINARY must end with *-system-<arch> \"\n- \"where 'arch' is the target\\narchitecture (x86_64, aarch64, \"\n- \"etc).\\n\");\n- exit(1);\n- }\n-\n- return end + 1;\n+ return arch;\n }\n \n static bool qtest_qom_has_concrete_type(const char *parent_typename,\n", "prefixes": [] }