tools: format Python scripts
By default scripts without `.py` extension do not get picked up by
git cl format
Change-Id: I09bc6cb45adfae4909c38c5e399f04a9d8d016ed
diff --git a/tools/run_test_like_ci b/tools/run_test_like_ci
index 3a94ef9..e569b98 100755
--- a/tools/run_test_like_ci
+++ b/tools/run_test_like_ci
@@ -26,54 +26,53 @@
def main():
- parser = argparse.ArgumentParser()
- parser.add_argument('config', choices=JOB_CONFIGS.keys())
- args = parser.parse_args()
+ parser = argparse.ArgumentParser()
+ parser.add_argument('config', choices=JOB_CONFIGS.keys())
+ args = parser.parse_args()
- # Check that the directory is clean.
- git_cmd = ['git', '-C', REPO_ROOT, 'status', '--porcelain']
- modified_files = subprocess.check_output(git_cmd)
- if modified_files:
- print('The current Git repo has modified/untracked files.')
- print('The sandboxed VM will fetch the HEAD of your current git repo.')
- print('This is probably not the state you want to be in.')
- print('I suggest you press CTRL+C, commit and then re-run this script')
- print('Modified files:\n' + modified_files)
- raw_input('If you think you know what you are doing, press Enter instead')
+ # Check that the directory is clean.
+ git_cmd = ['git', '-C', REPO_ROOT, 'status', '--porcelain']
+ modified_files = subprocess.check_output(git_cmd)
+ if modified_files:
+ print('The current Git repo has modified/untracked files.')
+ print('The sandboxed VM will fetch the HEAD of your current git repo.')
+ print('This is probably not the state you want to be in.')
+ print('I suggest you press CTRL+C, commit and then re-run this script')
+ print('Modified files:\n' + modified_files)
+ raw_input('If you think you know what you are doing, press Enter instead')
- env = {
- 'PERFETTO_TEST_GIT_REF': 'file:///ci/source',
- }
- env.update(JOB_CONFIGS[args.config])
+ env = {
+ 'PERFETTO_TEST_GIT_REF': 'file:///ci/source',
+ }
+ env.update(JOB_CONFIGS[args.config])
- workdir = os.path.join(REPO_ROOT, 'out', 'tmp.ci')
- cmd = [
- 'sudo', '--', 'docker', 'run', '-it', '--name', 'perfetto_ci',
- '--cap-add', 'SYS_PTRACE', '--rm', '--volume',
- '%s:/ci/ramdisk' % workdir, '--tmpfs', '/tmp:exec',
- '--volume=%s:/ci/source:ro' % REPO_ROOT
- ]
- for kv in env.items():
- cmd += ['--env', '%s=%s' % kv]
- cmd += [SANDBOX_IMG]
- cmd += [
- 'bash', '-c',
- 'cd /ci/ramdisk; bash /ci/init.sh || sudo -u perfetto -EH bash -i'
- ]
+ workdir = os.path.join(REPO_ROOT, 'out', 'tmp.ci')
+ cmd = [
+ 'sudo', '--', 'docker', 'run', '-it', '--name', 'perfetto_ci',
+ '--cap-add', 'SYS_PTRACE', '--rm', '--volume',
+ '%s:/ci/ramdisk' % workdir, '--tmpfs', '/tmp:exec',
+ '--volume=%s:/ci/source:ro' % REPO_ROOT
+ ]
+ for kv in env.items():
+ cmd += ['--env', '%s=%s' % kv]
+ cmd += [SANDBOX_IMG]
+ cmd += [
+ 'bash', '-c',
+ 'cd /ci/ramdisk; bash /ci/init.sh || sudo -u perfetto -EH bash -i'
+ ]
- print('About to run\n', ' '.join(cmd))
- print('')
- print('The VM will have read-only acess to: %s, mounted as /ci/source' %
- REPO_ROOT)
- print('The VM workdir /ci/ramdisk will be mounted into: %s' % workdir)
- print(
- 'The contents of %s will be deleted before starting the VM' % workdir)
- raw_input('Press a key to continue')
+ print('About to run\n', ' '.join(cmd))
+ print('')
+ print('The VM will have read-only acess to: %s, mounted as /ci/source' %
+ REPO_ROOT)
+ print('The VM workdir /ci/ramdisk will be mounted into: %s' % workdir)
+ print('The contents of %s will be deleted before starting the VM' % workdir)
+ raw_input('Press a key to continue')
- shutil.rmtree(workdir, ignore_errors=True)
- os.makedirs(workdir)
- os.execvp(cmd[0], cmd[1:])
+ shutil.rmtree(workdir, ignore_errors=True)
+ os.makedirs(workdir)
+ os.execvp(cmd[0], cmd[1:])
if __name__ == '__main__':
- sys.exit(main())
+ sys.exit(main())