get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2219812,
    "url": "http://patchwork.ozlabs.org/api/patches/2219812/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260404140328.3724864-15-sjg@chromium.org/",
    "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": "<20260404140328.3724864-15-sjg@chromium.org>",
    "list_archive_url": null,
    "date": "2026-04-04T14:03:18",
    "name": "[14/14] test: Convert test_fs fixtures to use FsHelper",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "d405f9167fa54de9aed2f19f226411a27dfce702",
    "submitter": {
        "id": 6170,
        "url": "http://patchwork.ozlabs.org/api/people/6170/?format=api",
        "name": "Simon Glass",
        "email": "sjg@chromium.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260404140328.3724864-15-sjg@chromium.org/mbox/",
    "series": [
        {
            "id": 498729,
            "url": "http://patchwork.ozlabs.org/api/series/498729/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=498729",
            "date": "2026-04-04T14:03:04",
            "name": "test: Convert tests to use FsHelper and DiskHelper",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/498729/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2219812/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2219812/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=PY+ON3g8;\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=\"PY+ON3g8\";\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)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fny734Zscz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 01:06:07 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 81842841CD;\n\tSat,  4 Apr 2026 16:04:29 +0200 (CEST)",
            "by phobos.denx.de (Postfix, from userid 109)\n id 4BA56841D6; Sat,  4 Apr 2026 16:04:29 +0200 (CEST)",
            "from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com\n [IPv6:2607:f8b0:4864:20::32e])\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 B6A668419C\n for <u-boot@lists.denx.de>; Sat,  4 Apr 2026 16:04:26 +0200 (CEST)",
            "by mail-ot1-x32e.google.com with SMTP id\n 46e09a7af769-7dbcb467f2bso760345a34.3\n for <u-boot@lists.denx.de>; Sat, 04 Apr 2026 07:04:26 -0700 (PDT)",
            "from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id\n 586e51a60fabf-4232eb3d0e4sm2348235fac.6.2026.04.04.07.04.23\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 04 Apr 2026 07:04:23 -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=1775311464; x=1775916264; 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=ms9VRvuYO6+TEJI4Bs1br1pfUz6gOiYXR50tIbdNYPM=;\n b=PY+ON3g8xB7rePevPwajBESJhvzWbh8MkAQOYXESxFtfrY8MvVOIRxIdg2y+V62wbX\n FzER3r52JBlarR1ITMUH3i+wIGTL5Fre31Oz55s91fzGaEyvJ7tNnbOrvp6hxco/wypd\n X7fi44Okny33gs6nQvV0G1i4pogDp+mitaBcU=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775311464; x=1775916264;\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=ms9VRvuYO6+TEJI4Bs1br1pfUz6gOiYXR50tIbdNYPM=;\n b=Qy+K4w7h87ANjxncotGQKI6B+2O1VOklNl9z+VVB1zzdNf0H7cuJNVoARExCHduomB\n zljWRpNegk6QkUXaT9J/lHejGwvuiReBcb4r42TPem0c1DSgs2YGH+J3uSnkaaxJ6OmZ\n KlE1bI4X0q8tdvcdEbQ3pZudTUlni/kgtjekMMaVRmU3Q8UhcicIz/M+eHcoSWQ3Ool2\n z82LMgb2ne4bi/RkkiwmYjBYbSFgQjV0b4WpW8biEl4JntNWI93RWEFRuMLgC8OG6jCw\n FJGG/Ss1IeK2xghcFc3mgQrsi2IeHgHxrOXMSTo+8WIeP6rhVFSfdhtmF5iAzaxFBhzx\n csrQ==",
        "X-Gm-Message-State": "AOJu0Yz2H07lUgIVBp+iiDJ1kRTHP5GprZPqwIOWdAWIyJM9G4uxntJz\n spplPwNCXCRHLCtIMmXhH8nkY81ZxBNu2pbuwuLy+WkbCX2hGN+z4E6WvSCyrkE+ogjGpOTtWLU\n rOwE=",
        "X-Gm-Gg": "AeBDiesRVAwaPKe6t3GOGH7uw10EqDYsYmWqQbCx4F/KQppzBLAS+vML0g+5uwC35u1\n OEUzc2XbIzIQkLGm6JFahAkiT1fwElggZxqQp3fIlK87jwwcfqQZ3JBbuwr55QXNjiuvwjL99II\n eNCyIQiAltVw717xTToMn3rCpakX3oGIRVEEYE7QNSv+YCmLdoaZdlbU0H3X2CFUPcN7/QvPf+Y\n w9T6lADNvbJX90dC2n0FCIy4H9m8rDNcffNEtiMvk0znW9YgRxk1k+9ASayL08Ar3In8mvzAYVo\n 3YZx71ORy8gdGx6Ddge9xr08cpf510n7YTtWiC/j+mge90Y9KiQcEguUTzT8XsiRVuXdIaaCZyC\n aoebuPCGEVGzdOeuykk1QNv9GJX/Y846R0Z4tk7HycqQYpJ2wy0Wl53ncGOO15kvlolJkAebpGI\n J0B83kycQ5KORVJuP/Pw==",
        "X-Received": "by 2002:a05:6870:ff96:b0:41b:cc55:c398 with SMTP id\n 586e51a60fabf-4230fcd57b8mr3668204fac.15.1775311464259;\n Sat, 04 Apr 2026 07:04:24 -0700 (PDT)",
        "From": "Simon Glass <sjg@chromium.org>",
        "To": "u-boot@lists.denx.de",
        "Cc": "Simon Glass <sjg@chromium.org>, Marek Vasut <marex@denx.de>,\n Tom Rini <trini@konsulko.com>",
        "Subject": "[PATCH 14/14] test: Convert test_fs fixtures to use FsHelper",
        "Date": "Sat,  4 Apr 2026 08:03:18 -0600",
        "Message-ID": "<20260404140328.3724864-15-sjg@chromium.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260404140328.3724864-1-sjg@chromium.org>",
        "References": "<20260404140328.3724864-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": "Replace all direct calls to the mk_fs() function with FsHelper in the\nfilesystem test fixtures. Each fixture now creates an FsHelper instance,\npopulates its srcdir with test files, then calls mk_fs() on the object.\n\nThis removes manual scratch-directory management and cleanup code, since\nFsHelper handles the source directory and image-file lifecycle.\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\n test/py/tests/test_fs/conftest.py | 198 ++++++++++--------------------\n 1 file changed, 64 insertions(+), 134 deletions(-)",
    "diff": "diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py\nindex cc5c0fc3756..ba125cc7073 100644\n--- a/test/py/tests/test_fs/conftest.py\n+++ b/test/py/tests/test_fs/conftest.py\n@@ -9,7 +9,7 @@ import re\n from subprocess import call, check_call, check_output, CalledProcessError\n from fstest_defs import *\n # pylint: disable=E0611\n-from tests import fs_helper\n+from tests.fs_helper import FsHelper\n \n supported_fs_basic = ['fat16', 'fat32', 'exfat', 'ext4', 'fs_generic']\n supported_fs_ext = ['fat12', 'fat16', 'fat32', 'exfat', 'fs_generic']\n@@ -200,33 +200,26 @@ def fs_obj_basic(request, u_boot_config):\n     fs_type = request.param\n     fs_cmd_prefix = fstype_to_prefix(fs_type)\n     fs_cmd_write = 'save' if fs_type == 'fs_generic' or fs_type == 'exfat' else 'write'\n-    fs_img = ''\n \n     fs_ubtype = fstype_to_ubname(fs_type)\n     check_ubconfig(u_boot_config, fs_ubtype)\n \n-    scratch_dir = u_boot_config.persistent_data_dir + '/scratch'\n-\n-    small_file = scratch_dir + '/' + SMALL_FILE\n-    big_file = scratch_dir + '/' + BIG_FILE\n-\n+    fsh = FsHelper(u_boot_config, fs_type, 3072, '3GB')\n     try:\n-        check_call('mkdir -p %s' % scratch_dir, shell=True)\n-    except CalledProcessError as err:\n-        pytest.skip('Preparing mount folder failed for filesystem: ' + fs_type + '. {}'.format(err))\n-        call('rm -f %s' % fs_img, shell=True)\n-        return\n+        fsh.setup()\n+\n+        small_file = fsh.srcdir + '/' + SMALL_FILE\n+        big_file = fsh.srcdir + '/' + BIG_FILE\n \n-    try:\n         # Create a subdirectory.\n-        check_call('mkdir %s/SUBDIR' % scratch_dir, shell=True)\n+        check_call('mkdir %s/SUBDIR' % fsh.srcdir, shell=True)\n \n         # Create big file in this image.\n         # Note that we work only on the start 1MB, couple MBs in the 2GB range\n         # and the last 1 MB of the huge 2.5GB file.\n         # So, just put random values only in those areas.\n         check_call('dd if=/dev/urandom of=%s bs=1M count=1'\n-\t    % big_file, shell=True)\n+            % big_file, shell=True)\n         check_call('dd if=/dev/urandom of=%s bs=1M count=2 seek=2047'\n             % big_file, shell=True)\n         check_call('dd if=/dev/urandom of=%s bs=1M count=1 seek=2499'\n@@ -234,65 +227,54 @@ def fs_obj_basic(request, u_boot_config):\n \n         # Create a small file in this image.\n         check_call('dd if=/dev/urandom of=%s bs=1M count=1'\n-\t    % small_file, shell=True)\n-\n-        # Delete the small file copies which possibly are written as part of a\n-        # previous test.\n-        # check_call('rm -f \"%s.w\"' % MB1, shell=True)\n-        # check_call('rm -f \"%s.w2\"' % MB1, shell=True)\n+            % small_file, shell=True)\n \n         # Generate the md5sums of reads that we will test against small file\n         out = check_output(\n             'dd if=%s bs=1M skip=0 count=1 2> /dev/null | md5sum'\n-\t    % small_file, shell=True).decode()\n+            % small_file, shell=True).decode()\n         md5val = [ out.split()[0] ]\n \n         # Generate the md5sums of reads that we will test against big file\n         # One from beginning of file.\n         out = check_output(\n             'dd if=%s bs=1M skip=0 count=1 2> /dev/null | md5sum'\n-\t    % big_file, shell=True).decode()\n+            % big_file, shell=True).decode()\n         md5val.append(out.split()[0])\n \n         # One from end of file.\n         out = check_output(\n             'dd if=%s bs=1M skip=2499 count=1 2> /dev/null | md5sum'\n-\t    % big_file, shell=True).decode()\n+            % big_file, shell=True).decode()\n         md5val.append(out.split()[0])\n \n         # One from the last 1MB chunk of 2GB\n         out = check_output(\n             'dd if=%s bs=1M skip=2047 count=1 2> /dev/null | md5sum'\n-\t    % big_file, shell=True).decode()\n+            % big_file, shell=True).decode()\n         md5val.append(out.split()[0])\n \n         # One from the start 1MB chunk from 2GB\n         out = check_output(\n             'dd if=%s bs=1M skip=2048 count=1 2> /dev/null | md5sum'\n-\t    % big_file, shell=True).decode()\n+            % big_file, shell=True).decode()\n         md5val.append(out.split()[0])\n \n         # One 1MB chunk crossing the 2GB boundary\n         out = check_output(\n             'dd if=%s bs=512K skip=4095 count=2 2> /dev/null | md5sum'\n-\t    % big_file, shell=True).decode()\n+            % big_file, shell=True).decode()\n         md5val.append(out.split()[0])\n \n-        try:\n-            # 3GiB volume\n-            fs_img = fs_helper.mk_fs(u_boot_config, fs_type, 0xc0000000, '3GB', scratch_dir)\n-        except CalledProcessError as err:\n-            pytest.skip('Creating failed for filesystem: ' + fs_type + '. {}'.format(err))\n-            return\n+        fsh.mk_fs()\n \n     except CalledProcessError as err:\n         pytest.skip('Setup failed for filesystem: ' + fs_type + '. {}'.format(err))\n         return\n     else:\n-        yield [fs_ubtype, fs_cmd_prefix, fs_cmd_write, fs_img, md5val]\n+        yield [fs_ubtype, fs_cmd_prefix, fs_cmd_write, fsh.fs_img, md5val]\n     finally:\n-        call('rm -rf %s' % scratch_dir, shell=True)\n-        call('rm -f %s' % fs_img, shell=True)\n+        fsh.cleanup()\n \n #\n # Fixture for extended fs test\n@@ -312,26 +294,19 @@ def fs_obj_ext(request, u_boot_config):\n     fs_type = request.param\n     fs_cmd_prefix = fstype_to_prefix(fs_type)\n     fs_cmd_write = 'save' if fs_type == 'fs_generic' or fs_type == 'exfat' else 'write'\n-    fs_img = ''\n \n     fs_ubtype = fstype_to_ubname(fs_type)\n     check_ubconfig(u_boot_config, fs_ubtype)\n \n-    scratch_dir = u_boot_config.persistent_data_dir + '/scratch'\n-\n-    min_file = scratch_dir + '/' + MIN_FILE\n-    tmp_file = scratch_dir + '/tmpfile'\n-\n+    fsh = FsHelper(u_boot_config, fs_type, 128, '128MB')\n     try:\n-        check_call('mkdir -p %s' % scratch_dir, shell=True)\n-    except CalledProcessError as err:\n-        pytest.skip('Preparing mount folder failed for filesystem: ' + fs_type + '. {}'.format(err))\n-        call('rm -f %s' % fs_img, shell=True)\n-        return\n+        fsh.setup()\n+\n+        min_file = fsh.srcdir + '/' + MIN_FILE\n+        tmp_file = fsh.srcdir + '/tmpfile'\n \n-    try:\n         # Create a test directory\n-        check_call('mkdir %s/dir1' % scratch_dir, shell=True)\n+        check_call('mkdir %s/dir1' % fsh.srcdir, shell=True)\n \n         # Create a small file and calculate md5\n         check_call('dd if=/dev/urandom of=%s bs=1K count=20'\n@@ -370,21 +345,15 @@ def fs_obj_ext(request, u_boot_config):\n \n         check_call('rm %s' % tmp_file, shell=True)\n \n-        try:\n-            # 128MiB volume\n-            fs_img = fs_helper.mk_fs(u_boot_config, fs_type, 0x8000000, '128MB', scratch_dir)\n-        except CalledProcessError as err:\n-            pytest.skip('Creating failed for filesystem: ' + fs_type + '. {}'.format(err))\n-            return\n+        fsh.mk_fs()\n \n     except CalledProcessError:\n         pytest.skip('Setup failed for filesystem: ' + fs_type)\n         return\n     else:\n-        yield [fs_ubtype, fs_cmd_prefix, fs_cmd_write, fs_img, md5val]\n+        yield [fs_ubtype, fs_cmd_prefix, fs_cmd_write, fsh.fs_img, md5val]\n     finally:\n-        call('rm -rf %s' % scratch_dir, shell=True)\n-        call('rm -f %s' % fs_img, shell=True)\n+        fsh.cleanup()\n \n #\n # Fixture for mkdir test\n@@ -403,20 +372,19 @@ def fs_obj_mkdir(request, u_boot_config):\n     \"\"\"\n     fs_type = request.param\n     fs_cmd_prefix = fstype_to_prefix(fs_type)\n-    fs_img = ''\n \n     fs_ubtype = fstype_to_ubname(fs_type)\n     check_ubconfig(u_boot_config, fs_ubtype)\n \n+    fsh = FsHelper(u_boot_config, fs_type, 128, '128MB')\n     try:\n-        # 128MiB volume\n-        fs_img = fs_helper.mk_fs(u_boot_config, fs_type, 0x8000000, '128MB', None)\n+        fsh.mk_fs()\n     except:\n         pytest.skip('Setup failed for filesystem: ' + fs_type)\n         return\n     else:\n-        yield [fs_ubtype, fs_cmd_prefix, fs_img]\n-    call('rm -f %s' % fs_img, shell=True)\n+        yield [fs_ubtype, fs_cmd_prefix, fsh.fs_img]\n+    fsh.cleanup()\n \n #\n # Fixture for unlink test\n@@ -435,57 +403,44 @@ def fs_obj_unlink(request, u_boot_config):\n     \"\"\"\n     fs_type = request.param\n     fs_cmd_prefix = fstype_to_prefix(fs_type)\n-    fs_img = ''\n \n     fs_ubtype = fstype_to_ubname(fs_type)\n     check_ubconfig(u_boot_config, fs_ubtype)\n \n-    scratch_dir = u_boot_config.persistent_data_dir + '/scratch'\n-\n+    fsh = FsHelper(u_boot_config, fs_type, 128, '128MB')\n     try:\n-        check_call('mkdir -p %s' % scratch_dir, shell=True)\n-    except CalledProcessError as err:\n-        pytest.skip('Preparing mount folder failed for filesystem: ' + fs_type + '. {}'.format(err))\n-        call('rm -f %s' % fs_img, shell=True)\n-        return\n+        fsh.setup()\n \n-    try:\n         # Test Case 1 & 3\n-        check_call('mkdir %s/dir1' % scratch_dir, shell=True)\n+        check_call('mkdir %s/dir1' % fsh.srcdir, shell=True)\n         check_call('dd if=/dev/urandom of=%s/dir1/file1 bs=1K count=1'\n-                                    % scratch_dir, shell=True)\n+                                    % fsh.srcdir, shell=True)\n         check_call('dd if=/dev/urandom of=%s/dir1/file2 bs=1K count=1'\n-                                    % scratch_dir, shell=True)\n+                                    % fsh.srcdir, shell=True)\n \n         # Test Case 2\n-        check_call('mkdir %s/dir2' % scratch_dir, shell=True)\n+        check_call('mkdir %s/dir2' % fsh.srcdir, shell=True)\n         for i in range(0, 20):\n             check_call('mkdir %s/dir2/0123456789abcdef%02x'\n-                                    % (scratch_dir, i), shell=True)\n+                                    % (fsh.srcdir, i), shell=True)\n \n         # Test Case 4\n-        check_call('mkdir %s/dir4' % scratch_dir, shell=True)\n+        check_call('mkdir %s/dir4' % fsh.srcdir, shell=True)\n \n         # Test Case 5, 6 & 7\n-        check_call('mkdir %s/dir5' % scratch_dir, shell=True)\n+        check_call('mkdir %s/dir5' % fsh.srcdir, shell=True)\n         check_call('dd if=/dev/urandom of=%s/dir5/file1 bs=1K count=1'\n-                                    % scratch_dir, shell=True)\n+                                    % fsh.srcdir, shell=True)\n \n-        try:\n-            # 128MiB volume\n-            fs_img = fs_helper.mk_fs(u_boot_config, fs_type, 0x8000000, '128MB', scratch_dir)\n-        except CalledProcessError as err:\n-            pytest.skip('Creating failed for filesystem: ' + fs_type + '. {}'.format(err))\n-            return\n+        fsh.mk_fs()\n \n     except CalledProcessError:\n         pytest.skip('Setup failed for filesystem: ' + fs_type)\n         return\n     else:\n-        yield [fs_ubtype, fs_cmd_prefix, fs_img]\n+        yield [fs_ubtype, fs_cmd_prefix, fsh.fs_img]\n     finally:\n-        call('rm -rf %s' % scratch_dir, shell=True)\n-        call('rm -f %s' % fs_img, shell=True)\n+        fsh.cleanup()\n \n #\n # Fixture for symlink fs test\n@@ -503,26 +458,19 @@ def fs_obj_symlink(request, u_boot_config):\n         volume file name and  a list of MD5 hashes.\n     \"\"\"\n     fs_type = request.param\n-    fs_img = ''\n \n     fs_ubtype = fstype_to_ubname(fs_type)\n     check_ubconfig(u_boot_config, fs_ubtype)\n \n-    scratch_dir = u_boot_config.persistent_data_dir + '/scratch'\n-\n-    small_file = scratch_dir + '/' + SMALL_FILE\n-    medium_file = scratch_dir + '/' + MEDIUM_FILE\n-\n+    fsh = FsHelper(u_boot_config, fs_type, 1024, '1GB')\n     try:\n-        check_call('mkdir -p %s' % scratch_dir, shell=True)\n-    except CalledProcessError as err:\n-        pytest.skip('Preparing mount folder failed for filesystem: ' + fs_type + '. {}'.format(err))\n-        call('rm -f %s' % fs_img, shell=True)\n-        return\n+        fsh.setup()\n+\n+        small_file = fsh.srcdir + '/' + SMALL_FILE\n+        medium_file = fsh.srcdir + '/' + MEDIUM_FILE\n \n-    try:\n         # Create a subdirectory.\n-        check_call('mkdir %s/SUBDIR' % scratch_dir, shell=True)\n+        check_call('mkdir %s/SUBDIR' % fsh.srcdir, shell=True)\n \n         # Create a small file in this image.\n         check_call('dd if=/dev/urandom of=%s bs=1M count=1'\n@@ -542,21 +490,15 @@ def fs_obj_symlink(request, u_boot_config):\n             % medium_file, shell=True).decode()\n         md5val.extend([out.split()[0]])\n \n-        try:\n-            # 1GiB volume\n-            fs_img = fs_helper.mk_fs(u_boot_config, fs_type, 0x40000000, '1GB', scratch_dir)\n-        except CalledProcessError as err:\n-            pytest.skip('Creating failed for filesystem: ' + fs_type + '. {}'.format(err))\n-            return\n+        fsh.mk_fs()\n \n     except CalledProcessError:\n         pytest.skip('Setup failed for filesystem: ' + fs_type)\n         return\n     else:\n-        yield [fs_ubtype, fs_img, md5val]\n+        yield [fs_ubtype, fsh.fs_img, md5val]\n     finally:\n-        call('rm -rf %s' % scratch_dir, shell=True)\n-        call('rm -f %s' % fs_img, shell=True)\n+        fsh.cleanup()\n \n #\n # Fixture for rename test\n@@ -584,21 +526,15 @@ def fs_obj_rename(request, u_boot_config):\n         return out.decode().split()[0]\n \n     fs_type = request.param\n-    fs_img = ''\n \n     fs_ubtype = fstype_to_ubname(fs_type)\n     check_ubconfig(u_boot_config, fs_ubtype)\n \n-    mount_dir = u_boot_config.persistent_data_dir + '/scratch'\n-\n+    fsh = FsHelper(u_boot_config, fs_type, 128, '128MB')\n     try:\n-        check_call('mkdir -p %s' % mount_dir, shell=True)\n-    except CalledProcessError as err:\n-        pytest.skip('Preparing mount folder failed for filesystem: ' + fs_type + '. {}'.format(err))\n-        call('rm -f %s' % fs_img, shell=True)\n-        return\n+        fsh.setup()\n+        mount_dir = fsh.srcdir\n \n-    try:\n         md5val = {}\n         # Test Case 1\n         check_call('mkdir %s/test1' % mount_dir, shell=True)\n@@ -657,21 +593,15 @@ def fs_obj_rename(request, u_boot_config):\n         new_rand_file('%s/test11/dir1/file1' % mount_dir)\n         md5val['test11'] = file_hash('%s/test11/dir1/file1' % mount_dir)\n \n-        try:\n-            # 128MiB volume\n-            fs_img = fs_helper.mk_fs(u_boot_config, fs_type, 0x8000000, '128MB', mount_dir)\n-        except CalledProcessError as err:\n-            pytest.skip('Creating failed for filesystem: ' + fs_type + '. {}'.format(err))\n-            return\n+        fsh.mk_fs()\n \n     except CalledProcessError:\n         pytest.skip('Setup failed for filesystem: ' + fs_type)\n         return\n     else:\n-        yield [fs_ubtype, fs_img, md5val]\n+        yield [fs_ubtype, fsh.fs_img, md5val]\n     finally:\n-        call('rm -rf %s' % mount_dir, shell=True)\n-        call('rm -f %s' % fs_img, shell=True)\n+        fsh.cleanup()\n \n #\n # Fixture for fat test\n@@ -697,19 +627,19 @@ def fs_obj_fat(request, u_boot_config):\n     MIN_FAT16_SIZE = 8208 * 1024\n \n     fs_type = request.param\n-    fs_img = ''\n \n     fs_ubtype = fstype_to_ubname(fs_type)\n     check_ubconfig(u_boot_config, fs_ubtype)\n \n     fs_size = MAX_FAT12_SIZE if fs_type == 'fat12' else MIN_FAT16_SIZE\n+    size_mb = (fs_size + (1 << 20) - 1) >> 20\n \n+    fsh = FsHelper(u_boot_config, fs_type, size_mb, f'{fs_size}')\n     try:\n-        # the volume size depends on the filesystem\n-        fs_img = fs_helper.mk_fs(u_boot_config, fs_type, fs_size, f'{fs_size}')\n+        fsh.mk_fs()\n     except:\n         pytest.skip('Setup failed for filesystem: ' + fs_type)\n         return\n     else:\n-        yield [fs_ubtype, fs_img]\n-    call('rm -f %s' % fs_img, shell=True)\n+        yield [fs_ubtype, fsh.fs_img]\n+    fsh.cleanup()\n",
    "prefixes": [
        "14/14"
    ]
}