diff mbox series

[U-Boot,47/53] binman: Add a test function to clean up the output dir

Message ID 20190720182416.183626-48-sjg@chromium.org
State Accepted
Commit bf574f129be2e2c7193024e0efac15d6b3496534
Delegated to: Simon Glass
Headers show
Series binman: Support replacing entries in an existing image | expand

Commit Message

Simon Glass July 20, 2019, 6:24 p.m. UTC
Put tearDown()'s logic into a new _CleanupOutputDir() function so that it
can be called from elsewhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/binman/ftest.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Simon Glass July 29, 2019, 9:21 p.m. UTC | #1
Put tearDown()'s logic into a new _CleanupOutputDir() function so that it
can be called from elsewhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/binman/ftest.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 12e32a0b5de..a490d394d86 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -187,6 +187,13 @@  class TestFunctional(unittest.TestCase):
         if not self.have_lz4:
             self.skipTest('lz4 --no-frame-crc not available')
 
+    def _CleanupOutputDir(self):
+        """Remove the temporary output directory"""
+        if self.preserve_outdirs:
+            print('Preserving output dir: %s' % tools.outdir)
+        else:
+            tools._FinaliseForTest()
+
     def setUp(self):
         # Enable this to turn on debugging output
         # tout.Init(tout.DEBUG)
@@ -194,10 +201,7 @@  class TestFunctional(unittest.TestCase):
 
     def tearDown(self):
         """Remove the temporary output directory"""
-        if self.preserve_outdirs:
-            print('Preserving output dir: %s' % tools.outdir)
-        else:
-            tools._FinaliseForTest()
+        self._CleanupOutputDir()
 
     @classmethod
     def _ResetDtbs(self):