All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH] binman: Don't change the descriptor in tests
Date: Sat, 25 Jul 2020 15:24:46 -0600	[thread overview]
Message-ID: <20200725212446.1167399-1-sjg@chromium.org> (raw)

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                        |  8 +++----
 tools/binman/test/163_x86_rom_me_empty.dts   | 22 ++++++++++++++++++++
 tools/binman/test/164_x86_rom_me_missing.dts | 22 ++++++++++++++++++++
 3 files changed, 47 insertions(+), 5 deletions(-)
 create mode 100644 tools/binman/test/163_x86_rom_me_empty.dts
 create mode 100644 tools/binman/test/164_x86_rom_me_missing.dts

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index ea72eff8c5..bf7f59fb84 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -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
index 0000000000..9349d2d724
--- /dev/null
+++ b/tools/binman/test/163_x86_rom_me_empty.dts
@@ -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
index 0000000000..dce3be5e05
--- /dev/null
+++ b/tools/binman/test/164_x86_rom_me_missing.dts
@@ -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;
+		};
+	};
+};
-- 
2.28.0.rc0.142.g3c755180ce-goog

             reply	other threads:[~2020-07-25 21:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-25 21:24 Simon Glass [this message]
2020-07-27  2:01 ` [PATCH] binman: Don't change the descriptor in tests Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200725212446.1167399-1-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.