Bug 1270446 - Automatically add --target argument when unit test class has a TARGET attribute. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 22 Apr 2016 16:30:09 +0900
changeset 335387 61bae26a46bc5d4faad4b30cea95ec06f0c1a58f
parent 335386 c3573274d787f8477e3e7ee5f6287fb26da9f06a
child 335388 84a3e571680149b8fafcfc338aa4e0f27cb16050
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1270446
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1270446 - Automatically add --target argument when unit test class has a TARGET attribute. r=chmanchester
python/mozbuild/mozbuild/test/configure/common.py
python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
--- a/python/mozbuild/mozbuild/test/configure/common.py
+++ b/python/mozbuild/mozbuild/test/configure/common.py
@@ -171,16 +171,21 @@ class BaseConfigureTest(unittest.TestCas
         if logger:
             kwargs['logger'] = logger
         else:
             if not out:
                 out = StringIO()
             kwargs['stdout'] = out
             kwargs['stderr'] = out
 
+        if hasattr(self, 'TARGET'):
+            target = ['--target=%s' % self.TARGET]
+        else:
+            target = []
+
         if mozconfig:
             fh, mozconfig_path = tempfile.mkstemp()
             os.write(fh, mozconfig)
             os.close(fh)
         else:
             mozconfig_path = os.path.join(os.path.dirname(__file__), 'data',
                                           'empty_mozconfig')
 
@@ -192,15 +197,16 @@ class BaseConfigureTest(unittest.TestCas
 
             paths = dict(paths)
             autoconf_dir = mozpath.join(topsrcdir, 'build', 'autoconf')
             paths[mozpath.join(autoconf_dir,
                                'config.guess')] = self.config_guess
             paths[mozpath.join(autoconf_dir, 'config.sub')] = self.config_sub
 
             sandbox = ConfigureTestSandbox(paths, config, environ,
-                                           ['configure'] + args, **kwargs)
+                                           ['configure'] + target + args,
+                                           **kwargs)
             sandbox.include_file(os.path.join(topsrcdir, 'moz.configure'))
 
             return sandbox
         finally:
             if mozconfig:
                 os.remove(mozconfig_path)
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -659,16 +659,17 @@ class WindowsToolchainTest(BaseToolchain
             'cxx_compiler': self.CLANGXX_3_3_RESULT,
         }, environ={
             'CC': 'clang-3.3',
             'CXX': 'clang++-3.3',
         })
 
 
 class CrossCompileToolchainTest(BaseToolchainTest):
+    TARGET = 'arm-unknown-linux-gnu'
     PATHS = {
         '/usr/bin/arm-linux-gnu-gcc': GCC_4_9,
         '/usr/bin/arm-linux-gnu-g++': GXX_4_9,
         '/usr/bin/arm-linux-gnu-gcc-4.7': GCC_4_7,
         '/usr/bin/arm-linux-gnu-g++-4.7': GXX_4_7,
         '/usr/bin/arm-linux-gnu-gcc-5': GCC_5,
         '/usr/bin/arm-linux-gnu-g++-5': GXX_5,
     }
@@ -690,64 +691,64 @@ class CrossCompileToolchainTest(BaseTool
             'c_compiler': self.GCC_4_9_RESULT + {
                 'compiler': '/usr/bin/arm-linux-gnu-gcc',
             },
             'cxx_compiler': self.GXX_4_9_RESULT + {
                 'compiler': '/usr/bin/arm-linux-gnu-g++',
             },
             'host_c_compiler': self.GCC_4_9_RESULT,
             'host_cxx_compiler': self.GXX_4_9_RESULT,
-        }, args=['--target=arm-unknown-linux-gnu'])
+        })
 
     def test_overridden_cross_gcc(self):
         self.do_toolchain_test(self.PATHS, {
             'c_compiler': self.ARM_GCC_5_RESULT,
             'cxx_compiler': self.ARM_GXX_5_RESULT,
             'host_c_compiler': self.GCC_4_9_RESULT,
             'host_cxx_compiler': self.GXX_4_9_RESULT,
-        }, args=['--target=arm-unknown-linux-gnu'], environ={
+        }, environ={
             'CC': 'arm-linux-gnu-gcc-5',
             'CXX': 'arm-linux-gnu-g++-5',
         })
 
     def test_overridden_unsupported_cross_gcc(self):
         self.do_toolchain_test(self.PATHS, {
             'c_compiler': self.ARM_GCC_4_7_RESULT,
-        }, args=['--target=arm-unknown-linux-gnu'], environ={
+        }, environ={
             'CC': 'arm-linux-gnu-gcc-4.7',
             'CXX': 'arm-linux-gnu-g++-4.7',
         })
 
     def test_guess_cross_cxx(self):
         # When CXX is not set, we guess it from CC.
         self.do_toolchain_test(self.PATHS, {
             'c_compiler': self.ARM_GCC_5_RESULT,
             'cxx_compiler': self.ARM_GXX_5_RESULT,
             'host_c_compiler': self.GCC_4_9_RESULT,
             'host_cxx_compiler': self.GXX_4_9_RESULT,
-        }, args=['--target=arm-unknown-linux-gnu'], environ={
+        }, environ={
             'CC': 'arm-linux-gnu-gcc-5',
         })
 
         self.do_toolchain_test(self.PATHS, {
             'c_compiler': self.ARM_GCC_5_RESULT,
             'cxx_compiler': self.ARM_GXX_5_RESULT,
             'host_c_compiler': self.CLANG_3_6_RESULT,
             'host_cxx_compiler': self.CLANGXX_3_6_RESULT,
-        }, args=['--target=arm-unknown-linux-gnu'], environ={
+        }, environ={
             'CC': 'arm-linux-gnu-gcc-5',
             'HOST_CC': 'clang',
         })
 
         self.do_toolchain_test(self.PATHS, {
             'c_compiler': self.ARM_GCC_5_RESULT,
             'cxx_compiler': self.ARM_GXX_5_RESULT,
             'host_c_compiler': self.CLANG_3_6_RESULT,
             'host_cxx_compiler': self.CLANGXX_3_6_RESULT,
-        }, args=['--target=arm-unknown-linux-gnu'], environ={
+        }, environ={
             'CC': 'arm-linux-gnu-gcc-5',
             'CXX': 'arm-linux-gnu-g++-5',
             'HOST_CC': 'clang',
         })
 
 
 if __name__ == '__main__':
     main()