All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 11/17] binman: Fix up removal of temporary directories
Date: Mon,  1 Oct 2018 21:12:41 -0600	[thread overview]
Message-ID: <20181002031247.93384-12-sjg@chromium.org> (raw)
In-Reply-To: <20181002031247.93384-1-sjg@chromium.org>

At present 'make check' leaves some temporary directories around. Part of
this is because we call tools.PrepareOutputDir() twice in some cases,
without calling tools.FinaliseOutputDir() in between.

Fix this.

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

Changes in v2: None

 tools/binman/elf_test.py   |  5 +++++
 tools/binman/entry_test.py |  8 ++++++--
 tools/binman/fdt_test.py   |  4 ++++
 tools/binman/ftest.py      |  8 +++-----
 tools/dtoc/test_fdt.py     | 10 +++++++---
 5 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index c16f71401d1..b68530c19ba 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -10,6 +10,7 @@ import unittest
 
 import elf
 import test_util
+import tools
 
 binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
 
@@ -46,6 +47,10 @@ class FakeSection:
 
 
 class TestElf(unittest.TestCase):
+    @classmethod
+    def setUpClass(self):
+        tools.SetInputDirs(['.'])
+
     def testAllSymbols(self):
         """Test that we can obtain a symbol from the ELF file"""
         fname = os.path.join(binman_dir, 'test', 'u_boot_ucode_ptr')
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
index 69d85b4cedb..a8bc938f9e9 100644
--- a/tools/binman/entry_test.py
+++ b/tools/binman/entry_test.py
@@ -14,9 +14,14 @@ import fdt_util
 import tools
 
 class TestEntry(unittest.TestCase):
+    def setUp(self):
+        tools.PrepareOutputDir(None)
+
+    def tearDown(self):
+        tools.FinaliseOutputDir()
+
     def GetNode(self):
         binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
-        tools.PrepareOutputDir(None)
         fname = fdt_util.EnsureCompiled(
             os.path.join(binman_dir,('test/05_simple.dts')))
         dtb = fdt.FdtScan(fname)
@@ -35,7 +40,6 @@ class TestEntry(unittest.TestCase):
         global entry
         reload(entry)
         entry.Entry.Create(None, self.GetNode(), 'u-boot-spl')
-        tools._RemoveOutputDir()
         del entry
 
     def testEntryContents(self):
diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py
index 8ea098f38ae..b9167012d25 100644
--- a/tools/binman/fdt_test.py
+++ b/tools/binman/fdt_test.py
@@ -21,6 +21,10 @@ class TestFdt(unittest.TestCase):
         self._indir = tempfile.mkdtemp(prefix='binmant.')
         tools.PrepareOutputDir(self._indir, True)
 
+    @classmethod
+    def tearDownClass(self):
+        tools._FinaliseForTest()
+
     def TestFile(self, fname):
         return os.path.join(self._binman_dir, 'test', fname)
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 57725c928e7..9ef259a699b 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -115,7 +115,6 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('ecrw.bin', CROS_EC_RW_DATA)
         TestFunctional._MakeInputDir('devkeys')
         TestFunctional._MakeInputFile('bmpblk.bin', BMPBLK_DATA)
-        self._output_setup = False
 
         # ELF file with a '_dt_ucode_base_size' symbol
         with open(self.TestFile('u_boot_ucode_ptr')) as fd:
@@ -230,14 +229,13 @@ class TestFunctional(unittest.TestCase):
         Returns:
             Contents of device-tree binary
         """
-        if not self._output_setup:
-            tools.PrepareOutputDir(self._indir, True)
-            self._output_setup = True
+        tools.PrepareOutputDir(None)
         dtb = fdt_util.EnsureCompiled(self.TestFile(fname))
         with open(dtb) as fd:
             data = fd.read()
             TestFunctional._MakeInputFile(outfile, data)
-            return data
+        tools.FinaliseOutputDir()
+        return data
 
     def _GetDtbContentsForSplTpl(self, dtb_data, name):
         """Create a version of the main DTB for SPL or SPL
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index d2597020500..2e6febe8f38 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -60,7 +60,7 @@ class TestFdt(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
-        tools._FinaliseForTest()
+        tools.FinaliseOutputDir()
 
     def setUp(self):
         self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
@@ -128,7 +128,7 @@ class TestNode(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
-        tools._FinaliseForTest()
+        tools.FinaliseOutputDir()
 
     def setUp(self):
         self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
@@ -209,7 +209,7 @@ class TestProp(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
-        tools._FinaliseForTest()
+        tools.FinaliseOutputDir()
 
     def setUp(self):
         self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
@@ -427,6 +427,10 @@ class TestFdtUtil(unittest.TestCase):
     def setUpClass(cls):
         tools.PrepareOutputDir(None)
 
+    @classmethod
+    def tearDownClass(cls):
+        tools.FinaliseOutputDir()
+
     def setUp(self):
         self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
         self.node = self.dtb.GetNode('/spl-test')
-- 
2.19.0.605.g01d371f741-goog

  parent reply	other threads:[~2018-10-02  3:12 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02  3:12 [U-Boot] [PATCH v2 00/17] test: Various test refinements and improvements Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 01/17] test/py: ignore console read exceptions after test failure Simon Glass
2018-10-04 16:01   ` Stephen Warren
2018-10-04 16:27     ` Simon Glass
2018-10-10  0:01     ` sjg at google.com
2018-10-02  3:12 ` [U-Boot] [PATCH v2 02/17] sandbox: Unprotect DATA regions in bus tests Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 03/17] patman: Handle unicode in _ProjectConfigParser tests Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 04/17] test/py: Fix unicode handling for log filtering Simon Glass
2018-10-05  8:08   ` Michal Simek
2018-10-10  0:01   ` sjg at google.com
2018-10-02  3:12 ` [U-Boot] [PATCH v2 05/17] buildman: Make the toolchain test more forgiving Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 06/17] Makefile: Add a 'check' target for make Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 07/17] test: Simplify the PATH setup Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 08/17] test: Print the name of each test before running it Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 09/17] test: Tidy up comments and variable name Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 10/17] binman: Add a default path to libfdt.py Simon Glass
2018-10-02  3:12 ` Simon Glass [this message]
2018-10-02  3:12 ` [U-Boot] [PATCH v2 12/17] binman: Separate out testSplBssPad() Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 13/17] buildman: dtoc: Suppress unwanted output from test Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 14/17] tools: Set an initial value for indir Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 15/17] patman: Don't clear progress in tout unless it was used Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 16/17] test: Reduce the number of tests run with sandbox_flattree Simon Glass
2018-10-02  3:12 ` [U-Boot] [PATCH v2 17/17] binman: Run tests concurrently Simon Glass
2018-10-10  0:01 ` sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 16/17] test: Reduce the number of tests run with sandbox_flattree sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 15/17] patman: Don't clear progress in tout unless it was used sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 14/17] tools: Set an initial value for indir sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 13/17] buildman: dtoc: Suppress unwanted output from test sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 12/17] binman: Separate out testSplBssPad() sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 11/17] binman: Fix up removal of temporary directories sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 10/17] binman: Add a default path to libfdt.py sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 09/17] test: Tidy up comments and variable name sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 08/17] test: Print the name of each test before running it sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 07/17] test: Simplify the PATH setup sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 06/17] Makefile: Add a 'check' target for make sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 05/17] buildman: Make the toolchain test more forgiving sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 03/17] patman: Handle unicode in _ProjectConfigParser tests sjg at google.com
2018-10-10  0:01 ` [U-Boot] [PATCH v2 02/17] sandbox: Unprotect DATA regions in bus tests sjg at google.com

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=20181002031247.93384-12-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.