get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2218253/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2218253,
    "url": "http://patchwork.ozlabs.org/api/patches/2218253/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/kvm-riscv/patch/20260331194202.1722082-4-vipinsh@google.com/",
    "project": {
        "id": 70,
        "url": "http://patchwork.ozlabs.org/api/projects/70/?format=api",
        "name": "Linux KVM RISC-V",
        "link_name": "kvm-riscv",
        "list_id": "kvm-riscv.lists.infradead.org",
        "list_email": "kvm-riscv@lists.infradead.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "http://lists.infradead.org/pipermail/kvm-riscv/",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260331194202.1722082-4-vipinsh@google.com>",
    "list_archive_url": null,
    "date": "2026-03-31T19:41:56",
    "name": "[v4,3/9] KVM: selftests: Add timeout option in selftests runner",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "84b832d252973dacbbde4c14c32463638a42d474",
    "submitter": {
        "id": 86282,
        "url": "http://patchwork.ozlabs.org/api/people/86282/?format=api",
        "name": "Vipin Sharma",
        "email": "vipinsh@google.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/kvm-riscv/patch/20260331194202.1722082-4-vipinsh@google.com/mbox/",
    "series": [
        {
            "id": 498244,
            "url": "http://patchwork.ozlabs.org/api/series/498244/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/kvm-riscv/list/?series=498244",
            "date": "2026-03-31T19:41:53",
            "name": "KVM: selftests: Create KVM selftests runner",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/498244/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218253/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218253/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.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 secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QunV8Wft;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256\n header.s=20251104 header.b=XPQiGqe4;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fldmw74C3z1yGw\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 01 Apr 2026 06:42:23 +1100 (AEDT)",
            "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w7eyk-0000000DUOw-1bLs;\n\tTue, 31 Mar 2026 19:42:22 +0000",
            "from mail-pj1-x1049.google.com ([2607:f8b0:4864:20::1049])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1w7eyh-0000000DUMn-36Vp\n\tfor kvm-riscv@lists.infradead.org;\n\tTue, 31 Mar 2026 19:42:20 +0000",
            "by mail-pj1-x1049.google.com with SMTP id\n 98e67ed59e1d1-35678f99c6eso4452663a91.1\n        for <kvm-riscv@lists.infradead.org>;\n Tue, 31 Mar 2026 12:42:18 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID:\n\tReferences:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Owner;\n\tbh=Y8en7RrU9TKo+wcGtT46H6bZHTSHUsG3Z/zvqdDXL7s=; b=QunV8WftmoM1fY1b13tMqhmjU6\n\t3Z4dMqy/AHG1wH+wgikKuupFOdoJMsa48NB+t93OJiToC/87Jfco4jVNWw3QTYmXSpsVz8g9KevyR\n\t/W9xeVP8YVB0uj3zEAI8hJGygst5xitLDEKh48sPkUeaZ/VOTGnkamTWNAFpNe0QK6yXFX0HJO/x9\n\tfjGnEmEomPbuqcYPKLZkj2C0axysRz7ncXQJ9Nn2eY1/IpCn0hXd4QWtEToQS5nk0JrIEMGTd1PX3\n\tRvzL7V+zXwa2F8yNlHBzcToFEY7Su9J8Nw9laiOC/hct/SgTXX6xCRibgO24hB84UwMxCtpZAcS8H\n\tF2gdk6ww==;",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=google.com; s=20251104; t=1774986138; x=1775590938;\n darn=lists.infradead.org;\n        h=cc:to:from:subject:message-id:references:mime-version:in-reply-to\n         :date:from:to:cc:subject:date:message-id:reply-to;\n        bh=MqTZM8Atvognfn8r5xuaknIcSyhPV2VEo05zIHjpojQ=;\n        b=XPQiGqe4Vn5S8/5MQ8pVFlCl9REO3KTz8FpLFhqpqvj+TXRP8eOwfQTUFlKAAj/ezc\n         95/UthwcMvDAJHgFkqeKHzVk4aMtWFlG46Ln/uFmTCk77pulqDK9nPMK9Ap650sqYD1w\n         9PWeBpDPROfvcgYvfz+d07/Y/oBJML4cD+04Q2jHSN5uObqaUJD8xZUwPJluyYoC5BoB\n         AQpknnzMrsfh4c1xfLB8A9ic2UelZLeD0AWOZHBVpjDpFN2qRfnIR+17GJqdD324Zbxw\n         Od/5y1c82u/MZgkaazYsxbBQ7WW663zkCx+5vkKUsLJx3vft1GNa4MqUpjGjWstVdslW\n         2oDw=="
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1774986138; x=1775590938;\n        h=cc:to:from:subject:message-id:references:mime-version:in-reply-to\n         :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n        bh=MqTZM8Atvognfn8r5xuaknIcSyhPV2VEo05zIHjpojQ=;\n        b=sr48nw3j7Yl7B1QBbmWrtRbO+AI4YmYUAfbCSlLniu1QjxF9KIMxrhzKXBaPbZbun6\n         +h2Q1jgi2H3NBkxp//k7HHNSK9Fsm+bELJ9bTKuAKYlGb0nntlNGawog2iTvEHGOlrxT\n         5bhaLOln9JgjerdEn/v7jzersXfje1E+1v2YA3152cYv4ECQBdr5r35J4zMFRWqvSXiT\n         Gsxqkt1vzNXzuECHBSDY9emZqmiNCQ2A7oFYNjSTZF3QN5dkE0SGQe1wvLixmAAhe5p+\n         yS6jBBOHZFKdTpNc7xRc/jBvnHVKTDiVtSIgm7P8ZcKkN25Pgs3MUxETe5mwXzjyZIC7\n         YJ+w==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCUdOMmyGMMLyXzr1BStnK8MTjyqsn6nqJXl/SYrhLGOH8G0qZMJQv0+22TjSfUiPsZnUYLZ/9zns2E=@lists.infradead.org",
        "X-Gm-Message-State": "AOJu0Yxzg1pxzPi+mwzfJu/ocD3wSSSG6hQZsKRi2Elaalbk4xD4iFMz\n\tGDSvJulTpNzgZ+UFLr5emFlm0bd//uSfTUCLkwwWHOzZtZ2bj3kw9AW7y2idEoDkSG+MI46BDUy\n\t8cHBRICvDsA==",
        "X-Received": "from pjbqi4.prod.google.com ([2002:a17:90b:2744:b0:35b:993f:f936])\n (user=vipinsh job=prod-delivery.src-stubby-dispatcher) by\n 2002:a17:90b:57c4:b0:35c:d37:6024\n with SMTP id 98e67ed59e1d1-35dc6edbfd0mr555200a91.11.1774986138004; Tue, 31\n Mar 2026 12:42:18 -0700 (PDT)",
        "Date": "Tue, 31 Mar 2026 12:41:56 -0700",
        "In-Reply-To": "<20260331194202.1722082-1-vipinsh@google.com>",
        "Mime-Version": "1.0",
        "References": "<20260331194202.1722082-1-vipinsh@google.com>",
        "X-Mailer": "git-send-email 2.53.0.1118.gaef5881109-goog",
        "Message-ID": "<20260331194202.1722082-4-vipinsh@google.com>",
        "Subject": "[PATCH v4 3/9] KVM: selftests: Add timeout option in selftests runner",
        "From": "Vipin Sharma <vipinsh@google.com>",
        "To": "kvm@vger.kernel.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org",
        "Cc": "seanjc@google.com, pbonzini@redhat.com, borntraeger@linux.ibm.com,\n\tfrankja@linux.ibm.com, imbrenda@linux.ibm.com, anup@brainfault.org,\n\tatish.patra@linux.dev, zhaotianrui@loongson.cn, maobibo@loongson.cn,\n\tchenhuacai@kernel.org, maz@kernel.org, oliver.upton@linux.dev,\n\tajones@ventanamicro.com, Vipin Sharma <vipinsh@google.com>",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20260331_124219_784870_A9BB27EF ",
        "X-CRM114-Status": "GOOD (  12.89  )",
        "X-Spam-Score": "-9.5 (---------)",
        "X-Spam-Report": "Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam.  The original\n message has been attached to this so you can view it or label\n similar future email.  If you have any questions, see\n the administrator of that system for details.\n Content preview:  Add a command line argument in KVM selftest runner to limit\n    amount of time (seconds) given to a test for execution. Kill the test if\n   it exceeds the given timeout. Define a new SelftestStatus.TIMED_OUT [...]\n Content analysis details:   (-9.5 points, 5.0 required)\n  pts rule name              description\n ---- ----------------------\n --------------------------------------------------\n -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/, no\n                             trust\n                             [2607:f8b0:4864:20:0:0:0:1049 listed in]\n                             [list.dnswl.org]\n -7.5 USER_IN_DEF_DKIM_WL    From: address is in the default DKIM welcome-list\n  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record\n -0.0 SPF_PASS               SPF: sender matches SPF record\n  0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n not necessarily valid\n -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from\n author's\n                             domain\n -0.1 DKIM_VALID             Message has at least one valid DKIM or DK\n signature\n -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n                             [score: 0.0000]\n -0.0 DKIMWL_WL_MED          DKIMwl.org - Medium trust sender",
        "X-BeenThere": "kvm-riscv@lists.infradead.org",
        "X-Mailman-Version": "2.1.34",
        "Precedence": "list",
        "List-Id": "<kvm-riscv.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/kvm-riscv>,\n <mailto:kvm-riscv-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/kvm-riscv/>",
        "List-Post": "<mailto:kvm-riscv@lists.infradead.org>",
        "List-Help": "<mailto:kvm-riscv-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/kvm-riscv>,\n <mailto:kvm-riscv-request@lists.infradead.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"kvm-riscv\" <kvm-riscv-bounces@lists.infradead.org>",
        "Errors-To": "kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "Add a command line argument in KVM selftest runner to limit amount of\ntime (seconds) given to a test for execution. Kill the test if it\nexceeds the given timeout. Define a new SelftestStatus.TIMED_OUT to\ndenote a selftest final result. Add terminal color for status messages\nof timed out tests.\n\nSet the default value of 120 seconds for all tests.\n\nSigned-off-by: Vipin Sharma <vipinsh@google.com>\n---\n .../testing/selftests/kvm/runner/__main__.py  |  9 +++++-\n .../testing/selftests/kvm/runner/selftest.py  | 29 ++++++++++++-------\n .../selftests/kvm/runner/test_runner.py       |  2 +-\n 3 files changed, 27 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/tools/testing/selftests/kvm/runner/__main__.py b/tools/testing/selftests/kvm/runner/__main__.py\nindex 9b6c78e69c64..82c543d11c34 100644\n--- a/tools/testing/selftests/kvm/runner/__main__.py\n+++ b/tools/testing/selftests/kvm/runner/__main__.py\n@@ -37,6 +37,11 @@ def cli():\n                         default=\".\",\n                         help=\"Finds the test executables in the given path. Default is the current directory.\")\n \n+    parser.add_argument(\"--timeout\",\n+                        default=120,\n+                        type=int,\n+                        help=\"Timeout, in seconds, before runner kills the running test. (Default: 120 seconds)\")\n+\n     return parser.parse_args()\n \n \n@@ -44,6 +49,7 @@ def setup_logging():\n     class TerminalColorFormatter(logging.Formatter):\n         reset = \"\\033[0m\"\n         red_bold = \"\\033[31;1m\"\n+        red = \"\\033[31;1m\"\n         green = \"\\033[32m\"\n         yellow = \"\\033[33m\"\n         blue = \"\\033[34m\"\n@@ -52,7 +58,8 @@ def setup_logging():\n             SelftestStatus.PASSED: green,\n             SelftestStatus.NO_RUN: blue,\n             SelftestStatus.SKIPPED: yellow,\n-            SelftestStatus.FAILED: red_bold\n+            SelftestStatus.FAILED: red_bold,\n+            SelftestStatus.TIMED_OUT: red\n         }\n \n         def __init__(self, fmt=None, datefmt=None):\ndiff --git a/tools/testing/selftests/kvm/runner/selftest.py b/tools/testing/selftests/kvm/runner/selftest.py\nindex c1720897c629..e3924ee40ab3 100644\n--- a/tools/testing/selftests/kvm/runner/selftest.py\n+++ b/tools/testing/selftests/kvm/runner/selftest.py\n@@ -17,6 +17,7 @@ class SelftestStatus(enum.IntEnum):\n     NO_RUN = 22\n     SKIPPED = 23\n     FAILED = 24\n+    TIMED_OUT = 25\n \n     def __str__(self):\n         return str.__str__(self.name)\n@@ -28,7 +29,7 @@ class Selftest:\n     Extract the test execution command from test file and executes it.\n     \"\"\"\n \n-    def __init__(self, test_path, path):\n+    def __init__(self, test_path, path, timeout):\n         test_command = pathlib.Path(test_path).read_text().strip()\n         if not test_command:\n             raise ValueError(\"Empty test command in \" + test_path)\n@@ -37,6 +38,7 @@ class Selftest:\n         self.exists = os.path.isfile(test_command.split(maxsplit=1)[0])\n         self.test_path = test_path\n         self.command = test_command\n+        self.timeout = timeout\n         self.status = SelftestStatus.NO_RUN\n         self.stdout = \"\"\n         self.stderr = \"\"\n@@ -50,17 +52,22 @@ class Selftest:\n             \"universal_newlines\": True,\n             \"shell\": True,\n             \"stdout\": subprocess.PIPE,\n-            \"stderr\": subprocess.PIPE\n+            \"stderr\": subprocess.PIPE,\n+            \"timeout\": self.timeout,\n         }\n-        proc = subprocess.run(self.command, **run_args)\n+        try:\n+            proc = subprocess.run(self.command, **run_args)\n+            out, err = proc.stdout, proc.stderr\n+\n+            if proc.returncode == 0:\n+                self.status = SelftestStatus.PASSED\n+            elif proc.returncode == 4:\n+                self.status = SelftestStatus.SKIPPED\n+            else:\n+                self.status = SelftestStatus.FAILED\n+        except subprocess.TimeoutExpired as e:\n+            self.status = SelftestStatus.TIMED_OUT\n+            out, err = e.stdout, e.stderr\n \n-        out, err = proc.stdout, proc.stderr\n         self.stdout = out.decode(\"utf-8\", \"replace\") if isinstance(out, bytes) else (out or \"\")\n         self.stderr = err.decode(\"utf-8\", \"replace\") if isinstance(err, bytes) else (err or \"\")\n-\n-        if proc.returncode == 0:\n-            self.status = SelftestStatus.PASSED\n-        elif proc.returncode == 4:\n-            self.status = SelftestStatus.SKIPPED\n-        else:\n-            self.status = SelftestStatus.FAILED\ndiff --git a/tools/testing/selftests/kvm/runner/test_runner.py b/tools/testing/selftests/kvm/runner/test_runner.py\nindex acc9fb3dabde..bea82c6239cd 100644\n--- a/tools/testing/selftests/kvm/runner/test_runner.py\n+++ b/tools/testing/selftests/kvm/runner/test_runner.py\n@@ -15,7 +15,7 @@ class TestRunner:\n         self.tests = []\n \n         for testcase in testcases:\n-            self.tests.append(Selftest(testcase, args.path))\n+            self.tests.append(Selftest(testcase, args.path, args.timeout))\n \n     def _log_result(self, test_result):\n         logger.info(\"*** stdout ***\\n\" + test_result.stdout)\n",
    "prefixes": [
        "v4",
        "3/9"
    ]
}