Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/777581/?format=api
{ "id": 777581, "url": "http://patchwork.ozlabs.org/api/patches/777581/?format=api", "web_url": "http://patchwork.ozlabs.org/project/skiboot/patch/20170619060138.5314-4-oohall@gmail.com/", "project": { "id": 44, "url": "http://patchwork.ozlabs.org/api/projects/44/?format=api", "name": "skiboot firmware development", "link_name": "skiboot", "list_id": "skiboot.lists.ozlabs.org", "list_email": "skiboot@lists.ozlabs.org", "web_url": "http://github.com/open-power/skiboot", "scm_url": "http://github.com/open-power/skiboot", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170619060138.5314-4-oohall@gmail.com>", "list_archive_url": null, "date": "2017-06-19T06:01:36", "name": "[4/6] core/test: add a console flushing test", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "00e112b76e462da70422a807bda727462ce0b52b", "submitter": { "id": 68108, "url": "http://patchwork.ozlabs.org/api/people/68108/?format=api", "name": "Oliver O'Halloran", "email": "oohall@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/skiboot/patch/20170619060138.5314-4-oohall@gmail.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/777581/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/777581/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "skiboot@lists.ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "skiboot@lists.ozlabs.org" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3wrgPp2PKhz9s7m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 19 Jun 2017 16:03:10 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3wrgPp14MTzDqDF\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 19 Jun 2017 16:03:10 +1000 (AEST)", "from mail-pg0-x243.google.com (mail-pg0-x243.google.com\n\t[IPv6:2607:f8b0:400e:c05::243])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3wrgPK13w2zDqMP\n\tfor <skiboot@lists.ozlabs.org>; Mon, 19 Jun 2017 16:02:45 +1000 (AEST)", "by mail-pg0-x243.google.com with SMTP id f127so14198834pgc.2\n\tfor <skiboot@lists.ozlabs.org>; Sun, 18 Jun 2017 23:02:45 -0700 (PDT)", "from flat-canetoad.ozlabs.ibm.com ([122.99.82.10])\n\tby smtp.gmail.com with ESMTPSA id\n\tx64sm19638626pff.123.2017.06.18.23.02.41\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 18 Jun 2017 23:02:42 -0700 (PDT)" ], "Authentication-Results": [ "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"AQ0zhj99\"; dkim-atps=neutral", "lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"AQ0zhj99\"; dkim-atps=neutral", "lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"AQ0zhj99\"; dkim-atps=neutral" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=TVuCixNaaiuOLlZKQCExXgFVqte87zjhgNWiJULbePg=;\n\tb=AQ0zhj996c+TfGq82AUCg+tYyKL2dR8jxOYZaQx9xsI3er4PaTrgeBQ6hXsa9+pWkH\n\tGpaCy07Zw0PXBSuaVb0eIxo2fnaUzOFCZkxkLiGeVBwlXbiayW6fa9k+uDbMLk2cPtyp\n\tnRtcRwzWTdODMMmWkzFNZp+TuhCRB15/AkAQYlAvGvZw6VE+3QBC0hASjz6Bfz08z8gl\n\tRpT32ZgaMtuOXuVpxUU+IyhyCXJ9jZz9gY4//TckcXNTsaKc4d4gTq0ERb2fgswAeOGr\n\tZ7XbI0S7xPB8Ku9/wieOQwMFzBYGSpYoq3PbrPsBIGCu/AnldvaT746xVdNUXZqYO40z\n\t+tOw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=TVuCixNaaiuOLlZKQCExXgFVqte87zjhgNWiJULbePg=;\n\tb=ErTCD8mFb6opMfeRwTe/V12THox6VBUvvlmxIpGuX3pn87mpI/d3sVdp6PoSha5H5u\n\tjHOF/ZSE0b+44WR2zD7pT9o1ntLOq67FLdhzJwETW1DL8vibNLy2+MRV4qfBY1pF9veh\n\tdoFRBY1Ls3Nlp2a9Ut5caYZqIXijlbt7zk6n4F2QyCR3UHR01P0xbdDwl2rq8NJaDNiM\n\tNPEZOV+s+EeyAoXjwyjk7Db6SYORaWLQ9zR/LvfQIOCZ/Z4Uje7GPzJUq399mwee1Z+z\n\teECkZpsUMF3amkMpaRTg/2MzXNtmp7Iicdi/CwAE6mHjPFCtQMyyKX2A/AyAYg4dxmOP\n\tRT5Q==", "X-Gm-Message-State": "AKS2vOyiMU3V1JuyKbAq4baF8VpWo6H1xES4cEc7QzT5ITLPYIIyS1Cc\n\t64ZtECXSzFlqF47o", "X-Received": "by 10.99.143.9 with SMTP id n9mr24643641pgd.145.1497852163098;\n\tSun, 18 Jun 2017 23:02:43 -0700 (PDT)", "From": "Oliver O'Halloran <oohall@gmail.com>", "To": "skiboot@lists.ozlabs.org", "Date": "Mon, 19 Jun 2017 16:01:36 +1000", "Message-Id": "<20170619060138.5314-4-oohall@gmail.com>", "X-Mailer": "git-send-email 2.9.3", "In-Reply-To": "<20170619060138.5314-1-oohall@gmail.com>", "References": "<20170619060138.5314-1-oohall@gmail.com>", "Subject": "[Skiboot] [PATCH 4/6] core/test: add a console flushing test", "X-BeenThere": "skiboot@lists.ozlabs.org", "X-Mailman-Version": "2.1.23", "Precedence": "list", "List-Id": "Mailing list for skiboot development <skiboot.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/skiboot/>", "List-Post": "<mailto:skiboot@lists.ozlabs.org>", "List-Help": "<mailto:skiboot-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org", "Sender": "\"Skiboot\"\n\t<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>" }, "content": "Adds a test to verify that flushing the console buffer works properly.\n\nSigned-off-by: Oliver O'Halloran <oohall@gmail.com>\n---\n core/test/Makefile.check | 1 +\n core/test/run-console-flush.c | 130 ++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 131 insertions(+)\n create mode 100644 core/test/run-console-flush.c", "diff": "diff --git a/core/test/Makefile.check b/core/test/Makefile.check\nindex 813bd0207d8c..630de2e4ca36 100644\n--- a/core/test/Makefile.check\n+++ b/core/test/Makefile.check\n@@ -2,6 +2,7 @@\n CORE_TEST := \\\n \tcore/test/run-bitmap \\\n \tcore/test/run-device \\\n+\tcore/test/run-console-flush \\\n \tcore/test/run-flash-subpartition \\\n \tcore/test/run-mem_region \\\n \tcore/test/run-malloc \\\ndiff --git a/core/test/run-console-flush.c b/core/test/run-console-flush.c\nnew file mode 100644\nindex 000000000000..33db0460da8f\n--- /dev/null\n+++ b/core/test/run-console-flush.c\n@@ -0,0 +1,130 @@\n+/* Copyright 2016 IBM Corp.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * \thttp://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n+ * implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+#include <config.h>\n+#include <stdlib.h>\n+#include <string.h>\n+#include <assert.h>\n+#include <stdarg.h>\n+#include <stdbool.h>\n+\n+#include <sys/uio.h>\n+#include <sys/socket.h>\n+#include <sys/types.h>\n+\n+#define __TEST__\n+#define _printf printf\n+\n+/* fake out the timebase sett */\n+unsigned long tb_hz = 512000000;\n+\n+static inline unsigned long mftb(void)\n+{\n+\treturn 0;\n+}\n+\n+int _printf(const char *fmt, ...);\n+\n+static struct debug_descriptor debug_descriptor;\n+\n+#include \"../console.c\"\n+#include \"../console-log.c\"\n+\n+int flush_buffer_offset = 0;\n+static bool flushed_to_drivers = false;\n+static char flush_buffer[65536];\n+static char console_buffer[65536];\n+\n+/*\n+ * Inside skiboot we have our own write() function that breaks\n+ * the normal stdlib write(). We can use writev() instead though\n+ */\n+static size_t unix_write(int fd, const char *buf, size_t len)\n+{\n+\tstruct iovec iov = {(void *)buf, len};\n+\n+\treturn writev(fd, &iov, 1);\n+}\n+\n+/* For debugging I usually hack in some mambo_printfs\n+ * this implements the backend for the test */\n+size_t mambo_console_write(const char *buf, size_t count)\n+{\n+\treturn unix_write(2, buf, count);\n+}\n+\n+static size_t flush_write(const char *buf, size_t len)\n+{\n+\tmemcpy(flush_buffer + flush_buffer_offset, buf, len);\n+\n+\tflush_buffer_offset += len;\n+\tflush_buffer_offset %= sizeof(flush_buffer);\n+\n+\treturn len;\n+}\n+\n+static struct con_ops unix_con = {\n+\t.write = flush_write,\n+};\n+\n+static void populate_console(int mem_lvl, int flush_lvl)\n+{\n+\tint i;\n+\n+\tmemset(console_buffer, 0, sizeof(console_buffer));\n+\tcon_in = 0;\n+\tcon_out = 0;\n+\n+\tdebug_descriptor.console_log_levels = (mem_lvl << 4) | flush_lvl;\n+\n+\tfor (i = 0; i < 20; i++)\n+\t\tprlog(i % (PR_INSANE + 1), \"Hello World! %d\\r\\n\", i);\n+}\n+\n+int main(void)\n+{\n+\tint ret;\n+\n+\tthis_cpu()->con_suspend = false;\n+\tset_console(&unix_con);\n+\n+\t/* fix up the console globals */\n+\tflushed_to_drivers = false;\n+\tcon_buf = console_buffer;\n+\tmemcons.obuf_phys = (uint64_t) console_buffer;\n+\tmemcons.obuf_size = sizeof(console_buffer);\n+\n+\tpopulate_console(PR_INSANE, PR_NOTICE);\n+\t__flush_console(true);\n+\n+\t/*\n+\t * Refill the console buffer dropping everything above PR_NOTICE\n+\t * The contents of the flushed and the refilled buffer should\n+\t * be identical.\n+\t */\n+\tset_console(NULL); /* prevent writes into flush_buffer */\n+\tpopulate_console(PR_NOTICE, 0);\n+\n+\tret = memcmp(flush_buffer, console_buffer, con_in);\n+\tif (ret) {\n+\t\tunix_write(2, \"=========\\n\", sizeof(\"=========\\n\") - 1);\n+\t\tunix_write(2, console_buffer, strlen(console_buffer));\n+\t\tunix_write(2, \"=========\\n\", sizeof(\"=========\\n\") - 1);\n+\t\tunix_write(2, flush_buffer, strlen(flush_buffer));\n+\t}\n+\n+\treturn ret;\n+}\n", "prefixes": [ "4/6" ] }