get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 818795,
    "url": "http://patchwork.ozlabs.org/api/patches/818795/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170926192142.42308-11-sjg@chromium.org/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170926192142.42308-11-sjg@chromium.org>",
    "list_archive_url": null,
    "date": "2017-09-26T19:21:38",
    "name": "[U-Boot,v2,10/14] log: Add a test command",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "338adf354ace9868af43f8cfba94988b09057b72",
    "submitter": {
        "id": 6170,
        "url": "http://patchwork.ozlabs.org/api/people/6170/?format=api",
        "name": "Simon Glass",
        "email": "sjg@chromium.org"
    },
    "delegate": {
        "id": 3184,
        "url": "http://patchwork.ozlabs.org/api/users/3184/?format=api",
        "username": "sjg",
        "first_name": "Simon",
        "last_name": "Glass",
        "email": "sjg@chromium.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170926192142.42308-11-sjg@chromium.org/mbox/",
    "series": [
        {
            "id": 5217,
            "url": "http://patchwork.ozlabs.org/api/series/5217/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=5217",
            "date": "2017-09-26T19:21:28",
            "name": "log: Add a new logging feature",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/5217/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/818795/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/818795/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"eW1Mcicm\"; dkim-atps=neutral"
        ],
        "Received": [
            "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3y1rZf3ZJZz9t3F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 05:27:54 +1000 (AEST)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid 166A8C21F50; Tue, 26 Sep 2017 19:24:31 +0000 (UTC)",
            "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 75E47C21EDD;\n\tTue, 26 Sep 2017 19:22:55 +0000 (UTC)",
            "by lists.denx.de (Postfix, from userid 105)\n\tid 8FFC8C21EDD; Tue, 26 Sep 2017 19:22:30 +0000 (UTC)",
            "from mail-oi0-f48.google.com (mail-oi0-f48.google.com\n\t[209.85.218.48])\n\tby lists.denx.de (Postfix) with ESMTPS id A8F08C21F38\n\tfor <u-boot@lists.denx.de>; Tue, 26 Sep 2017 19:22:26 +0000 (UTC)",
            "by mail-oi0-f48.google.com with SMTP id a74so13453753oib.3\n\tfor <u-boot@lists.denx.de>; Tue, 26 Sep 2017 12:22:26 -0700 (PDT)",
            "from kiwi.bld.corp.google.com ([100.101.164.89])\n\tby smtp.gmail.com with ESMTPSA id\n\te8sm16833334oic.7.2017.09.26.12.22.21\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 26 Sep 2017 12:22:24 -0700 (PDT)",
            "by kiwi.bld.corp.google.com (Postfix, from userid 121222)\n\tid 07311140573; Tue, 26 Sep 2017 13:22:21 -0600 (MDT)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H2,\n\tT_DKIM_INVALID autolearn=unavailable autolearn_force=no\n\tversion=3.4.0",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=20161025; \n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=pqixxgFoZl/0e0K/Z2o1LM6YBmLbTTCLKbCMH362G04=;\n\tb=eW1Mcicm8aXgTeToE2hwx42+QHZZAhVWKROS/52R/JQXtObAVvpBCNfmirsvj8ctOI\n\tww3RcTSP4zDkZYsLDtm7dXA52Qh6Hky+kVtZklYFdy8pHfpxrVwQT7xZYM5F7GW50DMi\n\tbQP+WnvXOc5WvFTIm0Xee6Chgo2Hft27SXgPw/4dtArwH76p5YHhZeHt956ym/maQOm+\n\t8c6Z7pXVer4fP73YZklmo1rHEzTnh9x/3aVpV3Q1P7IhwmSU9OajUKnUG+7RiO9HzAhv\n\tpdLXT2NaqfOKV7Jq+AWWPua++oLAgFgt3R9AM3dQISKIz7V5GG+BFOXAmeRAJy5O+cHH\n\t86cg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references;\n\tbh=pqixxgFoZl/0e0K/Z2o1LM6YBmLbTTCLKbCMH362G04=;\n\tb=LJAxJEp/3bWfg1gqyhBXho5ILnXjwsBNDyNdrrUJUurm4GVygJE3DbV8YXEGXj4dNG\n\tY9EpUyRptoUxaaXPrs2alZrV0MvH9WIopOAWhG0WmUGjWYQUlvr0xo1PIxU7ZvA2Yw9R\n\t3XS4k6x5cTgWCijadhOT/ehe2NrDV1djLnXN5qyjtW65OAwONUS2LNqRnXlCO2SVHxuX\n\tB4v8qcB+QdowTWJHuhce1z8MXJ4yohVaByfU3ZSugQN66nE2A3EgXVBl+4Gq7amO5kFc\n\t0RevpBrmGoux+ArJvl3y60rBmCVzCQqNNHk7fWkON4NgEC8iTLunHjEk+P72oqrq7Cf0\n\tWE7g==",
        "X-Gm-Message-State": "AHPjjUhVG2RhBbeNUgC6s8QXsAUq9U1ea6dcjL3L5QYlykjp1QQECMm/\n\tiNyvSY82+9nFQOF2aC59ZQ5j4Q==",
        "X-Google-Smtp-Source": "AOwi7QCgBiE4GM5GyAmHTLYJhOLdGFhS5NCoxmSWk+dDQdB48VDw0ejOtbxqnm5q5RdPO0jHY2UkPA==",
        "X-Received": "by 10.157.87.71 with SMTP id x7mr2917496oti.90.1506453745155;\n\tTue, 26 Sep 2017 12:22:25 -0700 (PDT)",
        "From": "Simon Glass <sjg@chromium.org>",
        "To": "U-Boot Mailing List <u-boot@lists.denx.de>",
        "Date": "Tue, 26 Sep 2017 13:21:38 -0600",
        "Message-Id": "<20170926192142.42308-11-sjg@chromium.org>",
        "X-Mailer": "git-send-email 2.14.1.992.g2c7b836f3a-goog",
        "In-Reply-To": "<20170926192142.42308-1-sjg@chromium.org>",
        "References": "<20170926192142.42308-1-sjg@chromium.org>",
        "Cc": "Tom Rini <trini@konsulko.com>",
        "Subject": "[U-Boot] [PATCH v2 10/14] log: Add a test command",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.18",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>"
    },
    "content": "Add a command which exercises the logging system.\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\nChanges in v2:\n- Fix function called when test command is selected\n- Fix help output for 'log test'\n- Rename LOGL_WARN to LOGL_WARNING\n\n MAINTAINERS         |   1 +\n cmd/Kconfig         |   3 +-\n cmd/log.c           |   6 ++\n common/Kconfig      |  10 +++\n include/log.h       |   3 +\n test/Makefile       |   1 +\n test/log/Makefile   |   7 ++\n test/log/log_test.c | 204 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n 8 files changed, 234 insertions(+), 1 deletion(-)\n create mode 100644 test/log/Makefile\n create mode 100644 test/log/log_test.c",
    "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex 3ef97783c0..ca5224341e 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -296,6 +296,7 @@ S:\tMaintained\n T:\tgit git://git.denx.de/u-boot.git\n F:\tcommon/log.c\n F:\tcmd/log.c\n+F:\ttest/log/log_test.c\n \n MICROBLAZE\n M:\tMichal Simek <monstr@monstr.eu>\ndiff --git a/cmd/Kconfig b/cmd/Kconfig\nindex 702d4f251f..9d52e4fecc 100644\n--- a/cmd/Kconfig\n+++ b/cmd/Kconfig\n@@ -1483,7 +1483,8 @@ config CMD_LOG\n \thelp\n \t  This provides access to logging features. It allows the output of\n \t  log data to be controlled to a limited extent (setting up the default\n-\t  maximum log level for emitting of records).\n+\t  maximum log level for emitting of records). It also provides access\n+\t  to a command used for testing the log system.\n \n config CMD_TRACE\n \tbool \"trace - Support tracing of function calls and timing\"\ndiff --git a/cmd/log.c b/cmd/log.c\nindex 44e04ab16a..abc523b497 100644\n--- a/cmd/log.c\n+++ b/cmd/log.c\n@@ -23,6 +23,9 @@ static int do_log_level(cmd_tbl_t *cmdtp, int flag, int argc,\n \n static cmd_tbl_t log_sub[] = {\n \tU_BOOT_CMD_MKENT(level, CONFIG_SYS_MAXARGS, 1, do_log_level, \"\", \"\"),\n+#ifdef CONFIG_LOG_TEST\n+\tU_BOOT_CMD_MKENT(test, 2, 1, do_log_test, \"\", \"\"),\n+#endif\n };\n \n static int do_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])\n@@ -46,6 +49,9 @@ static int do_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])\n #ifdef CONFIG_SYS_LONGHELP\n static char log_help_text[] =\n \t\"level - get/set log level\\n\"\n+#ifdef CONFIG_LOG_TEST\n+\t\"log test - run log tests\\n\"\n+#endif\n \t;\n #endif\n \ndiff --git a/common/Kconfig b/common/Kconfig\nindex 7fed04a5fb..55d73ad71f 100644\n--- a/common/Kconfig\n+++ b/common/Kconfig\n@@ -456,6 +456,16 @@ config LOG_SPL_CONSOLE\n \t  log message is shown - other details like level, category, file and\n \t  line number are omitted.\n \n+config LOG_TEST\n+\tbool \"Provide a test for logging\"\n+\tdepends on LOG\n+\tdefault y if SANDBOX\n+\thelp\n+\t  This enables a 'log test' command to test logging. It is normally\n+\t  executed from a pytest and simply outputs logging information\n+\t  in various different ways to test that the logging system works\n+\t  correctly with varoius settings.\n+\n endmenu\n \n config DTB_RESELECT\ndiff --git a/include/log.h b/include/log.h\nindex 9488adc8cb..7f2e84a68b 100644\n--- a/include/log.h\n+++ b/include/log.h\n@@ -268,6 +268,9 @@ struct log_filter {\n #define LOG_DRIVER(_name) \\\n \tll_entry_declare(struct log_driver, _name, log_driver)\n \n+/* Handle the 'log test' command */\n+int do_log_test(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);\n+\n /**\n  * log_add_filter() - Add a new filter to a log device\n  *\ndiff --git a/test/Makefile b/test/Makefile\nindex 6305afb211..40f2244b79 100644\n--- a/test/Makefile\n+++ b/test/Makefile\n@@ -10,3 +10,4 @@ obj-$(CONFIG_SANDBOX) += command_ut.o\n obj-$(CONFIG_SANDBOX) += compression.o\n obj-$(CONFIG_SANDBOX) += print_ut.o\n obj-$(CONFIG_UT_TIME) += time_ut.o\n+obj-$(CONFIG_$(SPL_)LOG) += log/\ndiff --git a/test/log/Makefile b/test/log/Makefile\nnew file mode 100644\nindex 0000000000..b0da8dee28\n--- /dev/null\n+++ b/test/log/Makefile\n@@ -0,0 +1,7 @@\n+#\n+# Copyright (c) 2017 Google, Inc\n+#\n+# SPDX-License-Identifier:\tGPL-2.0+\n+#\n+\n+obj-$(CONFIG_LOG_TEST) += log_test.o\ndiff --git a/test/log/log_test.c b/test/log/log_test.c\nnew file mode 100644\nindex 0000000000..29bfe772f2\n--- /dev/null\n+++ b/test/log/log_test.c\n@@ -0,0 +1,204 @@\n+/*\n+ * Logging support test program\n+ *\n+ * Copyright (c) 2017 Google, Inc\n+ * Written by Simon Glass <sjg@chromium.org>\n+ *\n+ * SPDX-License-Identifier:\tGPL-2.0+\n+ */\n+\n+#include <common.h>\n+\n+/* emit some sample log records in different ways, for testing */\n+static int log_run(enum log_category_t cat, const char *file)\n+{\n+\tint i;\n+\n+\tdebug(\"debug\\n\");\n+\terror(\"error\\n\");\n+\tfor (i = LOGL_FIRST; i < LOGL_COUNT; i++) {\n+\t\tlog(cat, i, \"log %d\\n\", i);\n+\t\t_log(cat, i, file, 100 + i, \"func\", \"_log %d\\n\", i);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int log_test(int testnum)\n+{\n+\tint ret;\n+\n+\tprintf(\"test %d\\n\", testnum);\n+\tswitch (testnum) {\n+\tcase 0: {\n+\t\t/* Check a category filter using the first category */\n+\t\tenum log_category_t cat_list[] = {\n+\t\t\tUCLASS_MMC, UCLASS_SPI, LOGC_NONE, LOGC_END\n+\t\t};\n+\n+\t\tret = log_add_filter(\"console\", cat_list, LOGL_MAX, NULL);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tlog_run(UCLASS_MMC, \"file\");\n+\t\tret = log_remove_filter(\"console\", ret);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\tcase 1: {\n+\t\t/* Check a category filter using the second category */\n+\t\tenum log_category_t cat_list[] = {\n+\t\t\tUCLASS_MMC, UCLASS_SPI, LOGC_END\n+\t\t};\n+\n+\t\tret = log_add_filter(\"console\", cat_list, LOGL_MAX, NULL);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tlog_run(UCLASS_SPI, \"file\");\n+\t\tret = log_remove_filter(\"console\", ret);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\tcase 2: {\n+\t\t/* Check a category filter that should block log entries */\n+\t\tenum log_category_t cat_list[] = {\n+\t\t\tUCLASS_MMC,  LOGC_NONE, LOGC_END\n+\t\t};\n+\n+\t\tret = log_add_filter(\"console\", cat_list, LOGL_MAX, NULL);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tlog_run(UCLASS_SPI, \"file\");\n+\t\tret = log_remove_filter(\"console\", ret);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\tcase 3: {\n+\t\t/* Check a passing file filter */\n+\t\tret = log_add_filter(\"console\", NULL, LOGL_MAX, \"file\");\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tlog_run(UCLASS_SPI, \"file\");\n+\t\tret = log_remove_filter(\"console\", ret);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\tcase 4: {\n+\t\t/* Check a failing file filter */\n+\t\tret = log_add_filter(\"console\", NULL, LOGL_MAX, \"file\");\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tlog_run(UCLASS_SPI, \"file2\");\n+\t\tret = log_remove_filter(\"console\", ret);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\tcase 5: {\n+\t\t/* Check a passing file filter (second in list) */\n+\t\tret = log_add_filter(\"console\", NULL, LOGL_MAX, \"file,file2\");\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tlog_run(UCLASS_SPI, \"file2\");\n+\t\tret = log_remove_filter(\"console\", ret);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\tcase 6: {\n+\t\t/* Check a passing file filter (also passing error()) */\n+\t\tret = log_add_filter(\"console\", NULL, LOGL_MAX,\n+\t\t\t\t     \"file,file2,log/log_test.c\");\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tlog_run(UCLASS_SPI, \"file2\");\n+\t\tret = log_remove_filter(\"console\", ret);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\tcase 7: {\n+\t\t/* Check a log level filter */\n+\t\tret = log_add_filter(\"console\", NULL, LOGL_WARNING, NULL);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tlog_run(UCLASS_SPI, \"file\");\n+\t\tret = log_remove_filter(\"console\", ret);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\tcase 8: {\n+\t\t/* Check two filters, one of which passes everything */\n+\t\tint filt1, filt2;\n+\n+\t\tret = log_add_filter(\"console\", NULL, LOGL_WARNING, NULL);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tfilt1 = ret;\n+\t\tret = log_add_filter(\"console\", NULL, LOGL_MAX, NULL);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tfilt2 = ret;\n+\t\tlog_run(UCLASS_SPI, \"file\");\n+\t\tret = log_remove_filter(\"console\", filt1);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tret = log_remove_filter(\"console\", filt2);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\tcase 9: {\n+\t\t/* Check three filters, which together pass everything */\n+\t\tint filt1, filt2, filt3;\n+\n+\t\tret = log_add_filter(\"console\", NULL, LOGL_MAX, \"file)\");\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tfilt1 = ret;\n+\t\tret = log_add_filter(\"console\", NULL, LOGL_MAX, \"file2\");\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tfilt2 = ret;\n+\t\tret = log_add_filter(\"console\", NULL, LOGL_MAX,\n+\t\t\t\t     \"log/log_test.c\");\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tfilt3 = ret;\n+\t\tlog_run(UCLASS_SPI, \"file2\");\n+\t\tret = log_remove_filter(\"console\", filt1);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tret = log_remove_filter(\"console\", filt2);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tret = log_remove_filter(\"console\", filt3);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+#ifdef CONFIG_LOG_TEST\n+int do_log_test(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])\n+{\n+\tint testnum = 0;\n+\tint ret;\n+\n+\tif (argc > 1)\n+\t\ttestnum = simple_strtoul(argv[1], NULL, 10);\n+\n+\tret = log_test(testnum);\n+\tif (ret)\n+\t\tprintf(\"Test failure (err=%d)\\n\", ret);\n+\n+\treturn ret ? CMD_RET_FAILURE : 0;\n+}\n+#endif\n",
    "prefixes": [
        "U-Boot",
        "v2",
        "10/14"
    ]
}