From patchwork Tue Oct 2 03:12:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 977609 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42PPZd3PvRz9s55 for ; Tue, 2 Oct 2018 13:21:45 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 272E1C22002; Tue, 2 Oct 2018 03:15:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 73ABCC21FB8; Tue, 2 Oct 2018 03:15:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 60FB1C21FBE; Tue, 2 Oct 2018 03:14:37 +0000 (UTC) Received: from mail-qk1-f201.google.com (mail-qk1-f201.google.com [209.85.222.201]) by lists.denx.de (Postfix) with ESMTPS id 91A2FC21FEB for ; Tue, 2 Oct 2018 03:14:33 +0000 (UTC) Received: by mail-qk1-f201.google.com with SMTP id g26-v6so520392qkm.20 for ; Mon, 01 Oct 2018 20:14:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zckqchPovqYGbnWcyCamwfUJ/VMA+xxc99+GpIlSPeM=; b=l2ThMd03PcEx144XZrW3dfvjlwnnMb/DAERHLgW/fWIAJ3CMLpAwqG3ZPKPT1YUfKX N6InNHKMW7HJWlpvfWSb2pM7XEPGa4E1XtFlsuQ0AIphLzuGTOpakzUSRqdjXEB0EqiQ wSFontnhpQqmltkyT0TS+kAQb/HvnCbkekryNLsS+pEJMlEbOfXenlub+rGJWng2WXwS K0mwqqafMhcGgJtS/YEg0fIUIHh9SCgag0Crxu9azLp5+S2yz2tSil2hUmRsZ2xGbTes gepSKfZYdovjmpg4elJs7BGS3nOQzEiVPb+wEdWR4660q5ApB3sFJdvTKO0yfx7b5WEy USGw== X-Gm-Message-State: ABuFfog28pBoqHjDIWCDwA/Kfl5hXswtuwBrO2yh5Z+xoH3PGlKgTKFL hfs1Md6K7gv9KIgN9/dpbf0T9mY= X-Google-Smtp-Source: ACcGV61aGjSvBlf7aKswYlGteZ701wImFzIiUjIx357UleJSvhWiTSoTBYrLJHiQIC4lqETmhWlwBKE= X-Received: by 2002:aed:36a7:: with SMTP id f36-v6mr80709qtb.60.1538450072763; Mon, 01 Oct 2018 20:14:32 -0700 (PDT) Date: Mon, 1 Oct 2018 21:12:41 -0600 In-Reply-To: <20181002031247.93384-1-sjg@chromium.org> Message-Id: <20181002031247.93384-12-sjg@chromium.org> Mime-Version: 1.0 References: <20181002031247.93384-1-sjg@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Alexander Graf Subject: [U-Boot] [PATCH v2 11/17] binman: Fix up removal of temporary directories X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 Signed-off-by: Simon Glass --- 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')