def _get_resolver(self): topobjdir = tempfile.mkdtemp() self._temp_dirs.append(topobjdir) with open(os.path.join(topobjdir, "all-tests.json"), "wt") as fh: fh.write(ALL_TESTS_JSON) o = MozbuildObject(self.FAKE_TOPSRCDIR, None, None, topobjdir=topobjdir) return o._spawn(TestResolver)
def _get_resolver(self): topobjdir = tempfile.mkdtemp() self._temp_dirs.append(topobjdir) with open(os.path.join(topobjdir, 'all-tests.json'), 'wt') as fh: fh.write(ALL_TESTS_JSON) o = MozbuildObject(self.FAKE_TOPSRCDIR, None, None, topobjdir=topobjdir) return o._spawn(TestResolver)
def _get_resolver(self): topobjdir = tempfile.mkdtemp() self._temp_dirs.append(topobjdir) with open(os.path.join(topobjdir, 'all-tests.json'), 'wt') as fh: fh.write(ALL_TESTS_JSON) o = MozbuildObject(self.FAKE_TOPSRCDIR, None, None, topobjdir=topobjdir) # Monkey patch the test resolver to avoid tests failing to find make # due to our fake topscrdir. TestResolver._run_make = lambda *a, **b: None return o._spawn(TestResolver)
def _get_resolver(self): topobjdir = tempfile.mkdtemp() self._temp_dirs.append(topobjdir) with open(os.path.join(topobjdir, 'all-tests.pkl'), 'wb') as fh: pickle.dump(ALL_TESTS, fh) with open(os.path.join(topobjdir, 'test-defaults.pkl'), 'wb') as fh: pickle.dump(TEST_DEFAULTS, fh) o = MozbuildObject(self.FAKE_TOPSRCDIR, None, None, topobjdir=topobjdir) # Monkey patch the test resolver to avoid tests failing to find make # due to our fake topscrdir. TestResolver._run_make = lambda *a, **b: None return o._spawn(TestResolver)
def _get_resolver(self): topobjdir = tempfile.mkdtemp() self._temp_dirs.append(topobjdir) with open(os.path.join(topobjdir, 'all-tests.pkl'), 'wb') as fh: pickle.dump(ALL_TESTS, fh) with open(os.path.join(topobjdir, 'test-defaults.pkl'), 'wb') as fh: pickle.dump(TEST_DEFAULTS, fh) o = MozbuildObject(self.FAKE_TOPSRCDIR, None, None, topobjdir=topobjdir) # Monkey patch the test resolver to avoid tests failing to find make # due to our fake topscrdir. TestResolver._run_make = lambda *a, **b: None return o._spawn(TestResolver)
def _get_resolver(self): topobjdir = tempfile.mkdtemp() self._temp_dirs.append(topobjdir) with open(os.path.join(topobjdir, 'all-tests.json'), 'wt') as fh: fh.write(ALL_TESTS_JSON) o = MozbuildObject(self.FAKE_TOPSRCDIR, None, None, topobjdir=topobjdir) # Monkey patch the test resolver to avoid tests failing to find make # due to our fake topscrdir. TestResolver._run_make = lambda *a, **b: None return o._spawn(TestResolver)
def test_mozconfig_opt_in(self): """Auto clobber iff AUTOCLOBBER is in the environment.""" topsrcdir = self.get_topsrcdir() topobjdir = self.get_tempdir() obj_clobber = os.path.join(topobjdir, 'CLOBBER') with open(obj_clobber, 'a'): pass dummy_file = os.path.join(topobjdir, 'dummy_file') with open(dummy_file, 'a'): pass self.assertTrue(os.path.exists(dummy_file)) old_time = os.path.getmtime(os.path.join(topsrcdir, 'CLOBBER')) - 60 os.utime(obj_clobber, (old_time, old_time)) # Check auto clobber is off by default env = dict(os.environ) if env.get('AUTOCLOBBER', False): del env['AUTOCLOBBER'] mbo = MozbuildObject(topsrcdir, None, None, topobjdir) build = mbo._spawn(BuildDriver) status = build._check_clobber(build.mozconfig, env) self.assertEqual(status, True) self.assertTrue(os.path.exists(dummy_file)) # Check auto clobber opt-in works env['AUTOCLOBBER'] = '1' status = build._check_clobber(build.mozconfig, env) self.assertFalse(status) self.assertFalse(os.path.exists(dummy_file))
def test_mozconfig_opt_in(self): """Auto clobber iff AUTOCLOBBER is in the environment.""" topsrcdir = self.get_topsrcdir() topobjdir = self.get_tempdir() obj_clobber = os.path.join(topobjdir, 'CLOBBER') with open(obj_clobber, 'a'): pass dummy_file = os.path.join(topobjdir, 'dummy_file') with open(dummy_file, 'a'): pass self.assertTrue(os.path.exists(dummy_file)) old_time = os.path.getmtime(os.path.join(topsrcdir, 'CLOBBER')) - 60 os.utime(obj_clobber, (old_time, old_time)) # Check auto clobber is off by default env = dict(os.environ) if env.get('AUTOCLOBBER', False): del env['AUTOCLOBBER'] mbo = MozbuildObject(topsrcdir, None, None, topobjdir) build = mbo._spawn(BuildDriver) status = build._check_clobber(build.mozconfig, env) self.assertEqual(status, True) self.assertTrue(os.path.exists(dummy_file)) # Check auto clobber opt-in works env['AUTOCLOBBER'] = '1' status = build._check_clobber(build.mozconfig, env) self.assertFalse(status) self.assertFalse(os.path.exists(dummy_file))