Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2041447/?format=api
{ "id": 2041447, "url": "http://patchwork.ozlabs.org/api/patches/2041447/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20250203091203.47590-4-heinrich.schuchardt@canonical.com/", "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": "<20250203091203.47590-4-heinrich.schuchardt@canonical.com>", "list_archive_url": null, "date": "2025-02-03T09:12:01", "name": "[v3,3/4] test: unit tests for strstr() and strnstr()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "0a4cc7a56da46367e92c61a2dea3f3a11b6e9a02", "submitter": { "id": 82181, "url": "http://patchwork.ozlabs.org/api/people/82181/?format=api", "name": "Heinrich Schuchardt", "email": "heinrich.schuchardt@canonical.com" }, "delegate": { "id": 157425, "url": "http://patchwork.ozlabs.org/api/users/157425/?format=api", "username": "jforissier", "first_name": "Jerome", "last_name": "Forissier", "email": "jerome.forissier@linaro.org" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20250203091203.47590-4-heinrich.schuchardt@canonical.com/mbox/", "series": [ { "id": 442578, "url": "http://patchwork.ozlabs.org/api/series/442578/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=442578", "date": "2025-02-03T09:11:58", "name": "net: use strnstr() for lwip_strnstr()", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/442578/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2041447/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2041447/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "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 unprotected) header.d=canonical.com header.i=@canonical.com\n header.a=rsa-sha256 header.s=20210705 header.b=T70KBDPM;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=canonical.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=canonical.com header.i=@canonical.com\n header.b=\"T70KBDPM\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=canonical.com", "phobos.denx.de; spf=pass\n smtp.mailfrom=heinrich.schuchardt@canonical.com" ], "Received": [ "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4YmgkW5nswz20J0\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 3 Feb 2025 20:12:35 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 83370801DE;\n\tMon, 3 Feb 2025 10:12:17 +0100 (CET)", "by phobos.denx.de (Postfix, from userid 109)\n id 67951801DE; Mon, 3 Feb 2025 10:12:14 +0100 (CET)", "from smtp-relay-canonical-1.canonical.com\n (smtp-relay-canonical-1.canonical.com [185.125.188.121])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 71D8E80711\n for <u-boot@lists.denx.de>; Mon, 3 Feb 2025 10:12:12 +0100 (CET)", "from LT2ubnt.. (dynamic-046-114-108-254.46.114.pool.telefonica.de\n [46.114.108.254])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 1D4A441EB9;\n Mon, 3 Feb 2025 09:12:10 +0000 (UTC)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,\n RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com;\n s=20210705; t=1738573930;\n bh=O9OQEERCfFy+ACvaaWc/bPMV77YpLn8FgbtQLbfM5VU=;\n h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n MIME-Version;\n b=T70KBDPMJ5Vbb12vTqpdir52DFbZF1jYYh+y/IF+n5zBel05B2MqLXg4EQLGRaxGq\n 5xFA4uCkdGbOhoMx1TldN8meL++Nn0wzCbfduMwCrcy3s71/Sf0HUWGpEuTfzfLFAG\n BbazkVGVmKeT7LPhR2NWW4szpsAaBKwmkNxjrHIn/q1lS6UEgCpcHw+kqahPoFX/jD\n 6lq3xzCTovDE49TSTmU0W3gvMTfAg+vSTV/BwpWvpx04lpzLiVXNDM6waQQYw0q9go\n OygEv7ykqC3uAk4ctsbMB3NVrUCxdjIO3Ms6AyPgNURSfq8LCfbDqD/OLrGD1qsHDM\n tjYNcF6xwgAVA==", "From": "Heinrich Schuchardt <heinrich.schuchardt@canonical.com>", "To": "Jerome Forissier <jerome.forissier@linaro.org>", "Cc": "Tom Rini <trini@konsulko.com>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n Simon Glass <sjg@chromium.org>, u-boot@lists.denx.de,\n Heinrich Schuchardt <heinrich.schuchardt@canonical.com>", "Subject": "[PATCH v3 3/4] test: unit tests for strstr() and strnstr()", "Date": "Mon, 3 Feb 2025 10:12:01 +0100", "Message-ID": "<20250203091203.47590-4-heinrich.schuchardt@canonical.com>", "X-Mailer": "git-send-email 2.47.1", "In-Reply-To": "<20250203091203.47590-1-heinrich.schuchardt@canonical.com>", "References": "<20250203091203.47590-1-heinrich.schuchardt@canonical.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.39", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<https://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 <mailto:u-boot-request@lists.denx.de?subject=subscribe>", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>", "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de", "X-Virus-Status": "Clean" }, "content": "Add unit tests for the library functions.\n\nSigned-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>\nAcked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>\n---\nv3:\n\tno change\nv2:\n\tno change\n---\n lib/string.c | 2 +-\n test/lib/string.c | 40 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 41 insertions(+), 1 deletion(-)", "diff": "diff --git a/lib/string.c b/lib/string.c\nindex 691c9985692..3a74493d223 100644\n--- a/lib/string.c\n+++ b/lib/string.c\n@@ -16,8 +16,8 @@\n */\n \n #include <config.h>\n+#include <limits.h>\n #include <malloc.h>\n-#include <stdint.h>\n #include <linux/compiler.h>\n #include <linux/ctype.h>\n #include <linux/types.h>\ndiff --git a/test/lib/string.c b/test/lib/string.c\nindex 8d22f3fd68f..31391a387b9 100644\n--- a/test/lib/string.c\n+++ b/test/lib/string.c\n@@ -11,6 +11,7 @@\n \n #include <command.h>\n #include <log.h>\n+#include <string.h>\n #include <test/lib.h>\n #include <test/test.h>\n #include <test/ut.h>\n@@ -221,3 +222,42 @@ static int lib_memdup(struct unit_test_state *uts)\n \treturn 0;\n }\n LIB_TEST(lib_memdup, 0);\n+\n+/** lib_strnstr() - unit test for strnstr() */\n+static int lib_strnstr(struct unit_test_state *uts)\n+{\n+\tconst char *s1 = \"Itsy Bitsy Teenie Weenie\";\n+\tconst char *s2 = \"eenie\";\n+\tconst char *s3 = \"eery\";\n+\n+\tut_asserteq_ptr(&s1[12], strnstr(s1, s2, SIZE_MAX));\n+\tut_asserteq_ptr(&s1[12], strnstr(s1, s2, 17));\n+\tut_assertnull(strnstr(s1, s2, 16));\n+\tut_assertnull(strnstr(s1, s2, 0));\n+\tut_asserteq_ptr(&s1[13], strnstr(&s1[3], &s2[1], SIZE_MAX));\n+\tut_asserteq_ptr(&s1[13], strnstr(&s1[3], &s2[1], 14));\n+\tut_assertnull(strnstr(&s1[3], &s2[1], 13));\n+\tut_assertnull(strnstr(&s1[3], &s2[1], 0));\n+\tut_assertnull(strnstr(s1, s3, SIZE_MAX));\n+\tut_assertnull(strnstr(s1, s3, 0));\n+\n+\treturn 0;\n+}\n+LIB_TEST(lib_strnstr, 0);\n+\n+/** lib_strstr() - unit test for strstr() */\n+static int lib_strstr(struct unit_test_state *uts)\n+{\n+\tconst char *s1 = \"Itsy Bitsy Teenie Weenie\";\n+\tconst char *s2 = \"eenie\";\n+\tconst char *s3 = \"easy\";\n+\n+\tut_asserteq_ptr(&s1[12], strstr(s1, s2));\n+\tut_asserteq_ptr(&s1[13], strstr(&s1[3], &s2[1]));\n+\tut_assertnull(strstr(s1, s3));\n+\tut_asserteq_ptr(&s1[2], strstr(s1, &s3[2]));\n+\tut_asserteq_ptr(&s1[8], strstr(&s1[5], &s3[2]));\n+\n+\treturn 0;\n+}\n+LIB_TEST(lib_strstr, 0);\n", "prefixes": [ "v3", "3/4" ] }