Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/632626/?format=api
{ "id": 632626, "url": "http://patchwork.ozlabs.org/api/patches/632626/?format=api", "web_url": "http://patchwork.ozlabs.org/project/petitboot/patch/20160609045909.17049-2-sam@mendozajonas.com/", "project": { "id": 53, "url": "http://patchwork.ozlabs.org/api/projects/53/?format=api", "name": "Petitboot development", "link_name": "petitboot", "list_id": "petitboot.lists.ozlabs.org", "list_email": "petitboot@lists.ozlabs.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20160609045909.17049-2-sam@mendozajonas.com>", "list_archive_url": null, "date": "2016-06-09T04:59:08", "name": "[2/3] Update tests to support changes to pxe_parser", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "02c146caaba42138d38e0632ad4e3e556b8c8f64", "submitter": { "id": 68013, "url": "http://patchwork.ozlabs.org/api/people/68013/?format=api", "name": "Sam Mendoza-Jonas", "email": "sam@mendozajonas.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/petitboot/patch/20160609045909.17049-2-sam@mendozajonas.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/632626/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/632626/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "petitboot@lists.ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "petitboot@lists.ozlabs.org" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rQClQ6Pdrz9sD3\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 9 Jun 2016 14:59:30 +1000 (AEST)", "from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3rQClQ57V6zDqPP\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 9 Jun 2016 14:59:30 +1000 (AEST)", "from mendozajonas.com (mendozajonas.com [188.166.185.233])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3rQClF2bmQzDq60\n\tfor <petitboot@lists.ozlabs.org>;\n\tThu, 9 Jun 2016 14:59:21 +1000 (AEST)", "from skellige.ozlabs.ibm.com (unknown [122.99.82.10])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (Client did not present a certificate)\n\t(Authenticated sender: sam@mendozajonas.com)\n\tby mendozajonas.com (Postfix) with ESMTPSA id AACC1143F71\n\tfor <petitboot@lists.ozlabs.org>;\n\tThu, 9 Jun 2016 12:59:15 +0800 (SGT)" ], "Authentication-Results": [ "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=mendozajonas.com header.i=@mendozajonas.com\n\theader.b=Tvt9NXsO; dkim-atps=neutral", "lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=mendozajonas.com header.i=@mendozajonas.com\n\theader.b=Tvt9NXsO; dkim-atps=neutral", "lists.ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=mendozajonas.com header.i=@mendozajonas.com\n\theader.b=Tvt9NXsO; dkim-atps=neutral" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=mendozajonas.com;\n\ts=mail; t=1465448356;\n\tbh=4uIKV6whJ3nSfb1WROgV+niLZ3uhHzun2xSp4P8Y1Jc=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Tvt9NXsO7LHZEAdmgJ0+vAidUByOUSqJB8aFo+dRuBMk215wUQIts8TXn9FmYhoSq\n\t7ccofr28ZlxC8R1vp4hb2o+22UqgXJN4BMGpCBkIciXQdRf0yPPl/vHsWCWXomYrFr\n\torWYJeTlzCpTTPPsbRxCs6xznRfflY+vvsDSDOpw=", "From": "Samuel Mendoza-Jonas <sam@mendozajonas.com>", "To": "petitboot@lists.ozlabs.org", "Subject": "[PATCH 2/3] Update tests to support changes to pxe_parser", "Date": "Thu, 9 Jun 2016 14:59:08 +1000", "Message-Id": "<20160609045909.17049-2-sam@mendozajonas.com>", "X-Mailer": "git-send-email 2.8.3", "In-Reply-To": "<20160609045909.17049-1-sam@mendozajonas.com>", "References": "<20160609045909.17049-1-sam@mendozajonas.com>", "X-BeenThere": "petitboot@lists.ozlabs.org", "X-Mailman-Version": "2.1.22", "Precedence": "list", "List-Id": "Petitboot bootloader development <petitboot.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/petitboot>,\n\t<mailto:petitboot-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/petitboot/>", "List-Post": "<mailto:petitboot@lists.ozlabs.org>", "List-Help": "<mailto:petitboot-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/petitboot>,\n\t<mailto:petitboot-request@lists.ozlabs.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org", "Sender": "\"Petitboot\"\n\t<petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>" }, "content": "Substitute load_url_async() when running tests to support direct\ncallers of load_url_async() who will expect to read a file in a\ncallback.\nStub out device_handler_discover_context_commit() since it will remove\ndiscover_options from the given discover_context, but the tests will\ncheck the discover_context to count boot_options.\n\nSigned-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>\n---\n discover/device-handler.c | 96 +++++++++++++++++++++++++----------------------\n discover/paths.c | 31 +++++++++++++++\n test/parser/utils.c | 57 ++++++++++++++++++++++++++++\n 3 files changed, 139 insertions(+), 45 deletions(-)", "diff": "diff --git a/discover/device-handler.c b/discover/device-handler.c\nindex 1c69de0..9fd9fab 100644\n--- a/discover/device-handler.c\n+++ b/discover/device-handler.c\n@@ -708,50 +708,6 @@ struct discover_context *device_handler_discover_context_create(\n \treturn ctx;\n }\n \n-/**\n- * context_commit - Commit a temporary discovery context to the handler,\n- * and notify the clients about any new options / devices\n- */\n-void device_handler_discover_context_commit(struct device_handler *handler,\n-\t\tstruct discover_context *ctx)\n-{\n-\tstruct discover_device *dev = ctx->device;\n-\tstruct discover_boot_option *opt, *tmp;\n-\n-\tif (!device_lookup_by_id(handler, dev->device->id))\n-\t\tdevice_handler_add_device(handler, dev);\n-\n-\t/* move boot options from the context to the device */\n-\tlist_for_each_entry_safe(&ctx->boot_options, opt, tmp, list) {\n-\t\tlist_remove(&opt->list);\n-\n-\t\tif (boot_option_resolve(opt, handler)) {\n-\t\t\tpb_log(\"boot option %s is resolved, \"\n-\t\t\t\t\t\"sending to clients\\n\",\n-\t\t\t\t\topt->option->id);\n-\t\t\tlist_add_tail(&dev->boot_options, &opt->list);\n-\t\t\ttalloc_steal(dev, opt);\n-\t\t\tboot_option_finalise(handler, opt);\n-\t\t\tnotify_boot_option(handler, opt);\n-\t\t} else {\n-\t\t\tif (!opt->source->resolve_resource) {\n-\t\t\t\tpb_log(\"parser %s gave us an unresolved \"\n-\t\t\t\t\t\"resource (%s), but no way to \"\n-\t\t\t\t\t\"resolve it\\n\",\n-\t\t\t\t\topt->source->name, opt->option->id);\n-\t\t\t\ttalloc_free(opt);\n-\t\t\t} else {\n-\t\t\t\tpb_log(\"boot option %s is unresolved, \"\n-\t\t\t\t\t\t\"adding to queue\\n\",\n-\t\t\t\t\t\topt->option->id);\n-\t\t\t\tlist_add(&handler->unresolved_boot_options,\n-\t\t\t\t\t\t&opt->list);\n-\t\t\t\ttalloc_steal(handler, opt);\n-\t\t\t}\n-\t\t}\n-\t}\n-}\n-\n void device_handler_add_device(struct device_handler *handler,\n \t\tstruct discover_device *device)\n {\n@@ -1218,6 +1174,50 @@ msg:\n \n #ifndef PETITBOOT_TEST\n \n+/**\n+ * context_commit - Commit a temporary discovery context to the handler,\n+ * and notify the clients about any new options / devices\n+ */\n+void device_handler_discover_context_commit(struct device_handler *handler,\n+\t\tstruct discover_context *ctx)\n+{\n+\tstruct discover_device *dev = ctx->device;\n+\tstruct discover_boot_option *opt, *tmp;\n+\n+\tif (!device_lookup_by_id(handler, dev->device->id))\n+\t\tdevice_handler_add_device(handler, dev);\n+\n+\t/* move boot options from the context to the device */\n+\tlist_for_each_entry_safe(&ctx->boot_options, opt, tmp, list) {\n+\t\tlist_remove(&opt->list);\n+\n+\t\tif (boot_option_resolve(opt, handler)) {\n+\t\t\tpb_log(\"boot option %s is resolved, \"\n+\t\t\t\t\t\"sending to clients\\n\",\n+\t\t\t\t\topt->option->id);\n+\t\t\tlist_add_tail(&dev->boot_options, &opt->list);\n+\t\t\ttalloc_steal(dev, opt);\n+\t\t\tboot_option_finalise(handler, opt);\n+\t\t\tnotify_boot_option(handler, opt);\n+\t\t} else {\n+\t\t\tif (!opt->source->resolve_resource) {\n+\t\t\t\tpb_log(\"parser %s gave us an unresolved \"\n+\t\t\t\t\t\"resource (%s), but no way to \"\n+\t\t\t\t\t\"resolve it\\n\",\n+\t\t\t\t\topt->source->name, opt->option->id);\n+\t\t\t\ttalloc_free(opt);\n+\t\t\t} else {\n+\t\t\t\tpb_log(\"boot option %s is unresolved, \"\n+\t\t\t\t\t\t\"adding to queue\\n\",\n+\t\t\t\t\t\topt->option->id);\n+\t\t\t\tlist_add(&handler->unresolved_boot_options,\n+\t\t\t\t\t\t&opt->list);\n+\t\t\t\ttalloc_steal(handler, opt);\n+\t\t\t}\n+\t\t}\n+\t}\n+}\n+\n static void device_handler_update_lang(const char *lang)\n {\n \tconst char *cur_lang;\n@@ -1566,6 +1566,13 @@ void device_release_write(struct discover_device *dev, bool release)\n \n #else\n \n+void device_handler_discover_context_commit(\n+\t\tstruct device_handler *handler __attribute__((unused)),\n+\t\tstruct discover_context *ctx __attribute__((unused)))\n+{\n+\tpb_log(\"%s stubbed out for test cases\\n\", __func__);\n+}\n+\n static void device_handler_update_lang(const char *lang __attribute__((unused)))\n {\n }\n@@ -1605,4 +1612,3 @@ void device_release_write(struct discover_device *dev __attribute__((unused)),\n }\n \n #endif\n-\ndiff --git a/discover/paths.c b/discover/paths.c\nindex 1269dde..7fcff9e 100644\n--- a/discover/paths.c\n+++ b/discover/paths.c\n@@ -47,6 +47,7 @@ char *join_paths(void *alloc_ctx, const char *a, const char *b)\n \treturn full_path;\n }\n \n+#ifndef PETITBOOT_TEST\n \n static char *local_name(void *ctx)\n {\n@@ -449,3 +450,33 @@ void load_url_async_cancel(struct load_url_result *res)\n \tres->status = LOAD_CANCELLED;\n \tprocess_stop_async(task->process);\n }\n+\n+#else\n+\n+static void __attribute__((unused)) load_local(\n+\t\tstruct load_task *task __attribute__((unused)))\n+{\n+}\n+static void __attribute__((unused)) load_wget(\n+\t\tstruct load_task *task __attribute__((unused)),\n+\t\tint flags __attribute__((unused)))\n+{\n+}\n+static void __attribute__((unused)) load_tftp(\n+\t\tstruct load_task *task __attribute__((unused)))\n+{\n+}\n+static void __attribute__((unused)) load_sftp(\n+\t\tstruct load_task *task __attribute__((unused)))\n+{\n+}\n+static void __attribute__((unused)) load_nfs(\n+\t\tstruct load_task *task __attribute__((unused)))\n+{\n+}\n+static void __attribute__((unused)) load_url_process_exit(\n+\t\tstruct process *process __attribute__((unused)))\n+{\n+}\n+\n+#endif\ndiff --git a/test/parser/utils.c b/test/parser/utils.c\nindex 2891969..5cebc99 100644\n--- a/test/parser/utils.c\n+++ b/test/parser/utils.c\n@@ -17,6 +17,8 @@\n #include \"resource.h\"\n #include \"event.h\"\n #include \"platform.h\"\n+#include \"paths.h\"\n+#include \"parser-conf.h\"\n \n #include \"parser-test.h\"\n \n@@ -306,6 +308,61 @@ int parser_replace_file(struct discover_context *ctx,\n \treturn 0;\n }\n \n+struct load_url_result *load_url_async(void *ctx, struct pb_url *url,\n+\t\tload_url_complete async_cb, void *async_data)\n+{\n+\tstruct conf_context *conf = async_data;\n+\tstruct parser_test *test = conf->dc->test_data;\n+\tstruct load_url_result *result;\n+\tchar tmp[] = \"/tmp/pb-XXXXXX\";\n+\tssize_t rc = -1, sz = 0;\n+\tstruct test_file *file;\n+\tint fd;\n+\n+\tfd = mkstemp(tmp);\n+\n+\tif (fd < 0)\n+\t\treturn NULL;\n+\n+\t/* Some parsers will expect to need to read a file, so write the\n+\t * specified file to a temporary file */\n+\tlist_for_each_entry(&test->files, file, list) {\n+\t\tif (file->dev)\n+\t\t\tcontinue;\n+\n+\t\tif (strcmp(file->name, url->full))\n+\t\t\tcontinue;\n+\n+\t\twhile (sz < file->size) {\n+\t\t\trc = write(fd, file->data, file->size);\n+\t\t\tif (rc < 0) {\n+\t\t\t\tfprintf(stderr,\n+\t\t\t\t\t\"Failed to write to tmpfile, %m\\n\");\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tsz += rc;\n+\t\t}\n+\t\tbreak;\n+\t}\n+\n+\tclose(fd);\n+\n+\tresult = talloc_zero(ctx, struct load_url_result);\n+\tif (!result)\n+\t\treturn NULL;\n+\n+\tresult->local = talloc_strdup(result, tmp);\n+\tif (rc < 0)\n+\t\tresult->status = LOAD_ERROR;\n+\telse\n+\t\tresult->status = result->local ? LOAD_OK : LOAD_ERROR;\n+\tresult->cleanup_local = true;\n+\n+\tasync_cb(result, conf);\n+\n+\treturn result;\n+}\n+\n int parser_request_url(struct discover_context *ctx, struct pb_url *url,\n \t\tchar **buf, int *len)\n {\n", "prefixes": [ "2/3" ] }