get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2222465,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2222465/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260412013451.2929001-12-sjg@chromium.org/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260412013451.2929001-12-sjg@chromium.org>",
    "list_archive_url": null,
    "date": "2026-04-12T01:34:39",
    "name": "[11/12] test: fs: add C-based filesystem tests",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f00052a96dac48b1becc209690240d1ed725367d",
    "submitter": {
        "id": 6170,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/6170/?format=api",
        "name": "Simon Glass",
        "email": "sjg@chromium.org"
    },
    "delegate": {
        "id": 3184,
        "url": "http://patchwork.ozlabs.org/api/1.2/users/3184/?format=api",
        "username": "sjg",
        "first_name": "Simon",
        "last_name": "Glass",
        "email": "sjg@chromium.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260412013451.2929001-12-sjg@chromium.org/mbox/",
    "series": [
        {
            "id": 499582,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/499582/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=499582",
            "date": "2026-04-12T01:34:28",
            "name": "test: Add support for passing arguments to C unit tests",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/499582/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2222465/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2222465/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 (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256\n header.s=google header.b=ZTtA2iky;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; 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=chromium.org",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org\n header.b=\"ZTtA2iky\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=sjg@chromium.org"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4ftY6q4gWRz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 12 Apr 2026 11:36:51 +1000 (AEST)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id CFEC78422D;\n\tSun, 12 Apr 2026 03:35:57 +0200 (CEST)",
            "by phobos.denx.de (Postfix, from userid 109)\n id 5A3D883B99; Sun, 12 Apr 2026 03:35:56 +0200 (CEST)",
            "from mail-ot1-x329.google.com (mail-ot1-x329.google.com\n [IPv6:2607:f8b0:4864:20::329])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 355BA83B99\n for <u-boot@lists.denx.de>; Sun, 12 Apr 2026 03:35:53 +0200 (CEST)",
            "by mail-ot1-x329.google.com with SMTP id\n 46e09a7af769-7dbd8c6fc84so2014502a34.3\n for <u-boot@lists.denx.de>; Sat, 11 Apr 2026 18:35:53 -0700 (PDT)",
            "from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id\n 46e09a7af769-7dc2d1aca3asm4242826a34.6.2026.04.11.18.35.44\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 11 Apr 2026 18:35:44 -0700 (PDT)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.6 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,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;\n d=chromium.org; s=google; t=1775957750; x=1776562550; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=22g70G337FxkN0JlhatwuAKycba5Rd8oL33Xc5vDmxo=;\n b=ZTtA2iky/A+LFhPxHtEo9LlP2adsLsS/tp0nYTPe8UK9RIwW9DSAxm2MiyEq2QAOSD\n 5j83Ul3BnVlOGaDhB9CIlwpnjzuBNw1TPyvAGnzE5/VnEq9jQlJnlyjNd5yjidWZXmdV\n bWCG07Vky4yyTrdPpPprQPtTxi+U86FJtfDLY=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775957750; x=1776562550;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=22g70G337FxkN0JlhatwuAKycba5Rd8oL33Xc5vDmxo=;\n b=alK8G7vdIlp2YZoZlCeT5v3NS7wlpD/7lhzNYaazI9vYKJTRleQZgxlp48ADWFYmJK\n yNEzMHfzWXs8E1I8LFTvAVdJXMt9Hqq9qmT+KHxccq/6cj1Owz2XG6/F+dMrg5cEKlp9\n q9eivEXLeDDxeMYPfp7aTgZrjUEHOFiWTol4xONT21lNnehGgnYCO6IOXe6vaCQkUDkV\n kfWrEsyUtSfg7bO9EWQW9IkqUd+FAbUf62c0maOJRkoutdjikR6teorh0PdleaqGilrs\n QR1e/3wYJyTcU+RJcmSVP7vns5EYVZqoYyJwpbSdIVP8xAQI0WWu/yQN+D1fgHAfAofD\n foWw==",
        "X-Gm-Message-State": "AOJu0YxY9oaWmIw3mNJnnKT0fU1xa51Vi905ToEzCnK3tpDJYadPndiA\n XmvcasPngV2kA+MNwD9M/0s0QdFE5DhR2oVZPBZN0YtgCbxzKXU/YQnNKytjmjTJ68e6w/Jkcbx\n JNTf35w==",
        "X-Gm-Gg": "AeBDieudomV/IufsPYzuMqWYuAkWrJ4aPwUnXwgCLZG+3komNYQFJLbabgbygRz9Re9\n kiZh0SSiqjs0/3NsxqByO1TNq8JB3suOsU7atGk1ABvzwQZ+Q10h8o4QyEq4/Za72Ttap/wtaOy\n 5An42OOf1/OxvpqYdGBpPsoKHWfXqu/vJM4nYB1QctPttvEe/p9z/DMFdWzAGHH0rg9+IK3cqD7\n 8j4Xba95qMphx1oR78eyVxp+LbSRdd9TZcQ45D7f9UlKnxPdcBCRcvgUunwOZvbFgqnc8OJ8YrU\n Vjj/eRyA/EO/EQdyKjXtJCYmWm0fMZKovRvs6w4hMsdpOL6BYsSlCJGgpFOdbZZFSH7Qby5yaBc\n ihCtutznrH2rt+XvhEqmr+5X79b+lN0YB/VfRPqR72WjNau5eCM+JMLgfXqR72WcOpaFd9VCMhb\n LxaUziSja/A+uyvk6hXw==",
        "X-Received": "by 2002:a05:6830:83b0:b0:7d7:f031:37c7 with SMTP id\n 46e09a7af769-7dc27c643ddmr5472517a34.3.1775957750042;\n Sat, 11 Apr 2026 18:35:50 -0700 (PDT)",
        "From": "Simon Glass <sjg@chromium.org>",
        "To": "u-boot@lists.denx.de",
        "Cc": "Heinrich Schuchardt <xypron.glpk@gmx.de>, Tom Rini <trini@konsulko.com>,\n Simon Glass <simon.glass@canonical.com>, Simon Glass <sjg@chromium.org>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>",
        "Subject": "[PATCH 11/12] test: fs: add C-based filesystem tests",
        "Date": "Sat, 11 Apr 2026 19:34:39 -0600",
        "Message-ID": "<20260412013451.2929001-12-sjg@chromium.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260412013451.2929001-1-sjg@chromium.org>",
        "References": "<20260412013451.2929001-1-sjg@chromium.org>",
        "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": "From: Simon Glass <simon.glass@canonical.com>\n\nAdd C implementations of filesystem tests that can be called via\nthe 'ut fs' command. These tests use UTF_MANUAL flag since they require\nexternal setup, i.e. creation of filesystem images.\n\nThis covers the existing TestFsBasic tests.\n\nThe tests use typed arguments (fs_type, fs_image, md5 values) passed\nvia the command line.\n\nAdd a few helpers to make the code easier to read.\n\nSigned-off-by: Simon Glass <simon.glass@canonical.com>\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\n include/test/fs.h  |  39 +++++\n test/Makefile      |   1 +\n test/cmd_ut.c      |   2 +\n test/fs/Makefile   |   3 +\n test/fs/fs_basic.c | 407 +++++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 452 insertions(+)\n create mode 100644 include/test/fs.h\n create mode 100644 test/fs/Makefile\n create mode 100644 test/fs/fs_basic.c",
    "diff": "diff --git a/include/test/fs.h b/include/test/fs.h\nnew file mode 100644\nindex 00000000000..7fdb8d70451\n--- /dev/null\n+++ b/include/test/fs.h\n@@ -0,0 +1,39 @@\n+/* SPDX-License-Identifier: GPL-2.0+ */\n+/*\n+ * Copyright 2026 Canonical Ltd\n+ */\n+\n+#ifndef __TEST_FS_H\n+#define __TEST_FS_H\n+\n+#include <test/test.h>\n+#include <test/ut.h>\n+\n+/**\n+ * FS_TEST() - Define a new filesystem test\n+ *\n+ * @name:\tName of test function\n+ * @flags:\tFlags for the test (see enum ut_flags)\n+ */\n+#define FS_TEST(_name, _flags)\tUNIT_TEST(_name, UTF_DM | (_flags), fs)\n+\n+/**\n+ * FS_TEST_ARGS() - Define a filesystem test with inline arguments\n+ *\n+ * Like FS_TEST() but for tests that take arguments.\n+ * The test can access arguments via uts->args[].\n+ * The NULL terminator is added automatically.\n+ *\n+ * Example:\n+ *   FS_TEST_ARGS(my_test, UTF_MANUAL,\n+ *       { \"fs_type\", UT_ARG_STR },\n+ *       { \"fs_image\", UT_ARG_STR });\n+ *\n+ * @name:\tName of test function\n+ * @flags:\tFlags for the test (see enum ut_flags)\n+ * @...:\tArgument definitions (struct ut_arg_def initializers)\n+ */\n+#define FS_TEST_ARGS(_name, _flags, ...) \\\n+\tUNIT_TEST_ARGS(_name, UTF_DM | (_flags), fs, __VA_ARGS__)\n+\n+#endif /* __TEST_FS_H */\ndiff --git a/test/Makefile b/test/Makefile\nindex 5676bd35963..02ded045995 100644\n--- a/test/Makefile\n+++ b/test/Makefile\n@@ -22,6 +22,7 @@ obj-y += boot/\n obj-y += common/\n obj-$(CONFIG_UT_ENV) += env/\n obj-$(CONFIG_UT_FDT_OVERLAY) += fdt_overlay/\n+obj-$(CONFIG_SANDBOX) += fs/\n obj-y += log/\n else\n obj-$(CONFIG_SPL_UT_LOAD) += image/\ndiff --git a/test/cmd_ut.c b/test/cmd_ut.c\nindex 9d36bd5dc87..827fcbc9fcb 100644\n--- a/test/cmd_ut.c\n+++ b/test/cmd_ut.c\n@@ -60,6 +60,7 @@ SUITE_DECL(exit);\n SUITE_DECL(fdt);\n SUITE_DECL(fdt_overlay);\n SUITE_DECL(font);\n+SUITE_DECL(fs);\n SUITE_DECL(hush);\n SUITE_DECL(lib);\n SUITE_DECL(loadm);\n@@ -87,6 +88,7 @@ static struct suite suites[] = {\n \tSUITE(fdt, \"fdt command\"),\n \tSUITE(fdt_overlay, \"device tree overlays\"),\n \tSUITE(font, \"font command\"),\n+\tSUITE(fs, \"filesystem tests\"),\n \tSUITE(hush, \"hush behaviour\"),\n \tSUITE(lib, \"library functions\"),\n \tSUITE(loadm, \"loadm command parameters and loading memory blob\"),\ndiff --git a/test/fs/Makefile b/test/fs/Makefile\nnew file mode 100644\nindex 00000000000..5899be8e667\n--- /dev/null\n+++ b/test/fs/Makefile\n@@ -0,0 +1,3 @@\n+# SPDX-License-Identifier: GPL-2.0+\n+\n+obj-y += fs_basic.o\ndiff --git a/test/fs/fs_basic.c b/test/fs/fs_basic.c\nnew file mode 100644\nindex 00000000000..a6f1e056f5b\n--- /dev/null\n+++ b/test/fs/fs_basic.c\n@@ -0,0 +1,407 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * Basic filesystem tests - C implementation for Python wrapper\n+ *\n+ * These tests are marked UTF_MANUAL and are intended to be called from\n+ * test_basic.py which sets up the filesystem image and expected values.\n+ *\n+ * Copyright 2026 Canonical Ltd\n+ */\n+\n+#include <command.h>\n+#include <dm.h>\n+#include <env.h>\n+#include <fs.h>\n+#include <hexdump.h>\n+#include <image.h>\n+#include <linux/sizes.h>\n+#include <mapmem.h>\n+#include <test/fs.h>\n+#include <test/test.h>\n+#include <test/ut.h>\n+#include <u-boot/md5.h>\n+\n+/* Test constants matching fstest_defs.py */\n+#define ADDR\t0x01000008\n+\n+/*\n+ * Common argument indices. Each test declares only the arguments it needs,\n+ * so indices 2+ vary per test - see comments in each test.\n+ */\n+#define FS_ARG_TYPE\t0\t/* fs_type: ext4, fat, exfat, fs_generic */\n+#define FS_ARG_IMAGE\t1\t/* fs_image: path to filesystem image */\n+\n+/* Common arguments for all filesystem tests (indices 0 and 1) */\n+#define COMMON_ARGS \\\n+\t{ \"fs_type\", UT_ARG_STR }, \\\n+\t{ \"fs_image\", UT_ARG_STR }\n+\n+/**\n+ * get_fs_type(uts) - Get filesystem type enum from test argument\n+ *\n+ * Reads the fs_type argument and returns the appropriate FS_TYPE_* enum value.\n+ *\n+ * Return: filesystem type enum\n+ */\n+static int get_fs_type(struct unit_test_state *uts)\n+{\n+\tconst char *fs_type = ut_str(FS_ARG_TYPE);\n+\n+\tif (!fs_type)\n+\t\treturn FS_TYPE_ANY;\n+\n+\tif (!strcmp(fs_type, \"ext4\"))\n+\t\treturn FS_TYPE_EXT;\n+\tif (!strcmp(fs_type, \"fat\"))\n+\t\treturn FS_TYPE_FAT;\n+\tif (!strcmp(fs_type, \"exfat\"))\n+\t\treturn FS_TYPE_EXFAT;\n+\n+\t/* fs_generic uses FS_TYPE_ANY */\n+\treturn FS_TYPE_ANY;\n+}\n+\n+/* Set up the host filesystem block device */\n+static int set_fs(struct unit_test_state *uts)\n+{\n+\treturn fs_set_blk_dev(\"host\", \"0:0\", get_fs_type(uts));\n+}\n+\n+/* Build a path by prepending \"/\" to the leaf filename, with optional suffix */\n+static const char *getpath(struct unit_test_state *uts, const char *leaf,\n+\t\t\t   const char *suffix)\n+{\n+\tsnprintf(uts->priv, sizeof(uts->priv), \"/%s%s\", leaf, suffix ?: \"\");\n+\n+\treturn uts->priv;\n+}\n+\n+/**\n+ * prep_fs() - Prepare filesystem for testing\n+ *\n+ * Binds the fs_image argument as host device 0, sets up the block device,\n+ * and optionally returns a zeroed buffer.\n+ *\n+ * @uts: Unit test state\n+ * @len: Length of buffer to allocate and zero, or 0 for none\n+ * @bufp: Returns pointer to zeroed buffer, or NULL if @len is 0\n+ * Return: 0 on success, negative on error\n+ */\n+static int prep_fs(struct unit_test_state *uts, uint len, void **bufp)\n+{\n+\tconst char *fs_image = ut_str(FS_ARG_IMAGE);\n+\n+\tut_assertnonnull(fs_image);\n+\tut_assertok(run_commandf(\"host bind 0 %s\", fs_image));\n+\tut_assertok(set_fs(uts));\n+\n+\tif (len) {\n+\t\t*bufp = map_sysmem(ADDR, len);\n+\t\tmemset(*bufp, '\\0', len);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * fs_write_supported(uts) - Check if write is supported for current fs type\n+ *\n+ * Reads the fs_type argument and checks if write support is enabled\n+ * for that filesystem type.\n+ *\n+ * Return: true if write is supported, false otherwise\n+ */\n+static bool fs_write_supported(struct unit_test_state *uts)\n+{\n+\tconst char *fs_type = ut_str(FS_ARG_TYPE);\n+\n+\tif (!fs_type)\n+\t\treturn false;\n+\n+\tif (!strcmp(fs_type, \"ext4\"))\n+\t\treturn IS_ENABLED(CONFIG_EXT4_WRITE);\n+\tif (!strcmp(fs_type, \"fat\"))\n+\t\treturn IS_ENABLED(CONFIG_CMD_FAT_WRITE);\n+\n+\t/* fs_generic and exfat use generic write which is always available */\n+\treturn true;\n+}\n+\n+/**\n+ * verify_md5() - Calculate MD5 of buffer and verify against expected\n+ *\n+ * Uses arg 3 (md5val) as the expected MD5 hex string.\n+ *\n+ * @uts: Unit test state\n+ * @buf: Buffer to calculate MD5 of\n+ * @len: Length of buffer\n+ *\n+ * Return: 0 if MD5 matches, -EINVAL otherwise\n+ */\n+static int verify_md5(struct unit_test_state *uts, const void *buf, size_t len)\n+{\n+\tu8 digest[MD5_SUM_LEN], expected[MD5_SUM_LEN];\n+\tconst char *expected_hex = ut_str(3);\n+\n+\tut_assertok(hex2bin(expected, expected_hex, MD5_SUM_LEN));\n+\n+\tmd5_wd(buf, len, digest, CHUNKSZ_MD5);\n+\tut_asserteq_mem(expected, digest, MD5_SUM_LEN);\n+\n+\treturn 0;\n+}\n+\n+/* Test Case 1 - ls command, listing root directory and invalid directory */\n+static int fs_test_ls_norun(struct unit_test_state *uts)\n+{\n+\tconst char *small = ut_str(2);\n+\tconst char *big = ut_str(3);\n+\tstruct fs_dir_stream *dirs;\n+\tstruct fs_dirent *dent;\n+\tbool found_big = false, found_small = false, found_subdir = false;\n+\n+\tut_assertok(prep_fs(uts, 0, NULL));\n+\n+\t/* Test listing root directory */\n+\tdirs = fs_opendir(\"/\");\n+\tut_assertnonnull(dirs);\n+\n+\twhile ((dent = fs_readdir(dirs))) {\n+\t\tif (!strcmp(dent->name, big)) {\n+\t\t\tfound_big = true;\n+\t\t\tut_asserteq(FS_DT_REG, dent->type);\n+\t\t} else if (!strcmp(dent->name, small)) {\n+\t\t\tfound_small = true;\n+\t\t\tut_asserteq(FS_DT_REG, dent->type);\n+\t\t} else if (!strcmp(dent->name, \"SUBDIR\")) {\n+\t\t\tfound_subdir = true;\n+\t\t\tut_asserteq(FS_DT_DIR, dent->type);\n+\t\t}\n+\t}\n+\tfs_closedir(dirs);\n+\n+\tut_assert(found_big);\n+\tut_assert(found_small);\n+\tut_assert(found_subdir);\n+\n+\t/* Test invalid directory returns error */\n+\tut_assertok(set_fs(uts));\n+\tdirs = fs_opendir(\"/invalid_d\");\n+\tut_assertnull(dirs);\n+\n+\t/* Test file exists */\n+\tut_assertok(set_fs(uts));\n+\tut_assert(fs_exists(small));\n+\n+\t/* Test non-existent file */\n+\tut_assertok(set_fs(uts));\n+\tut_assert(!fs_exists(\"nonexistent.file\"));\n+\n+\treturn 0;\n+}\n+FS_TEST_ARGS(fs_test_ls_norun, UTF_SCAN_FDT | UTF_CONSOLE | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"small\", UT_ARG_STR }, { \"big\", UT_ARG_STR });\n+\n+/* Test Case 2 - size command for small file (1MB) */\n+static int fs_test_size_small_norun(struct unit_test_state *uts)\n+{\n+\tconst char *small = ut_str(2);\n+\tloff_t size;\n+\n+\tut_assertok(prep_fs(uts, 0, NULL));\n+\tut_assertok(fs_size(getpath(uts, small, NULL), &size));\n+\tut_asserteq(SZ_1M, size);\n+\n+\t/* Test size via path with '..' */\n+\tut_assertok(set_fs(uts));\n+\tsnprintf(uts->priv, sizeof(uts->priv), \"/SUBDIR/../%s\", small);\n+\tut_assertok(fs_size(uts->priv, &size));\n+\tut_asserteq(SZ_1M, size);\n+\n+\treturn 0;\n+}\n+FS_TEST_ARGS(fs_test_size_small_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"small\", UT_ARG_STR });\n+\n+/* Test Case 3 - size command for large file (2500 MiB) */\n+static int fs_test_size_big_norun(struct unit_test_state *uts)\n+{\n+\tconst char *big = ut_str(2);\n+\tloff_t size;\n+\n+\tut_assertok(prep_fs(uts, 0, NULL));\n+\tut_assertok(fs_size(getpath(uts, big, NULL), &size));\n+\tut_asserteq_64((loff_t)SZ_1M * 2500, size);  /* 2500 MiB = 0x9c400000 */\n+\n+\treturn 0;\n+}\n+FS_TEST_ARGS(fs_test_size_big_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"big\", UT_ARG_STR });\n+\n+/* Load a file at a given offset and verify the size and MD5 */\n+static int check_load(struct unit_test_state *uts, const char *fname,\n+\t\t      ulong offset, ulong read_len, ulong expect_len,\n+\t\t      bool check_md5)\n+{\n+\tloff_t actual;\n+\tvoid *buf;\n+\n+\tut_assertok(prep_fs(uts, expect_len, &buf));\n+\tut_assertok(fs_read(getpath(uts, fname, NULL), ADDR, offset, read_len,\n+\t\t\t    &actual));\n+\tut_asserteq(expect_len, actual);\n+\tif (check_md5)\n+\t\tut_assertok(verify_md5(uts, buf, expect_len));\n+\n+\treturn 0;\n+}\n+\n+/* Test Case 4 - load small file, verify MD5 */\n+static int fs_test_load_small_norun(struct unit_test_state *uts)\n+{\n+\treturn check_load(uts, ut_str(2), 0, 0, SZ_1M, true);\n+}\n+FS_TEST_ARGS(fs_test_load_small_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"small\", UT_ARG_STR }, { \"md5val\", UT_ARG_STR });\n+\n+/* Test Case 5 - load first 1MB of big file */\n+static int fs_test_load_big_first_norun(struct unit_test_state *uts)\n+{\n+\treturn check_load(uts, ut_str(2), 0, SZ_1M, SZ_1M, true);\n+}\n+FS_TEST_ARGS(fs_test_load_big_first_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"big\", UT_ARG_STR }, { \"md5val\", UT_ARG_STR });\n+\n+/* Test Case 6 - load last 1MB of big file (offset 0x9c300000) */\n+static int fs_test_load_big_last_norun(struct unit_test_state *uts)\n+{\n+\treturn check_load(uts, ut_str(2), 0x9c300000, SZ_1M, SZ_1M, true);\n+}\n+FS_TEST_ARGS(fs_test_load_big_last_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"big\", UT_ARG_STR }, { \"md5val\", UT_ARG_STR });\n+\n+/* Test Case 7 - load 1MB from last 1MB chunk of 2GB (offset 0x7ff00000) */\n+static int fs_test_load_big_2g_last_norun(struct unit_test_state *uts)\n+{\n+\treturn check_load(uts, ut_str(2), 0x7ff00000, SZ_1M, SZ_1M, true);\n+}\n+FS_TEST_ARGS(fs_test_load_big_2g_last_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"big\", UT_ARG_STR }, { \"md5val\", UT_ARG_STR });\n+\n+/* Test Case 8 - load first 1MB in 2GB region (offset 0x80000000) */\n+static int fs_test_load_big_2g_first_norun(struct unit_test_state *uts)\n+{\n+\treturn check_load(uts, ut_str(2), 0x80000000, SZ_1M, SZ_1M, true);\n+}\n+FS_TEST_ARGS(fs_test_load_big_2g_first_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"big\", UT_ARG_STR }, { \"md5val\", UT_ARG_STR });\n+\n+/* Test Case 9 - load 1MB crossing 2GB boundary (offset 0x7ff80000) */\n+static int fs_test_load_big_2g_cross_norun(struct unit_test_state *uts)\n+{\n+\treturn check_load(uts, ut_str(2), 0x7ff80000, SZ_1M, SZ_1M, true);\n+}\n+FS_TEST_ARGS(fs_test_load_big_2g_cross_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"big\", UT_ARG_STR }, { \"md5val\", UT_ARG_STR });\n+\n+/* Test Case 10 - load beyond file end (2MB from offset, only 1MB remains) */\n+static int fs_test_load_beyond_norun(struct unit_test_state *uts)\n+{\n+\treturn check_load(uts, ut_str(2), 0x9c300000, SZ_2M, SZ_1M, false);\n+}\n+FS_TEST_ARGS(fs_test_load_beyond_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"big\", UT_ARG_STR });\n+\n+/* Test Case 11 - write file */\n+static int fs_test_write_norun(struct unit_test_state *uts)\n+{\n+\tconst char *small = ut_str(2);\n+\tloff_t actread, actwrite;\n+\tvoid *buf;\n+\n+\tif (!fs_write_supported(uts))\n+\t\treturn -EAGAIN;\n+\n+\tut_assertok(prep_fs(uts, SZ_1M, &buf));\n+\n+\t/* Read small file */\n+\tut_assertok(fs_read(getpath(uts, small, NULL), ADDR, 0, 0, &actread));\n+\tut_asserteq(SZ_1M, actread);\n+\n+\t/* Write it back with new name */\n+\tut_assertok(set_fs(uts));\n+\tut_assertok(fs_write(getpath(uts, small, \".w\"), ADDR, 0, SZ_1M,\n+\t\t\t     &actwrite));\n+\tut_asserteq(SZ_1M, actwrite);\n+\n+\t/* Read back and verify MD5 */\n+\tut_assertok(set_fs(uts));\n+\tmemset(buf, '\\0', SZ_1M);\n+\tut_assertok(fs_read(getpath(uts, small, \".w\"), ADDR, 0, 0, &actread));\n+\tut_asserteq(SZ_1M, actread);\n+\n+\tut_assertok(verify_md5(uts, buf, SZ_1M));\n+\n+\treturn 0;\n+}\n+FS_TEST_ARGS(fs_test_write_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"small\", UT_ARG_STR }, { \"md5val\", UT_ARG_STR });\n+\n+/* Test Case 12 - write to \".\" directory (should fail) */\n+static int fs_test_write_dot_norun(struct unit_test_state *uts)\n+{\n+\tloff_t actwrite;\n+\n+\tif (!fs_write_supported(uts))\n+\t\treturn -EAGAIN;\n+\n+\tut_assertok(prep_fs(uts, 0, NULL));\n+\n+\t/* Writing to \".\" should fail */\n+\tut_assert(fs_write(\"/.\", ADDR, 0, 0x10, &actwrite));\n+\n+\treturn 0;\n+}\n+FS_TEST_ARGS(fs_test_write_dot_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS);\n+\n+/* Test Case 13 - write via \"./\" path */\n+static int fs_test_write_dotpath_norun(struct unit_test_state *uts)\n+{\n+\tconst char *small = ut_str(2);\n+\tloff_t actread, actwrite;\n+\tvoid *buf;\n+\n+\tif (!fs_write_supported(uts))\n+\t\treturn -EAGAIN;\n+\n+\tut_assertok(prep_fs(uts, SZ_1M, &buf));\n+\n+\t/* Read small file */\n+\tut_assertok(fs_read(getpath(uts, small, NULL), ADDR, 0, 0, &actread));\n+\tut_asserteq(SZ_1M, actread);\n+\n+\t/* Write via \"./\" path */\n+\tut_assertok(set_fs(uts));\n+\tsnprintf(uts->priv, sizeof(uts->priv), \"/./%s2\", small);\n+\tut_assertok(fs_write(uts->priv, ADDR, 0, SZ_1M, &actwrite));\n+\tut_asserteq(SZ_1M, actwrite);\n+\n+\t/* Read back via \"./\" path and verify */\n+\tut_assertok(set_fs(uts));\n+\tmemset(buf, '\\0', SZ_1M);\n+\tut_assertok(fs_read(uts->priv, ADDR, 0, 0, &actread));\n+\tut_asserteq(SZ_1M, actread);\n+\tut_assertok(verify_md5(uts, buf, SZ_1M));\n+\n+\t/* Also verify via normal path */\n+\tut_assertok(set_fs(uts));\n+\tmemset(buf, '\\0', SZ_1M);\n+\tut_assertok(fs_read(getpath(uts, small, \"2\"), ADDR, 0, 0, &actread));\n+\tut_asserteq(SZ_1M, actread);\n+\tut_assertok(verify_md5(uts, buf, SZ_1M));\n+\n+\treturn 0;\n+}\n+FS_TEST_ARGS(fs_test_write_dotpath_norun, UTF_SCAN_FDT | UTF_MANUAL,\n+\t     COMMON_ARGS, { \"small\", UT_ARG_STR }, { \"md5val\", UT_ARG_STR });\n",
    "prefixes": [
        "11/12"
    ]
}