{"id":2219910,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2219910/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260405111206.945185-7-sjg@chromium.org/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","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":"<20260405111206.945185-7-sjg@chromium.org>","list_archive_url":null,"date":"2026-04-05T11:11:51","name":"[v2,6/8] test: Convert FIT test to use a class","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"cebc97c16c2077cdacef106926cd472c128ea066","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/1.2/people/6170/?format=json","name":"Simon Glass","email":"sjg@chromium.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260405111206.945185-7-sjg@chromium.org/mbox/","series":[{"id":498774,"url":"http://patchwork.ozlabs.org/api/1.2/series/498774/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=498774","date":"2026-04-05T11:11:45","name":"test: Refactor FIT test for clarity and extensibility","version":2,"mbox":"http://patchwork.ozlabs.org/series/498774/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2219910/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2219910/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=XLQpYuoK;\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=\"XLQpYuoK\";\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 4fpVF73CBhz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 21:13:15 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id A8B138352B;\n\tSun,  5 Apr 2026 13:12:45 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 7EC0B8413A; Sun,  5 Apr 2026 13:12:44 +0200 (CEST)","from mail-oi1-x232.google.com (mail-oi1-x232.google.com\n [IPv6:2607:f8b0:4864:20::232])\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 964AA84020\n for <u-boot@lists.denx.de>; Sun,  5 Apr 2026 13:12:39 +0200 (CEST)","by mail-oi1-x232.google.com with SMTP id\n 5614622812f47-470145d7e6cso855239b6e.1\n for <u-boot@lists.denx.de>; Sun, 05 Apr 2026 04:12:39 -0700 (PDT)","from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id\n 5614622812f47-46d8d109b69sm6414382b6e.0.2026.04.05.04.12.34\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 05 Apr 2026 04:12:36 -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=1775387558; x=1775992358; 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=RHGXNRZou735kTQ298HxD8pKMu9DSY2KQ9df84X3d0g=;\n b=XLQpYuoKlkqQ/GpJUqmQbBpIUDF+fuR8GVQ/19IOMZZsQ26UWSD5uinJfejmeQHmXR\n gRsNtQhy2cvBHpR63DLIp82LQr6bU6B6WNfz/sM/MNZg5GDD3VU3k6lY++T0+631mf+5\n y5LTLpsgrGH2zUdH2aUD0aKNCl/BSEYKpZC5M=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775387558; x=1775992358;\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=RHGXNRZou735kTQ298HxD8pKMu9DSY2KQ9df84X3d0g=;\n b=Zysi8Guh74mbBQO/LSs793/3CMNP1cPzBnjBsv4XAKSSUx6zg5eR+L0K55LMky3PcM\n MwQrOA5JJWRWMjzT9RHGpYN8AtZWVMX0GGEFulFi5ctv/EBIAfow84bHNGRxBrjBX/eK\n MJ9ksvqxHT7SfezumcLt6glPB98JBJ5stHU7Hoo4dhmlkThOJv6P5a86JJR3oDzckcF7\n IsmoZCgS65hpFcNo9UWT57Bp3VovcIGAjSp2ajZ5KRsUkijrMwzxwxB/qkFAKGNlkk3t\n krrRBKBYYiG4nyVDPq/DmDM04FYyi77278Jy3yPqw9AplxMHnqITc/tJ5WFe/IEJGVug\n +jqQ==","X-Gm-Message-State":"AOJu0YzWof1zIgZiemzG1ph3qNDuYbH2afBbwVv+khkWvMQwIjGaMq+t\n c+Mjl8nAY9mNCYvahs61SQDqAWTMCQgDvKN6IAcLXRyb7ekHxmBZw+FRnpsDd9An5FBYICuzmM1\n b6snO5w==","X-Gm-Gg":"AeBDieuqDMK64IDZSInWiv7XaSO5z4NXQN+wD5sc8Uczp3l0tjlMnuqPBV3e2dJOtsb\n D5KKkkE5UaWAyd49nH71MA4qtKQY5Kg0CergkS6OzeWDtjUo7vu9MnYM1kUCmdFiw7mxyQcomEz\n 7NoxH4m8ViHdxPHabHNZPg5f3Kgjnk+69ujRuZXLPtbnFakvUt+extHjFFZOV5fD3oBTLIrdCHr\n Po0LzjEzqWFB87bK2+xmQaQFv4Mx9F2MfqYDzIyB6iTjZzvBYZrEpUgOPSmXWkSZ2CGOwIsOWUo\n EELRORJ5xgPg49VSKaaExu2R61XGOm4qGvwWN8vePF0+vJXTZr+e4DlZXFsXjaws0rUABklvqUC\n sMiQT2OSed1pcXwpKcCvpxHi9+Xa+p3uyKVH+gAVQiX7D4iq1PYNdwSxWdXFJWS3FJLt4/ploGC\n NcaGn8CDLKWTs8yFDFfw==","X-Received":"by 2002:a05:6808:2518:b0:467:19:d00d with SMTP id\n 5614622812f47-46ef21106dcmr5081273b6e.0.1775387557612;\n Sun, 05 Apr 2026 04:12:37 -0700 (PDT)","From":"Simon Glass <sjg@chromium.org>","To":"u-boot@lists.denx.de","Cc":"Simon Glass <sjg@chromium.org>,\n\tTom Rini <trini@konsulko.com>","Subject":"[PATCH v2 6/8] test: Convert FIT test to use a class","Date":"Sun,  5 Apr 2026 05:11:51 -0600","Message-ID":"<20260405111206.945185-7-sjg@chromium.org>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260405111206.945185-1-sjg@chromium.org>","References":"<20260405111206.945185-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":"Move this test over to use a class instead of a function, so we can\neasily split it into some related tests.\n\nMove the TODO so it is part of the comment for the class.\n\nTidy up some function comments while we are here.\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\nChanges in v2:\n- Remove doctest examples from find_matching() to fix Sphinx warnings\n\n test/py/tests/test_fit.py | 244 ++++++++++++++++++++------------------\n 1 file changed, 128 insertions(+), 116 deletions(-)","diff":"diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py\nindex 6a8649792cf..aec52985c65 100755\n--- a/test/py/tests/test_fit.py\n+++ b/test/py/tests/test_fit.py\n@@ -11,7 +11,7 @@ import fit_util\n import utils\n \n # Define a base ITS which we can adjust using % and a dictionary\n-base_its = '''\n+BASE_ITS = '''\n /dts-v1/;\n \n / {\n@@ -81,7 +81,7 @@ base_its = '''\n '''\n \n # Define a base FDT - currently we don't use anything in this\n-base_fdt = '''\n+BASE_FDT = '''\n /dts-v1/;\n \n / {\n@@ -104,7 +104,7 @@ base_fdt = '''\n # This is the U-Boot script that is run for each test. First load the FIT,\n # then run the 'bootm' command, then save out memory from the places where\n # we expect 'bootm' to write things. Then quit.\n-base_script = '''\n+BASE_SCRIPT = '''\n mw.b 0 0 160000\n host load hostfs 0 %(fit_addr)x %(fit)s\n fdt addr %(fit_addr)x\n@@ -120,45 +120,68 @@ host save hostfs 0 %(loadables2_addr)x %(loadables2_out)s %(loadables2_size)x\n @pytest.mark.boardspec('sandbox')\n @pytest.mark.buildconfigspec('fit')\n @pytest.mark.requiredtool('dtc')\n-def test_fit_base(ubman):\n-    def make_fname(leaf):\n+class TestFitImage:\n+    \"\"\"Test class for FIT image handling in U-Boot\n+\n+    TODO: Almost everything:\n+      - hash algorithms - invalid hash/contents should be detected\n+      - signature algorithms - invalid sig/contents should be detected\n+      - compression\n+      - checking that errors are detected like:\n+            - image overwriting\n+            - missing images\n+            - invalid configurations\n+            - incorrect os/arch/type fields\n+            - empty data\n+            - images too large/small\n+            - invalid FDT (e.g. putting a random binary in instead)\n+      - default configuration selection\n+      - bootm command line parameters should have desired effect\n+      - run code coverage to make sure we are testing all the code\n+    \"\"\"\n+\n+    def make_fname(self, ubman, leaf):\n         \"\"\"Make a temporary filename\n \n         Args:\n-            leaf: Leaf name of file to create (within temporary directory)\n+            ubman (ConsoleBase): U-Boot fixture\n+            leaf (str): Leaf name of file to create (within temporary directory)\n+\n         Return:\n-            Temporary filename\n+            str: Temporary filename\n         \"\"\"\n         return os.path.join(ubman.config.build_dir, leaf)\n \n-    def filesize(fname):\n+    def filesize(self, fname):\n         \"\"\"Get the size of a file\n \n         Args:\n-            fname: Filename to check\n+            fname (str): Filename to check\n+\n         Return:\n-            Size of file in bytes\n+            int: Size of file in bytes\n         \"\"\"\n         return os.stat(fname).st_size\n \n-    def read_file(fname):\n+    def read_file(self, fname):\n         \"\"\"Read the contents of a file\n \n         Args:\n-            fname: Filename to read\n-        Returns:\n-            Contents of file as a string\n+            fname (str): Filename to read\n+\n+        Return:\n+            str: Contents of file\n         \"\"\"\n         with open(fname, 'rb') as fd:\n             return fd.read()\n \n-    def make_ramdisk(filename, text):\n+    def make_ramdisk(self, ubman, filename, text):\n         \"\"\"Make a sample ramdisk with test data\n \n         Returns:\n-            Filename of ramdisk created\n+            str: Filename of ramdisk created\n         \"\"\"\n-        fname = make_fname(filename)\n+        fname = self.make_fname(ubman, filename)\n         data = ''\n         for i in range(100):\n             data += f'{text} {i} was seldom used in the middle ages\\n'\n@@ -166,11 +189,12 @@ def test_fit_base(ubman):\n             print(data, file=fd)\n         return fname\n \n-    def make_compressed(filename):\n+    def make_compressed(self, ubman, filename):\n+        \"\"\"Compress a file using gzip\"\"\"\n         utils.run_and_log(ubman, ['gzip', '-f', '-k', filename])\n         return filename + '.gz'\n \n-    def find_matching(text, match):\n+    def find_matching(self, text, match):\n         \"\"\"Find a match in a line of text, and return the unmatched line portion\n \n         This is used to extract a part of a line from some text. The match string\n@@ -184,24 +208,14 @@ def test_fit_base(ubman):\n         to use regex and return groups.\n \n         Args:\n-            text: Text to check (list of strings, one for each command issued)\n-            match: String to search for\n+            text (list of str): Text to check, one for each command issued\n+            match (str): String to search for\n+\n         Return:\n-            String containing unmatched portion of line\n-        Exceptions:\n-            ValueError: If match is not found\n+            str: unmatched portion of line\n \n-        >>> find_matching(['first line:10', 'second_line:20'], 'first line:')\n-        '10'\n-        >>> find_matching(['first line:10', 'second_line:20'], 'second line')\n-        Traceback (most recent call last):\n-          ...\n-        ValueError: Test aborted\n-        >>> find_matching('first line:10\\', 'second_line:20'], 'second_line:')\n-        '20'\n-        >>> find_matching('first line:10\\', 'second_line:20\\nthird_line:30'],\n-                          'third_line:')\n-        '30'\n+        Raises:\n+            ValueError: If match is not found\n         \"\"\"\n         # pylint: disable=W0612\n         __tracebackhide__ = True\n@@ -213,7 +227,7 @@ def test_fit_base(ubman):\n         pytest.fail(\"Expected '%s' but not found in output\")\n         return '<no-match>'\n \n-    def check_equal(expected_fname, actual_fname, failure_msg):\n+    def check_equal(self, expected_fname, actual_fname, failure_msg):\n         \"\"\"Check that a file matches its expected contents\n \n         This is always used on out-buffers whose size is decided by the test\n@@ -222,59 +236,50 @@ def test_fit_base(ubman):\n         expected data.\n \n         Args:\n-            expected_fname: Filename containing expected contents\n-            actual_fname: Filename containing actual contents\n-            failure_msg: Message to print on failure\n+            expected_fname (str): Filename containing expected contents\n+            actual_fname (str): Filename containing actual contents\n+            failure_msg (str): Message to print on failure\n         \"\"\"\n-        expected_data = read_file(expected_fname)\n-        actual_data = read_file(actual_fname)\n+        expected_data = self.read_file(expected_fname)\n+        actual_data = self.read_file(actual_fname)\n         if len(expected_data) < len(actual_data):\n             actual_data = actual_data[:len(expected_data)]\n         assert expected_data == actual_data, failure_msg\n \n-    def check_not_equal(expected_fname, actual_fname, failure_msg):\n+    def check_not_equal(self, expected_fname, actual_fname, failure_msg):\n         \"\"\"Check that a file does not match its expected contents\n \n         Args:\n-            expected_fname: Filename containing expected contents\n-            actual_fname: Filename containing actual contents\n-            failure_msg: Message to print on failure\n+            expected_fname (str): Filename containing expected contents\n+            actual_fname (str): Filename containing actual contents\n+            failure_msg (str): Message to print on failure\n         \"\"\"\n-        expected_data = read_file(expected_fname)\n-        actual_data = read_file(actual_fname)\n+        expected_data = self.read_file(expected_fname)\n+        actual_data = self.read_file(actual_fname)\n         assert expected_data != actual_data, failure_msg\n \n-    def run_fit_test(mkimage):\n+    def test_fit_operations(self, ubman):\n         \"\"\"Basic sanity check of FIT loading in U-Boot\n \n-        TODO: Almost everything:\n-          - hash algorithms - invalid hash/contents should be detected\n-          - signature algorithms - invalid sig/contents should be detected\n-          - compression\n-          - checking that errors are detected like:\n-                - image overwriting\n-                - missing images\n-                - invalid configurations\n-                - incorrect os/arch/type fields\n-                - empty data\n-                - images too large/small\n-                - invalid FDT (e.g. putting a random binary in instead)\n-          - default configuration selection\n-          - bootm command line parameters should have desired effect\n-          - run code coverage to make sure we are testing all the code\n+        This test covers various FIT configurations and verifies correct behavior.\n+\n+        Args:\n+            ubman (ConsoleBase): U-Boot fixture\n         \"\"\"\n+        mkimage = os.path.join(ubman.config.build_dir, 'tools/mkimage')\n+\n         # Set up invariant files\n-        fdt_data = fit_util.make_dtb(ubman, base_fdt, 'u-boot')\n+        fdt_data = fit_util.make_dtb(ubman, BASE_FDT, 'u-boot')\n         kernel = fit_util.make_kernel(ubman, 'test-kernel.bin', 'kernel')\n-        ramdisk = make_ramdisk('test-ramdisk.bin', 'ramdisk')\n+        ramdisk = self.make_ramdisk(ubman, 'test-ramdisk.bin', 'ramdisk')\n         loadables1 = fit_util.make_kernel(ubman, 'test-loadables1.bin', 'lenrek')\n-        loadables2 = make_ramdisk('test-loadables2.bin', 'ksidmar')\n-        kernel_out = make_fname('kernel-out.bin')\n-        fdt = make_fname('u-boot.dtb')\n-        fdt_out = make_fname('fdt-out.dtb')\n-        ramdisk_out = make_fname('ramdisk-out.bin')\n-        loadables1_out = make_fname('loadables1-out.bin')\n-        loadables2_out = make_fname('loadables2-out.bin')\n+        loadables2 = self.make_ramdisk(ubman, 'test-loadables2.bin', 'ksidmar')\n+        kernel_out = self.make_fname(ubman, 'kernel-out.bin')\n+        fdt = self.make_fname(ubman, 'u-boot.dtb')\n+        fdt_out = self.make_fname(ubman, 'fdt-out.dtb')\n+        ramdisk_out = self.make_fname(ubman, 'ramdisk-out.bin')\n+        loadables1_out = self.make_fname(ubman, 'loadables1-out.bin')\n+        loadables2_out = self.make_fname(ubman, 'loadables2-out.bin')\n \n         # Set up basic parameters with default values\n         params = {\n@@ -283,32 +288,32 @@ def test_fit_base(ubman):\n             'kernel' : kernel,\n             'kernel_out' : kernel_out,\n             'kernel_addr' : 0x40000,\n-            'kernel_size' : filesize(kernel),\n+            'kernel_size' : self.filesize(kernel),\n             'kernel_config' : 'kernel = \"kernel-1\";',\n \n             'fdt' : fdt,\n             'fdt_out' : fdt_out,\n             'fdt_addr' : 0x80000,\n-            'fdt_size' : filesize(fdt_data),\n+            'fdt_size' : self.filesize(fdt_data),\n             'fdt_load' : '',\n \n             'ramdisk' : ramdisk,\n             'ramdisk_out' : ramdisk_out,\n             'ramdisk_addr' : 0xc0000,\n-            'ramdisk_size' : filesize(ramdisk),\n+            'ramdisk_size' : self.filesize(ramdisk),\n             'ramdisk_load' : '',\n             'ramdisk_config' : '',\n \n             'loadables1' : loadables1,\n             'loadables1_out' : loadables1_out,\n             'loadables1_addr' : 0x100000,\n-            'loadables1_size' : filesize(loadables1),\n+            'loadables1_size' : self.filesize(loadables1),\n             'loadables1_load' : '',\n \n             'loadables2' : loadables2,\n             'loadables2_out' : loadables2_out,\n             'loadables2_addr' : 0x140000,\n-            'loadables2_size' : filesize(loadables2),\n+            'loadables2_size' : self.filesize(loadables2),\n             'loadables2_load' : '',\n \n             'loadables_config' : '',\n@@ -316,35 +321,35 @@ def test_fit_base(ubman):\n         }\n \n         # Make a basic FIT and a script to load it\n-        fit = fit_util.make_fit(ubman, mkimage, base_its, params)\n+        fit = fit_util.make_fit(ubman, mkimage, BASE_ITS, params)\n         params['fit'] = fit\n-        cmd = base_script % params\n+        cmd = BASE_SCRIPT % params\n \n         # First check that we can load a kernel\n         # We could perhaps reduce duplication with some loss of readability\n         with ubman.log.section('Kernel load'):\n             output = ubman.run_command_list(cmd.splitlines())\n-            check_equal(kernel, kernel_out, 'Kernel not loaded')\n-            check_not_equal(fdt_data, fdt_out,\n-                            'FDT loaded but should be ignored')\n-            check_not_equal(ramdisk, ramdisk_out,\n-                            'Ramdisk loaded but should not be')\n+            self.check_equal(kernel, kernel_out, 'Kernel not loaded')\n+            self.check_not_equal(fdt_data, fdt_out,\n+                                 'FDT loaded but should be ignored')\n+            self.check_not_equal(ramdisk, ramdisk_out,\n+                                 'Ramdisk loaded but should not be')\n \n             # Find out the offset in the FIT where U-Boot has found the FDT\n-            line = find_matching(output, 'Booting using the fdt blob at ')\n+            line = self.find_matching(output, 'Booting using the fdt blob at ')\n             fit_offset = int(line, 16) - params['fit_addr']\n             fdt_magic = struct.pack('>L', 0xd00dfeed)\n-            data = read_file(fit)\n+            data = self.read_file(fit)\n \n             # Now find where it actually is in the FIT (skip the first word)\n             real_fit_offset = data.find(fdt_magic, 4)\n             assert fit_offset == real_fit_offset, (\n-                  'U-Boot loaded FDT from offset %#x, FDT is actually at %#x' %\n-                  (fit_offset, real_fit_offset))\n+                    'U-Boot loaded FDT from offset %#x, FDT is actually at %#x' %\n+                    (fit_offset, real_fit_offset))\n \n-            # Check if bootargs strings substitution works\n+        # Check bootargs string substitution\n             output = ubman.run_command_list([\n-                'env set bootargs \\\\\\\"\\'my_boot_var=${foo}\\'\\\\\\\"',\n+                'env set bootargs \\\\\"\\'my_boot_var=${foo}\\'\\\\\"',\n                 'env set foo bar',\n                 'bootm prep',\n                 'env print bootargs'])\n@@ -353,56 +358,63 @@ def test_fit_base(ubman):\n         # Now a kernel and an FDT\n         with ubman.log.section('Kernel + FDT load'):\n             params['fdt_load'] = 'load = <%#x>;' % params['fdt_addr']\n-            fit = fit_util.make_fit(ubman, mkimage, base_its, params)\n+            fit = fit_util.make_fit(ubman, mkimage, BASE_ITS, params)\n+            params['fit'] = fit\n+            cmd = BASE_SCRIPT % params\n             output = ubman.run_command_list(cmd.splitlines())\n-            check_equal(kernel, kernel_out, 'Kernel not loaded')\n-            check_equal(fdt_data, fdt_out, 'FDT not loaded')\n-            check_not_equal(ramdisk, ramdisk_out,\n-                            'Ramdisk loaded but should not be')\n+            self.check_equal(kernel, kernel_out, 'Kernel not loaded')\n+            self.check_equal(fdt_data, fdt_out, 'FDT not loaded')\n+            self.check_not_equal(ramdisk, ramdisk_out,\n+                                 'Ramdisk loaded but should not be')\n \n         # Try a ramdisk\n         with ubman.log.section('Kernel + FDT + Ramdisk load'):\n             params['ramdisk_config'] = 'ramdisk = \"ramdisk-1\";'\n             params['ramdisk_load'] = 'load = <%#x>;' % params['ramdisk_addr']\n-            fit = fit_util.make_fit(ubman, mkimage, base_its, params)\n+            fit = fit_util.make_fit(ubman, mkimage, BASE_ITS, params)\n+            params['fit'] = fit\n+            cmd = BASE_SCRIPT % params\n             output = ubman.run_command_list(cmd.splitlines())\n-            check_equal(ramdisk, ramdisk_out, 'Ramdisk not loaded')\n+            self.check_equal(ramdisk, ramdisk_out, 'Ramdisk not loaded')\n \n         # Configuration with some Loadables\n         with ubman.log.section('Kernel + FDT + Ramdisk load + Loadables'):\n             params['loadables_config'] = 'loadables = \"kernel-2\", \"ramdisk-2\";'\n             params['loadables1_load'] = ('load = <%#x>;' %\n-                                         params['loadables1_addr'])\n+                                          params['loadables1_addr'])\n             params['loadables2_load'] = ('load = <%#x>;' %\n-                                         params['loadables2_addr'])\n-            fit = fit_util.make_fit(ubman, mkimage, base_its, params)\n+                                          params['loadables2_addr'])\n+            fit = fit_util.make_fit(ubman, mkimage, BASE_ITS, params)\n+            params['fit'] = fit\n+            cmd = BASE_SCRIPT % params\n             output = ubman.run_command_list(cmd.splitlines())\n-            check_equal(loadables1, loadables1_out,\n-                        'Loadables1 (kernel) not loaded')\n-            check_equal(loadables2, loadables2_out,\n-                        'Loadables2 (ramdisk) not loaded')\n+            self.check_equal(loadables1, loadables1_out,\n+                             'Loadables1 (kernel) not loaded')\n+            self.check_equal(loadables2, loadables2_out,\n+                             'Loadables2 (ramdisk) not loaded')\n \n         # Kernel, FDT and Ramdisk all compressed\n         with ubman.log.section('(Kernel + FDT + Ramdisk) compressed'):\n             params['compression'] = 'gzip'\n-            params['kernel'] = make_compressed(kernel)\n-            params['fdt'] = make_compressed(fdt)\n-            params['ramdisk'] = make_compressed(ramdisk)\n-            fit = fit_util.make_fit(ubman, mkimage, base_its, params)\n+            params['kernel'] = self.make_compressed(ubman, kernel)\n+            params['fdt'] = self.make_compressed(ubman, fdt)\n+            params['ramdisk'] = self.make_compressed(ubman, ramdisk)\n+            fit = fit_util.make_fit(ubman, mkimage, BASE_ITS, params)\n+            params['fit'] = fit\n+            cmd = BASE_SCRIPT % params\n             output = ubman.run_command_list(cmd.splitlines())\n-            check_equal(kernel, kernel_out, 'Kernel not loaded')\n-            check_equal(fdt_data, fdt_out, 'FDT not loaded')\n-            check_not_equal(ramdisk, ramdisk_out, 'Ramdisk got decompressed?')\n-            check_equal(ramdisk + '.gz', ramdisk_out, 'Ramdisk not loaded')\n+            self.check_equal(kernel, kernel_out, 'Kernel not loaded')\n+            self.check_equal(fdt_data, fdt_out, 'FDT not loaded')\n+            self.check_not_equal(ramdisk, ramdisk_out, 'Ramdisk got decompressed?')\n+            self.check_equal(ramdisk + '.gz', ramdisk_out, 'Ramdisk not loaded')\n \n         # Try without a kernel\n         with ubman.log.section('No kernel + FDT'):\n             params['kernel_config'] = ''\n             params['ramdisk_config'] = ''\n             params['ramdisk_load'] = ''\n-            fit = fit_util.make_fit(ubman, mkimage, base_its, params)\n+            fit = fit_util.make_fit(ubman, mkimage, BASE_ITS, params)\n+            params['fit'] = fit\n+            cmd = BASE_SCRIPT % params\n             output = ubman.run_command_list(cmd.splitlines())\n             assert \"can't get kernel image!\" in '\\n'.join(output)\n-\n-    mkimage = ubman.config.build_dir + '/tools/mkimage'\n-    run_fit_test(mkimage)\n","prefixes":["v2","6/8"]}