]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
binman: Don't change the descriptor in tests
authorSimon Glass <sjg@chromium.org>
Sat, 25 Jul 2020 21:11:19 +0000 (15:11 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 27 Jul 2020 01:59:57 +0000 (19:59 -0600)
At present testPackX86RomMeNoDesc removes the contents of the
descriptor.bin file and testPackX86RomMeMissingDesc removes the file
completely.

If a test that relies on this file happens to run after it is removed, it
will not work. Since we have no control over the selecting of tests that
run in parallel and series, we must avoid changing the files.

Update this tests to use separate files instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/ftest.py
tools/binman/test/163_x86_rom_me_empty.dts [new file with mode: 0644]
tools/binman/test/164_x86_rom_me_missing.dts [new file with mode: 0644]

index ea72eff8c5d93f3109dca68605a2548f79059737..bf7f59fb8411e1303fc39eab47506e6cf1875ad2 100644 (file)
@@ -940,9 +940,9 @@ class TestFunctional(unittest.TestCase):
     def testPackX86RomMeNoDesc(self):
         """Test that an invalid Intel descriptor entry is detected"""
         try:
-            TestFunctional._MakeInputFile('descriptor.bin', b'')
+            TestFunctional._MakeInputFile('descriptor-empty.bin', b'')
             with self.assertRaises(ValueError) as e:
-                self._DoTestFile('031_x86_rom_me.dts')
+                self._DoTestFile('163_x86_rom_me_empty.dts')
             self.assertIn("Node '/binman/intel-descriptor': Cannot find Intel Flash Descriptor (FD) signature",
                           str(e.exception))
         finally:
@@ -3405,10 +3405,8 @@ class TestFunctional(unittest.TestCase):
 
     def testPackX86RomMeMissingDesc(self):
         """Test that an missing Intel descriptor entry is allowed"""
-        pathname = os.path.join(self._indir, 'descriptor.bin')
-        os.remove(pathname)
         with test_util.capture_sys_output() as (stdout, stderr):
-            self._DoTestFile('031_x86_rom_me.dts', allow_missing=True)
+            self._DoTestFile('164_x86_rom_me_missing.dts', allow_missing=True)
         err = stderr.getvalue()
         self.assertRegex(err,
                          "Image 'main-section'.*missing.*: intel-descriptor")
diff --git a/tools/binman/test/163_x86_rom_me_empty.dts b/tools/binman/test/163_x86_rom_me_empty.dts
new file mode 100644 (file)
index 0000000..9349d2d
--- /dev/null
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               sort-by-offset;
+               end-at-4gb;
+               size = <0x800000>;
+               intel-descriptor {
+                       filename = "descriptor-empty.bin";
+               };
+
+               intel-me {
+                       filename = "me.bin";
+                       offset-unset;
+               };
+       };
+};
diff --git a/tools/binman/test/164_x86_rom_me_missing.dts b/tools/binman/test/164_x86_rom_me_missing.dts
new file mode 100644 (file)
index 0000000..dce3be5
--- /dev/null
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               sort-by-offset;
+               end-at-4gb;
+               size = <0x800000>;
+               intel-descriptor {
+                       filename = "descriptor-missing.bin";
+               };
+
+               intel-me {
+                       filename = "me.bin";
+                       offset-unset;
+               };
+       };
+};