All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/3] buildman: Perform tests in a temporary directory
@ 2019-10-07 21:17 Tom Rini
  2019-10-08 16:06 ` Stephen Warren
  2019-10-08 22:39 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Rini @ 2019-10-07 21:17 UTC (permalink / raw)
  To: u-boot

We may not always be able to write to the default output directory so
have a temporary directory for our output be created.

Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Suggested-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Changes in v2:
Switch to using a dynamic tmp dir, per Stephen.
---
 tools/buildman/func_test.py | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 119d02cbb2b6..f90b8ea7f5da 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -175,6 +175,7 @@ class TestFunctional(unittest.TestCase):
     """
     def setUp(self):
         self._base_dir = tempfile.mkdtemp()
+        self._output_dir = tempfile.mkdtemp()
         self._git_dir = os.path.join(self._base_dir, 'src')
         self._buildman_pathname = sys.argv[0]
         self._buildman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
@@ -207,6 +208,7 @@ class TestFunctional(unittest.TestCase):
 
     def tearDown(self):
         shutil.rmtree(self._base_dir)
+        shutil.rmtree(self._output_dir)
 
     def setupToolchains(self):
         self._toolchains = toolchain.Toolchains()
@@ -421,7 +423,7 @@ class TestFunctional(unittest.TestCase):
     def testCurrentSource(self):
         """Very simple test to invoke buildman on the current source"""
         self.setupToolchains();
-        self._RunControl()
+        self._RunControl('-o', self._output_dir)
         lines = terminal.GetPrintTestLines()
         self.assertIn('Building current source for %d boards' % len(boards),
                       lines[0].text)
@@ -434,7 +436,7 @@ class TestFunctional(unittest.TestCase):
     def testBadToolchain(self):
         """Test that missing toolchains are detected"""
         self.setupToolchains();
-        ret_code = self._RunControl('-b', TEST_BRANCH)
+        ret_code = self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
         lines = terminal.GetPrintTestLines()
 
         # Buildman always builds the upstream commit as well
@@ -458,13 +460,13 @@ class TestFunctional(unittest.TestCase):
 
     def testBranch(self):
         """Test building a branch with all toolchains present"""
-        self._RunControl('-b', TEST_BRANCH)
+        self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
         self.assertEqual(self._builder.count, self._total_builds)
         self.assertEqual(self._builder.fail, 0)
 
     def testCount(self):
         """Test building a specific number of commitst"""
-        self._RunControl('-b', TEST_BRANCH, '-c2')
+        self._RunControl('-b', TEST_BRANCH, '-c2', '-o', self._output_dir)
         self.assertEqual(self._builder.count, 2 * len(boards))
         self.assertEqual(self._builder.fail, 0)
         # Each board has a mrproper, config, and then one make per commit
@@ -472,34 +474,34 @@ class TestFunctional(unittest.TestCase):
 
     def testIncremental(self):
         """Test building a branch twice - the second time should do nothing"""
-        self._RunControl('-b', TEST_BRANCH)
+        self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
 
         # Each board has a mrproper, config, and then one make per commit
         self.assertEqual(self._make_calls, len(boards) * (self._commits + 2))
         self._make_calls = 0
-        self._RunControl('-b', TEST_BRANCH, clean_dir=False)
+        self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir, clean_dir=False)
         self.assertEqual(self._make_calls, 0)
         self.assertEqual(self._builder.count, self._total_builds)
         self.assertEqual(self._builder.fail, 0)
 
     def testForceBuild(self):
         """The -f flag should force a rebuild"""
-        self._RunControl('-b', TEST_BRANCH)
+        self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
         self._make_calls = 0
-        self._RunControl('-b', TEST_BRANCH, '-f', clean_dir=False)
+        self._RunControl('-b', TEST_BRANCH, '-f', '-o', self._output_dir, clean_dir=False)
         # Each board has a mrproper, config, and then one make per commit
         self.assertEqual(self._make_calls, len(boards) * (self._commits + 2))
 
     def testForceReconfigure(self):
         """The -f flag should force a rebuild"""
-        self._RunControl('-b', TEST_BRANCH, '-C')
+        self._RunControl('-b', TEST_BRANCH, '-C', '-o', self._output_dir)
         # Each commit has a mrproper, config and make
         self.assertEqual(self._make_calls, len(boards) * self._commits * 3)
 
     def testErrors(self):
         """Test handling of build errors"""
         self._error['board2', 1] = 'fred\n'
-        self._RunControl('-b', TEST_BRANCH)
+        self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
         self.assertEqual(self._builder.count, self._total_builds)
         self.assertEqual(self._builder.fail, 1)
 
@@ -507,13 +509,13 @@ class TestFunctional(unittest.TestCase):
         # not be rebuilt
         del self._error['board2', 1]
         self._make_calls = 0
-        self._RunControl('-b', TEST_BRANCH, clean_dir=False)
+        self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir, clean_dir=False)
         self.assertEqual(self._builder.count, self._total_builds)
         self.assertEqual(self._make_calls, 0)
         self.assertEqual(self._builder.fail, 1)
 
         # Now use the -F flag to force rebuild of the bad commit
-        self._RunControl('-b', TEST_BRANCH, '-F', clean_dir=False)
+        self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir, '-F', clean_dir=False)
         self.assertEqual(self._builder.count, self._total_builds)
         self.assertEqual(self._builder.fail, 0)
         self.assertEqual(self._make_calls, 3)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH v2 1/3] buildman: Perform tests in a temporary directory
  2019-10-07 21:17 [U-Boot] [PATCH v2 1/3] buildman: Perform tests in a temporary directory Tom Rini
@ 2019-10-08 16:06 ` Stephen Warren
  2019-10-08 22:39 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2019-10-08 16:06 UTC (permalink / raw)
  To: u-boot

On 10/7/19 3:17 PM, Tom Rini wrote:
> We may not always be able to write to the default output directory so
> have a temporary directory for our output be created.

Reviewed-by: Stephen Warren <swarren@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH v2 1/3] buildman: Perform tests in a temporary directory
  2019-10-07 21:17 [U-Boot] [PATCH v2 1/3] buildman: Perform tests in a temporary directory Tom Rini
  2019-10-08 16:06 ` Stephen Warren
@ 2019-10-08 22:39 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2019-10-08 22:39 UTC (permalink / raw)
  To: u-boot

On Mon, Oct 07, 2019 at 05:17:36PM -0400, Tom Rini wrote:

> We may not always be able to write to the default output directory so
> have a temporary directory for our output be created.
> 
> Cc: Simon Glass <sjg@chromium.org>
> Reviewed-by: Stephen Warren <swarren@wwwdotorg.org>
> Suggested-by: Stephen Warren <swarren@wwwdotorg.org>
> Signed-off-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191008/8fcbf34d/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-08 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 21:17 [U-Boot] [PATCH v2 1/3] buildman: Perform tests in a temporary directory Tom Rini
2019-10-08 16:06 ` Stephen Warren
2019-10-08 22:39 ` Tom Rini

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.