summaryrefslogtreecommitdiff
path: root/tools/buildman/test.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-12-05 15:59:14 -0700
committerSimon Glass <sjg@chromium.org>2019-12-10 21:11:31 -0700
commit57cb9d52397c9051d7b3d27bd107cce04a16846f (patch)
tree107dfad7cd3d0fb03fb02800fa01a413d231212c /tools/buildman/test.py
parent7c66ead45267122c48bc854d1d5bd0d9a99bf943 (diff)
buildman: Add options to get the arch and toolchain info
Sometimes it is useful for external tools to use buildman to provide the toolchain information. Add an -a option which shows the value to use for the ARCH environment variable, and -A which does the same for CROSS_COMPILE Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman/test.py')
-rw-r--r--tools/buildman/test.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index b4e28d6867..acd862b3b0 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -451,6 +451,24 @@ class TestBuild(unittest.TestCase):
'crosstool/files/bin/x86_64/.*/'
'x86_64-gcc-.*-nolibc_arm-.*linux-gnueabi.tar.xz')
+ def testGetEnvArgs(self):
+ """Test the GetEnvArgs() function"""
+ tc = self.toolchains.Select('arm')
+ self.assertEqual('arm-linux-',
+ tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE))
+ self.assertEqual('', tc.GetEnvArgs(toolchain.VAR_PATH))
+ self.assertEqual('arm',
+ tc.GetEnvArgs(toolchain.VAR_ARCH))
+ self.assertEqual('', tc.GetEnvArgs(toolchain.VAR_MAKE_ARGS))
+
+ self.toolchains.Add('/path/to/x86_64-linux-gcc', test=False)
+ tc = self.toolchains.Select('x86')
+ self.assertEqual('/path/to',
+ tc.GetEnvArgs(toolchain.VAR_PATH))
+ tc.override_toolchain = 'clang'
+ self.assertEqual('HOSTCC=clang CC=clang',
+ tc.GetEnvArgs(toolchain.VAR_MAKE_ARGS))
+
if __name__ == "__main__":
unittest.main()