mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-28 23:50:26 +09:00
binman: Fix up removal of temporary directories
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>
This commit is contained in:
parent
ed59e005e6
commit
e0e6275f4c
@ -10,6 +10,7 @@ import unittest
|
|||||||
|
|
||||||
import elf
|
import elf
|
||||||
import test_util
|
import test_util
|
||||||
|
import tools
|
||||||
|
|
||||||
binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
|
binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||||
|
|
||||||
@ -46,6 +47,10 @@ class FakeSection:
|
|||||||
|
|
||||||
|
|
||||||
class TestElf(unittest.TestCase):
|
class TestElf(unittest.TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(self):
|
||||||
|
tools.SetInputDirs(['.'])
|
||||||
|
|
||||||
def testAllSymbols(self):
|
def testAllSymbols(self):
|
||||||
"""Test that we can obtain a symbol from the ELF file"""
|
"""Test that we can obtain a symbol from the ELF file"""
|
||||||
fname = os.path.join(binman_dir, 'test', 'u_boot_ucode_ptr')
|
fname = os.path.join(binman_dir, 'test', 'u_boot_ucode_ptr')
|
||||||
|
@ -14,9 +14,14 @@ import fdt_util
|
|||||||
import tools
|
import tools
|
||||||
|
|
||||||
class TestEntry(unittest.TestCase):
|
class TestEntry(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
tools.PrepareOutputDir(None)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
tools.FinaliseOutputDir()
|
||||||
|
|
||||||
def GetNode(self):
|
def GetNode(self):
|
||||||
binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
|
binman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||||
tools.PrepareOutputDir(None)
|
|
||||||
fname = fdt_util.EnsureCompiled(
|
fname = fdt_util.EnsureCompiled(
|
||||||
os.path.join(binman_dir,('test/05_simple.dts')))
|
os.path.join(binman_dir,('test/05_simple.dts')))
|
||||||
dtb = fdt.FdtScan(fname)
|
dtb = fdt.FdtScan(fname)
|
||||||
@ -35,7 +40,6 @@ class TestEntry(unittest.TestCase):
|
|||||||
global entry
|
global entry
|
||||||
reload(entry)
|
reload(entry)
|
||||||
entry.Entry.Create(None, self.GetNode(), 'u-boot-spl')
|
entry.Entry.Create(None, self.GetNode(), 'u-boot-spl')
|
||||||
tools._RemoveOutputDir()
|
|
||||||
del entry
|
del entry
|
||||||
|
|
||||||
def testEntryContents(self):
|
def testEntryContents(self):
|
||||||
|
@ -21,6 +21,10 @@ class TestFdt(unittest.TestCase):
|
|||||||
self._indir = tempfile.mkdtemp(prefix='binmant.')
|
self._indir = tempfile.mkdtemp(prefix='binmant.')
|
||||||
tools.PrepareOutputDir(self._indir, True)
|
tools.PrepareOutputDir(self._indir, True)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(self):
|
||||||
|
tools._FinaliseForTest()
|
||||||
|
|
||||||
def TestFile(self, fname):
|
def TestFile(self, fname):
|
||||||
return os.path.join(self._binman_dir, 'test', fname)
|
return os.path.join(self._binman_dir, 'test', fname)
|
||||||
|
|
||||||
|
@ -115,7 +115,6 @@ class TestFunctional(unittest.TestCase):
|
|||||||
TestFunctional._MakeInputFile('ecrw.bin', CROS_EC_RW_DATA)
|
TestFunctional._MakeInputFile('ecrw.bin', CROS_EC_RW_DATA)
|
||||||
TestFunctional._MakeInputDir('devkeys')
|
TestFunctional._MakeInputDir('devkeys')
|
||||||
TestFunctional._MakeInputFile('bmpblk.bin', BMPBLK_DATA)
|
TestFunctional._MakeInputFile('bmpblk.bin', BMPBLK_DATA)
|
||||||
self._output_setup = False
|
|
||||||
|
|
||||||
# ELF file with a '_dt_ucode_base_size' symbol
|
# ELF file with a '_dt_ucode_base_size' symbol
|
||||||
with open(self.TestFile('u_boot_ucode_ptr')) as fd:
|
with open(self.TestFile('u_boot_ucode_ptr')) as fd:
|
||||||
@ -230,14 +229,13 @@ class TestFunctional(unittest.TestCase):
|
|||||||
Returns:
|
Returns:
|
||||||
Contents of device-tree binary
|
Contents of device-tree binary
|
||||||
"""
|
"""
|
||||||
if not self._output_setup:
|
tools.PrepareOutputDir(None)
|
||||||
tools.PrepareOutputDir(self._indir, True)
|
|
||||||
self._output_setup = True
|
|
||||||
dtb = fdt_util.EnsureCompiled(self.TestFile(fname))
|
dtb = fdt_util.EnsureCompiled(self.TestFile(fname))
|
||||||
with open(dtb) as fd:
|
with open(dtb) as fd:
|
||||||
data = fd.read()
|
data = fd.read()
|
||||||
TestFunctional._MakeInputFile(outfile, data)
|
TestFunctional._MakeInputFile(outfile, data)
|
||||||
return data
|
tools.FinaliseOutputDir()
|
||||||
|
return data
|
||||||
|
|
||||||
def _GetDtbContentsForSplTpl(self, dtb_data, name):
|
def _GetDtbContentsForSplTpl(self, dtb_data, name):
|
||||||
"""Create a version of the main DTB for SPL or SPL
|
"""Create a version of the main DTB for SPL or SPL
|
||||||
|
@ -60,7 +60,7 @@ class TestFdt(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
tools._FinaliseForTest()
|
tools.FinaliseOutputDir()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
|
self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
|
||||||
@ -128,7 +128,7 @@ class TestNode(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
tools._FinaliseForTest()
|
tools.FinaliseOutputDir()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
|
self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
|
||||||
@ -209,7 +209,7 @@ class TestProp(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
tools._FinaliseForTest()
|
tools.FinaliseOutputDir()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
|
self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
|
||||||
@ -427,6 +427,10 @@ class TestFdtUtil(unittest.TestCase):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
tools.PrepareOutputDir(None)
|
tools.PrepareOutputDir(None)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
tools.FinaliseOutputDir()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
|
self.dtb = fdt.FdtScan('tools/dtoc/dtoc_test_simple.dts')
|
||||||
self.node = self.dtb.GetNode('/spl-test')
|
self.node = self.dtb.GetNode('/spl-test')
|
||||||
|
Loading…
Reference in New Issue
Block a user