|
|
|
@ -196,6 +196,40 @@ class NinjaReclientTest(trial_dir.TestCase):
|
|
|
|
|
]),
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
@unittest.mock.patch.dict(os.environ, {})
|
|
|
|
|
@unittest.mock.patch('subprocess.call', return_value=0)
|
|
|
|
|
@unittest.mock.patch('ninja.main', return_value=0)
|
|
|
|
|
@unittest.mock.patch('reclient_metrics.check_status', return_value=True)
|
|
|
|
|
def test_ninja_reclient_clears_log_dir(self, mock_metrics_status, mock_ninja,
|
|
|
|
|
mock_call):
|
|
|
|
|
reclient_bin_dir = os.path.join('src', 'buildtools', 'reclient')
|
|
|
|
|
reclient_cfg = os.path.join('src', 'buildtools', 'reclient_cfgs',
|
|
|
|
|
'reproxy.cfg')
|
|
|
|
|
write('.gclient', '')
|
|
|
|
|
write('.gclient_entries', 'entries = {"buildtools": "..."}')
|
|
|
|
|
write(os.path.join(reclient_bin_dir, 'version.txt'), '0.0')
|
|
|
|
|
write(reclient_cfg, '0.0')
|
|
|
|
|
argv = ["ninja_reclient.py", "-C", "out/a", "chrome"]
|
|
|
|
|
|
|
|
|
|
os.makedirs(os.path.join(self.root_dir, "out", "a", ".reproxy_tmp", "logs"),
|
|
|
|
|
exist_ok=True)
|
|
|
|
|
with open(
|
|
|
|
|
os.path.join(self.root_dir, "out", "a", ".reproxy_tmp", "logs",
|
|
|
|
|
"reproxy.rpl"), "w") as f:
|
|
|
|
|
print("Content", file=f)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(0, ninja_reclient.main(argv))
|
|
|
|
|
|
|
|
|
|
self.assertTrue(
|
|
|
|
|
os.path.isdir(os.path.join(self.root_dir, "out", "a", ".reproxy_tmp")))
|
|
|
|
|
self.assertTrue(
|
|
|
|
|
os.path.isdir(
|
|
|
|
|
os.path.join(self.root_dir, "out", "a", ".reproxy_tmp", "logs")))
|
|
|
|
|
self.assertFalse(
|
|
|
|
|
os.path.isfile(
|
|
|
|
|
os.path.join(self.root_dir, "out", "a", ".reproxy_tmp", "logs",
|
|
|
|
|
"reproxy.rpl")))
|
|
|
|
|
|
|
|
|
|
@unittest.mock.patch('subprocess.call', return_value=0)
|
|
|
|
|
@unittest.mock.patch('ninja.main', side_effect=KeyboardInterrupt())
|
|
|
|
|
def test_ninja_reclient_ninja_interrupted(self, mock_ninja, mock_call):
|
|
|
|
|