summaryrefslogtreecommitdiff
path: root/tools/buildman/func_test.py
diff options
context:
space:
mode:
authorLothar Waßmann <LW@KARO-electronics.de>2018-04-08 05:14:11 -0600
committerSimon Glass <sjg@chromium.org>2018-05-16 00:25:19 -0600
commit409fc029c407291ac8c8d7fefa051a73912dc657 (patch)
treef3fbda45397d5cfeb2740650d85181c705568aad /tools/buildman/func_test.py
parent0315d6959fdd9d2a4d89016c311e9c8c8d239a10 (diff)
tools: buildman: Don't use the working dir as build dir
When the U-Boot base directory happens to have the same name as the branch that buildman is directed to use via the '-b' option and no output directory is specified with '-o', buildman happily starts removing the whole U-Boot sources eventually only stopped with the error message: OSError: [Errno 20] Not a directory: '../<branch-name>/boards.cfg Add a check to avoid this and also deal with the case where '-o' points to the source directory, or any subdirectory of it. Finally, tidy up the confusing logic for removing the old tree when using -b. This is only done when building a branch. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Lothar Waßmann <LW@KARO-electronics.de>
Diffstat (limited to 'tools/buildman/func_test.py')
-rw-r--r--tools/buildman/func_test.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 8d96c1a94da..9206fb299d4 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -519,3 +519,12 @@ class TestFunctional(unittest.TestCase):
self._RunControl('-b', self._test_branch, clean_dir=False)
self.assertEqual(self._builder.count, self._total_builds)
self.assertEqual(self._builder.fail, 0)
+
+ def testBadOutputDir(self):
+ """Test building with an output dir the same as out current dir"""
+ self._test_branch = '/__dev/__testbranch'
+ with self.assertRaises(SystemExit):
+ self._RunControl('-b', self._test_branch, '-o', os.getcwd())
+ with self.assertRaises(SystemExit):
+ self._RunControl('-b', self._test_branch, '-o',
+ os.path.join(os.getcwd(), 'test'))