{"id":2222693,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2222693/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260413130007.1987326-7-sjg@chromium.org/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.1/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},"msgid":"<20260413130007.1987326-7-sjg@chromium.org>","date":"2026-04-13T12:59:57","name":"[v3,6/8] test: Convert FIT test to use a class","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"4c58cbbd41b43153fd4063e32a4639db3e2ba574","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/1.1/people/6170/?format=json","name":"Simon Glass","email":"sjg@chromium.org"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.1/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260413130007.1987326-7-sjg@chromium.org/mbox/","series":[{"id":499699,"url":"http://patchwork.ozlabs.org/api/1.1/series/499699/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=499699","date":"2026-04-13T12:59:52","name":"test: Refactor FIT test for clarity and extensibility","version":3,"mbox":"http://patchwork.ozlabs.org/series/499699/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2222693/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2222693/checks/","tags":{},"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=jwP3iij8;\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=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=\"jwP3iij8\";\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 [85.214.62.61])\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 4fvSHh2CW2z1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 23:02:40 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 9674183DC9;\n\tMon, 13 Apr 2026 15:01:53 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id C126C84206; Mon, 13 Apr 2026 15:01:48 +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 00A8784236\n for <u-boot@lists.denx.de>; Mon, 13 Apr 2026 15:01:40 +0200 (CEST)","by mail-ot1-x329.google.com with SMTP id\n 46e09a7af769-7d9bba96f7dso2285660a34.1\n for <u-boot@lists.denx.de>; Mon, 13 Apr 2026 06:01:40 -0700 (PDT)","from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id\n 46e09a7af769-7dc2696532bsm8369144a34.21.2026.04.13.06.01.36\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 13 Apr 2026 06:01:37 -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=1776085298; x=1776690098; 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=tBWRU7wrCJEL65puxhch7h85guQAWKdbuVbX+2ZPGGc=;\n b=jwP3iij8wRVwEP7I/Yq8kNFqcJFAbWaMrr13IN4QQLsSpg7KA4sycKHPE5YhEYyHEm\n 4UHs82vPvD2VWSN/RZwv5ruk8aWjfQdSmg6JKm+n3IgO71xo7t0HZz3yT/c2+xVF9eJu\n HdFwVW2r5sHDjWZkHB5OSIeOMqr7HTD4mx08E=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776085298; x=1776690098;\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=tBWRU7wrCJEL65puxhch7h85guQAWKdbuVbX+2ZPGGc=;\n b=J901+TjRq/2Zol2MLISmXM0OljZM9hBN8j4aOMyQ7zTKt4UpCsUjUZeLcRheHJ4Hvp\n 1by9fGyJfjLV9LbLeTLriNcPlNYGyY40Ks/lWMHFIsE6lRCvAuzGxwxo+F3hhHz/igL+\n okiF0vsX8XqMjPq2CZQ+aF0wjHxjwLTEEJ8aukhdFV6R3k4k5blbwNwfSi6s5Li3dony\n e4J1rYiYeBUygJ+599Ubob6zwkjCkDh/2K4DQYdym29KGRFWupDANhWKWbMJ0Z9QmhLl\n DavQcqn0xzmzj69GMq3c4Xc4yUMs5seavFXzeSU5/ILUVSpN5HRWUBlk+8GI6xil/NUF\n hucQ==","X-Gm-Message-State":"AOJu0YxAABXxUEpwtDTyZnDXUqSxcqaFnOF6hwbQ0J1wYRViWL3FcEn4\n PmrKGGSIWjKyhXcXgNKHlzK1vDycqQtdHCZeRCInCqUZ8szXy/4KaUx59fxNN/WL4iXpAFnhupG\n BzS7NXw==","X-Gm-Gg":"AeBDieu6NdtYx1yH5Cb8UsbTjsDoLAQmKc5AezdPHjWbs0a9+QxEJucq/ANs5fPIaHP\n VNXLF8SBs6jgbVL9VseIaagXXSL64tPmoWnWXqc98p4UJ3l+pHGZ0XLcdgGPb3OiAmd9cForW9l\n nH7+4PqAn5XjY6KAbl3JNUmG96NfPJMEVEv9145liAtfYq95Vo96VwgCr52aEJKophwIVv1djSZ\n Hd+0fzwokibaTi3Kt6Ff8tU4OMEpdPZB93VLFnYdjnyT5DhBf29CHHOAU3WgOQjZ2Mv7XaR8YKu\n VeW4WLFxXDhiaIIpJ0vA/sk6CRpWXzQdLkzylf/2InU0f/pgVm3V7vdTItAN15ii2Tm8eIixcdD\n jrPCJxM7y8SUEvQGkkj+/9xFXbQM0WK1azNbbn2IyeKBoqCCElRUlwTsdYaBLWhUxFBnDztCKnW\n JDHUU0yj8q1mandSw+cw==","X-Received":"by 2002:a05:6830:388a:b0:7d9:d54c:6fa4 with SMTP id\n 46e09a7af769-7dc27cbf0e0mr7786560a34.11.1776085298140;\n Mon, 13 Apr 2026 06:01:38 -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 v3 6/8] test: Convert FIT test to use a class","Date":"Mon, 13 Apr 2026 06:59:57 -0600","Message-ID":"<20260413130007.1987326-7-sjg@chromium.org>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260413130007.1987326-1-sjg@chromium.org>","References":"<20260413130007.1987326-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 v3:\n- Restore the find_matching() examples, wrapped in a code-block::\n\nChanges in v2:\n- Remove doctest examples from find_matching() to fix Sphinx warnings\n\n test/py/tests/test_fit.py | 256 +++++++++++++++++++++-----------------\n 1 file changed, 141 insertions(+), 115 deletions(-)","diff":"diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py\nindex 6a8649792cf..9a51d32bf49 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,28 @@ 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+            str: unmatched portion of line\n+\n+        Raises:\n             ValueError: If match is not found\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+        .. code-block:: python\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         \"\"\"\n         # pylint: disable=W0612\n         __tracebackhide__ = True\n@@ -213,7 +241,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 +250,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 +302,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 +335,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 +372,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":["v3","6/8"]}