buildman: Introduce an 'and' operator for board selection
Currently buildman allows a list of boards to build to be specified on the
command line. The list can include specific board names, architecture, SOC
and so on.
At present the list of boards is dealt with in an 'OR' fashion, and there
is no way to specify something like 'arm & freescale', meaning boards with
ARM architecture but only those made by Freescale. This would exclude the
PowerPC boards made by Freescale.
Support an '&' operator on the command line to permit this. Ensure that
arguments can be specified in a single string to permit easy shell quoting.
Suggested-by: York Sun <yorksun@freescale.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: York Sun <yorksun@freescale.com>
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 502c9b4..a51c942 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -165,5 +165,53 @@
args = ['tegra20']
control.DoBuildman(options, args)
+ def testBoardSingle(self):
+ """Test single board selection"""
+ self.assertEqual(self.boards.SelectBoards(['sandbox']),
+ {'all': 1, 'sandbox': 1})
+
+ def testBoardArch(self):
+ """Test single board selection"""
+ self.assertEqual(self.boards.SelectBoards(['arm']),
+ {'all': 2, 'arm': 2})
+
+ def testBoardArchSingle(self):
+ """Test single board selection"""
+ self.assertEqual(self.boards.SelectBoards(['arm sandbox']),
+ {'all': 3, 'arm': 2, 'sandbox' : 1})
+
+ def testBoardArchSingleMultiWord(self):
+ """Test single board selection"""
+ self.assertEqual(self.boards.SelectBoards(['arm', 'sandbox']),
+ {'all': 3, 'arm': 2, 'sandbox' : 1})
+
+ def testBoardSingleAnd(self):
+ """Test single board selection"""
+ self.assertEqual(self.boards.SelectBoards(['Tester & arm']),
+ {'all': 2, 'Tester&arm': 2})
+
+ def testBoardTwoAnd(self):
+ """Test single board selection"""
+ self.assertEqual(self.boards.SelectBoards(['Tester', '&', 'arm',
+ 'Tester' '&', 'powerpc',
+ 'sandbox']),
+ {'all': 5, 'Tester&powerpc': 2, 'Tester&arm': 2,
+ 'sandbox' : 1})
+
+ def testBoardAll(self):
+ """Test single board selection"""
+ self.assertEqual(self.boards.SelectBoards([]), {'all': 5})
+
+ def testBoardRegularExpression(self):
+ """Test single board selection"""
+ self.assertEqual(self.boards.SelectBoards(['T.*r&^Po']),
+ {'T.*r&^Po': 2, 'all': 2})
+
+ def testBoardDuplicate(self):
+ """Test single board selection"""
+ self.assertEqual(self.boards.SelectBoards(['sandbox sandbox',
+ 'sandbox']),
+ {'all': 1, 'sandbox': 1})
+
if __name__ == "__main__":
unittest.main()