Bug 1266343 - Use an empty mozconfig from the source directory. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 20 Apr 2016 14:03:01 +0900
changeset 334283 4c9af0afbe1985a21bd50eba6c32419d6925aa28
parent 334282 af1d91535572df83a00c03926327d9b6ddfbd7ac
child 334284 98ac8c1e7fed89d704025fe8337a4f3c68546586
push id1146
push userCallek@gmail.com
push dateMon, 25 Jul 2016 16:35:44 +0000
treeherdermozilla-release@a55778f9cd5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1266343
milestone48.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 1266343 - Use an empty mozconfig from the source directory. r=chmanchester When configure unit tests use an empty mozconfig, instead of creating an empty temporary file, use an empty mozconfig from the source directory.
python/mozbuild/mozbuild/test/configure/common.py
python/mozbuild/mozbuild/test/configure/data/empty_mozconfig
--- a/python/mozbuild/mozbuild/test/configure/common.py
+++ b/python/mozbuild/mozbuild/test/configure/common.py
@@ -165,19 +165,23 @@ class BaseConfigureTest(unittest.TestCas
     def config_sub(self, stdin, args):
         return 0, args[0], ''
 
     def get_sandbox(self, paths, config, args=[], environ={}, mozconfig='',
                     out=None):
         if not out:
             out = StringIO()
 
-        fh, mozconfig_path = tempfile.mkstemp()
-        os.write(fh, mozconfig)
-        os.close(fh)
+        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')
 
         try:
             environ = dict(
                 environ,
                 OLD_CONFIGURE=os.path.join(topsrcdir, 'old-configure'),
                 MOZCONFIG=mozconfig_path)
 
             paths = dict(paths)
@@ -187,9 +191,10 @@ class BaseConfigureTest(unittest.TestCas
             paths[mozpath.join(autoconf_dir, 'config.sub')] = self.config_sub
 
             sandbox = ConfigureTestSandbox(paths, config, environ,
                                            ['configure'] + args, out, out)
             sandbox.include_file(os.path.join(topsrcdir, 'moz.configure'))
 
             return sandbox
         finally:
-            os.remove(mozconfig_path)
+            if mozconfig:
+                os.remove(mozconfig_path)
new file mode 100644