Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814137/?format=api
{ "id": 814137, "url": "http://patchwork.ozlabs.org/api/patches/814137/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170915080619.25250-11-xypron.glpk@gmx.de/", "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": "<20170915080619.25250-11-xypron.glpk@gmx.de>", "list_archive_url": null, "date": "2017-09-15T08:06:19", "name": "[U-Boot,10/10] efi_selftest: check notification of ExitBootServices", "commit_ref": "0923876d297b046010df390277115aed2b3537e9", "pull_url": null, "state": "accepted", "archived": false, "hash": "48a0a36f1d7bfa4c9303e1a53c3dc475262a9f39", "submitter": { "id": 61270, "url": "http://patchwork.ozlabs.org/api/people/61270/?format=api", "name": "Heinrich Schuchardt", "email": "xypron.glpk@gmx.de" }, "delegate": { "id": 3400, "url": "http://patchwork.ozlabs.org/api/users/3400/?format=api", "username": "agraf", "first_name": "Alexander", "last_name": "Graf", "email": "agraf@suse.de" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170915080619.25250-11-xypron.glpk@gmx.de/mbox/", "series": [ { "id": 3244, "url": "http://patchwork.ozlabs.org/api/series/3244/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=3244", "date": "2017-09-15T08:06:10", "name": "efi_loader: event services & API test", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3244/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814137/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814137/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>)", "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xtp6g6NBHz9sPr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 18:12:43 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid 93065C21FE6; Fri, 15 Sep 2017 08:10:31 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 62CF4C21D7B;\n\tFri, 15 Sep 2017 08:08:41 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 9D962C21F9B; Fri, 15 Sep 2017 08:07:54 +0000 (UTC)", "from mout.gmx.net (mout.gmx.net [212.227.17.21])\n\tby lists.denx.de (Postfix) with ESMTPS id 14A67C21FC7\n\tfor <u-boot@lists.denx.de>; Fri, 15 Sep 2017 08:07:50 +0000 (UTC)", "from laptop1.fritz.box ([94.197.120.111]) by mail.gmx.com (mrgmx102\n\t[212.227.17.174]) with ESMTPSA (Nemesis) id 0M1iGk-1dYL8A2ZUA-00tiOp;\n\tFri, 15 Sep 2017 10:07:33 +0200" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-0.7 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,\n\tRCVD_IN_MSPIKE_WL autolearn=unavailable\n\tautolearn_force=no version=3.4.0", "From": "Heinrich Schuchardt <xypron.glpk@gmx.de>", "To": "Alexander Graf <agraf@suse.de>", "Date": "Fri, 15 Sep 2017 10:06:19 +0200", "Message-Id": "<20170915080619.25250-11-xypron.glpk@gmx.de>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170915080619.25250-1-xypron.glpk@gmx.de>", "References": "<20170915080619.25250-1-xypron.glpk@gmx.de>", "X-Provags-ID": "V03:K0:MFVvJsqPLqqvVCmNLSTBbY091/7ovsdVC0BVZosJVLnjdlDQfPx\n\t0AHT1JqHWFQiDNL/eY2XwtNVaTYeOAZB5fz1bzdNwC+jvxf+mNKDCZG51gQubAz2n9HoTnE\n\tj5e51BXWjyRVkLrqR1ftKQLS8BNKg7pl1cBDerosQ54Yt782YkBsprZqKZow/5QDfdgk9cA\n\tRQ1pzrXmYW0SqD/RB/nkA==", "X-UI-Out-Filterresults": "notjunk:1; V01:K0:lyYOVewlrgY=:B+OYyEVwTRYjs7CdWqRYuO\n\txkJSVShFqxG1VGgnoOaQrnwCMGQ2BluL3hC9tX63rrsJo/3GFpYRP4bYAGaxO5l7rPWm+T/47\n\tKrgqu2wMX+S2OjBkZ0sLn710Rx3oRZ0NlJ/0b4zoGdPiw059lsZkVUTH3nqAjU/vo7D4GGlbN\n\to4Q5rTo7S7C827JqQoshI1BAzOrT4hYnrR47mNHhYElyIgyWXQ+bB9+r5/dNHN/euJ7GxJk/w\n\tqvvLTzai0wOp3Zsa83f56sJAajkOp6qmjD/CtYi+eh1fkSODgwTtSbSfGDvPnt1ZE/sk16dc2\n\tnn+N+c6pUrej6lxEN8Ez7gWBVUu/hmdcYZ5bBQfYq2yIMVBT26NM7LueRlA1O6ASixG1xEVvt\n\ttQdEpsLsGh0Dwv27XZekyESkWItS2jo9ERmDx5NNzMcCu8EXqpUXsU/ERD1JHCNNqZ9c16EzW\n\tcSUE3lAYewusXN8+upaU7JBRuaevZNTwbFFLzvd+aLDai4OUCnjYbD+Uf/hthJbdgjQE3YTju\n\tcQnFJowTm5jwDNv0ccLlUBSAMI+6IXKjKDBL7a+QqpYkZZUh7250ZprYflQbmLilTCNtikB4a\n\tAnjsc8U5B4Ire7fKtN1XYOWvYq4f7DWrpF9bgCxbo1qDciRgedoDTdTsJ8/HIt6VtHqnCqLnR\n\t8lMC/s/qsxo3RKFOtf1w2PGHLhm9uYTfneSYiqT90BXuPXD4ZZX3eZcucoItoCfazyrj+tyQb\n\tYNh0xfPruHsK5P251ReQc5OhkO57NS32MRjh/F+Y3cyswQg2iiEhM/SySjkVb2dwFA4y6j+mK\n\tqZW6Ou48TXo2sZKLqsGUuGoh74PBw==", "Cc": "=?utf-8?q?=C5=81ukasz_Majewski?= <l.majewski@samsung.com>,\n\tHeinrich Schuchardt <xypron.glpk@gmx.de>, Andy Shevchenko\n\t<andriy.shevchenko@linux.intel.com>, u-boot@lists.denx.de, Fabio Estevam\n\t<fabio.estevam@nxp.com>, Maxime Ripard <maxime.ripard@free-electrons.com>", "Subject": "[U-Boot] [PATCH 10/10] efi_selftest: check notification of\n\tExitBootServices", "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": "Check that the notification function of an\nEVT_SIGNAL_EXIT_BOOT_SERVICES event is called\nexactly once.\n\nSigned-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n---\n lib/efi_selftest/Makefile | 3 +\n lib/efi_selftest/efi_selftest_exitbootservices.c | 106 +++++++++++++++++++++++\n 2 files changed, 109 insertions(+)\n create mode 100644 lib/efi_selftest/efi_selftest_exitbootservices.c", "diff": "diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile\nindex ddf304e1fa..30f1960933 100644\n--- a/lib/efi_selftest/Makefile\n+++ b/lib/efi_selftest/Makefile\n@@ -13,6 +13,8 @@ CFLAGS_efi_selftest_console.o := $(CFLAGS_EFI)\n CFLAGS_REMOVE_efi_selftest_console.o := $(CFLAGS_NON_EFI)\n CFLAGS_efi_selftest_events.o := $(CFLAGS_EFI)\n CFLAGS_REMOVE_efi_selftest_events.o := $(CFLAGS_NON_EFI)\n+CFLAGS_efi_selftest_exitbootservices.o := $(CFLAGS_EFI)\n+CFLAGS_REMOVE_efi_selftest_exitbootservices.o := $(CFLAGS_NON_EFI)\n CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI)\n CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI)\n \n@@ -20,4 +22,5 @@ obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += \\\n efi_selftest.o \\\n efi_selftest_console.o \\\n efi_selftest_events.o \\\n+efi_selftest_exitbootservices.o \\\n efi_selftest_tpl.o\ndiff --git a/lib/efi_selftest/efi_selftest_exitbootservices.c b/lib/efi_selftest/efi_selftest_exitbootservices.c\nnew file mode 100644\nindex 0000000000..60271e6180\n--- /dev/null\n+++ b/lib/efi_selftest/efi_selftest_exitbootservices.c\n@@ -0,0 +1,106 @@\n+/*\n+ * efi_selftest_events\n+ *\n+ * Copyright (c) 2017 Heinrich Schuchardt <xypron.glpk@gmx.de>\n+ *\n+ * SPDX-License-Identifier: GPL-2.0+\n+ *\n+ * This unit test checks that the notification function of an\n+ * EVT_SIGNAL_EXIT_BOOT_SERVICES event is called exactly once.\n+ */\n+\n+#include <efi_selftest.h>\n+\n+static struct efi_boot_services *boottime;\n+static struct efi_event *event_notify;\n+static unsigned int counter;\n+\n+/*\n+ * Notification function, increments a counter.\n+ *\n+ * @event\tnotified event\n+ * @context\tpointer to the counter\n+ */\n+static void EFIAPI notify(struct efi_event *event, void *context)\n+{\n+\tif (!context)\n+\t\treturn;\n+\t++*(unsigned int *)context;\n+}\n+\n+/*\n+ * Setup unit test.\n+ *\n+ * Create an EVT_SIGNAL_EXIT_BOOT_SERVICES event.\n+ *\n+ * @handle:\thandle of the loaded image\n+ * @systable:\tsystem table\n+ */\n+static int setup(const efi_handle_t handle,\n+\t\t const struct efi_system_table *systable)\n+{\n+\tefi_status_t ret;\n+\n+\tboottime = systable->boottime;\n+\n+\tcounter = 0;\n+\tret = boottime->create_event(EVT_SIGNAL_EXIT_BOOT_SERVICES,\n+\t\t\t\t TPL_CALLBACK, notify, (void *)&counter,\n+\t\t\t\t &event_notify);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"could not create event\\n\");\n+\t\treturn 1;\n+\t}\n+\treturn 0;\n+}\n+\n+/*\n+ * Tear down unit test.\n+ *\n+ * Close the event created in setup.\n+ */\n+static int teardown(void)\n+{\n+\tefi_status_t ret;\n+\n+\tif (event_notify) {\n+\t\tret = boottime->close_event(event_notify);\n+\t\tevent_notify = NULL;\n+\t\tif (ret != EFI_SUCCESS) {\n+\t\t\tefi_st_error(\"could not close event\\n\");\n+\t\t\treturn 1;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n+/*\n+ * Execute unit test.\n+ *\n+ * Check that the notification function of the EVT_SIGNAL_EXIT_BOOT_SERVICES\n+ * event has been called.\n+ *\n+ * Call ExitBootServices again and check that the notification function is\n+ * not called again.\n+ */\n+static int execute(void)\n+{\n+\tif (counter != 1) {\n+\t\tefi_st_error(\"ExitBootServices was not notified\");\n+\t\treturn 1;\n+\t}\n+\tefi_st_exit_boot_services();\n+\tif (counter != 1) {\n+\t\tefi_st_error(\"ExitBootServices was notified twice\");\n+\t\treturn 1;\n+\t}\n+\treturn 0;\n+}\n+\n+EFI_UNIT_TEST(exitbootservices) = {\n+\t.name = \"ExitBootServices\",\n+\t.phase = EFI_SETUP_BEFORE_BOOTTIME_EXIT,\n+\t.setup = setup,\n+\t.execute = execute,\n+\t.teardown = teardown,\n+};\n", "prefixes": [ "U-Boot", "10/10" ] }