OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """MB - the Meta-Build wrapper around GYP and GN | 6 """MB - the Meta-Build wrapper around GYP and GN |
7 | 7 |
8 MB is a wrapper script for GYP and GN that can be used to generate build files | 8 MB is a wrapper script for GYP and GN that can be used to generate build files |
9 for sets of canned configurations and analyze them. | 9 for sets of canned configurations and analyze them. |
10 """ | 10 """ |
11 | 11 |
12 from __future__ import print_function | 12 from __future__ import print_function |
13 | 13 |
14 import argparse | 14 import argparse |
15 import ast | 15 import ast |
16 import errno | 16 import errno |
17 import json | 17 import json |
18 import logging | |
18 import os | 19 import os |
19 import pipes | 20 import pipes |
20 import pprint | 21 import pprint |
21 import re | 22 import re |
22 import shutil | 23 import shutil |
23 import sys | 24 import sys |
24 import subprocess | 25 import subprocess |
25 import tempfile | 26 import tempfile |
26 import traceback | 27 import traceback |
27 import urllib2 | 28 import urllib2 |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1079 executable_suffix = '.exe' if self.platform == 'win32' else '' | 1080 executable_suffix = '.exe' if self.platform == 'win32' else '' |
1080 | 1081 |
1081 cmdline = [] | 1082 cmdline = [] |
1082 extra_files = [] | 1083 extra_files = [] |
1083 | 1084 |
1084 if test_type == 'nontest': | 1085 if test_type == 'nontest': |
1085 self.WriteFailureAndRaise('We should not be isolating %s.' % target, | 1086 self.WriteFailureAndRaise('We should not be isolating %s.' % target, |
1086 output_path=None) | 1087 output_path=None) |
1087 | 1088 |
1088 if android and test_type != "script": | 1089 if android and test_type != "script": |
1089 logdog_command = [ | |
1090 '--logdog-bin-cmd', './../../bin/logdog_butler', | |
1091 '--project', 'chromium', | |
1092 '--service-account-json', | |
1093 '/creds/service_accounts/service-account-luci-logdog-publisher.json', | |
1094 '--prefix', 'android/swarming/logcats/${SWARMING_TASK_ID}', | |
1095 '--source', '${ISOLATED_OUTDIR}/logcats', | |
1096 '--name', 'unified_logcats', | |
1097 ] | |
1098 test_cmdline = [ | 1090 test_cmdline = [ |
1099 self.PathJoin('bin', 'run_%s' % target), | 1091 self.PathJoin('bin', 'run_%s' % target), |
1100 '--logcat-output-file', '${ISOLATED_OUTDIR}/logcats', | 1092 '--logcat-output-file', '${ISOLATED_OUTDIR}/logcats', |
1101 '--target-devices-file', '${SWARMING_BOT_FILE}', | 1093 '--target-devices-file', '${SWARMING_BOT_FILE}', |
1102 '-v' | 1094 '-v' |
1103 ] | 1095 ] |
1104 cmdline = (['./../../build/android/test_wrapper/logdog_wrapper.py'] | 1096 if not os.path.exists('./../../bin/logdog_butler'): |
jbudorick
2017/02/17 01:46:21
This check doesn't work as intended, as mb.py runs
dnj
2017/02/17 16:54:52
Make this a constant (e.g., "butler_path") so you
BigBossZhiling
2017/02/17 21:10:41
Acknowledged.
| |
1105 + logdog_command + test_cmdline) | 1097 logging.error( |
1098 'Logdog binary %s unavailable. Unable to upload logcats.', | |
dnj
2017/02/17 16:54:52
Should this maybe be fatal? If something is puttin
BigBossZhiling
2017/02/17 21:10:41
Acknowledged.
| |
1099 './../../bin/logdog_butler') | |
1100 cmdline = test_cmdline | |
1101 else: | |
1102 project = 'chromium' | |
1103 output = 'logdog,host=services-dot-luci-logdog.appspot.com' | |
1104 prefix = 'android/swarming/logcats/${SWARMING_TASK_ID}' | |
dnj
2017/02/17 16:54:52
Does the shell actually resolve this? Crazy. I sti
BigBossZhiling
2017/02/17 21:10:41
Done.
| |
1105 service_account_json = '/creds/service_accounts/'\ | |
dnj
2017/02/17 16:54:51
nit: recommend using parenthesis for breaking:
se
BigBossZhiling
2017/02/17 21:10:41
Done.
| |
1106 'service-account-luci-logdog-publisher.json' | |
1107 | |
1108 # Call test_cmdline through logdog butler subcommand. | |
1109 test_cmdline = [ | |
1110 './../../bin/logdog_butler', '-project', project, | |
1111 '-output', output, | |
1112 '-prefix', prefix, | |
1113 '-service-account-json', service_account_json, | |
dnj
2017/02/17 16:54:51
Not sure what this is supposed to accomplish. You
BigBossZhiling
2017/02/17 21:10:41
Acknowledged.
| |
1114 'run', '--'] + test_cmdline | |
1115 | |
1116 if not os.path.exists('${ISOLATED_OUTDIR}/logcats'): | |
mikecase (-- gone --)
2017/02/17 01:40:57
I think we want to upload the logcats via the test
jbudorick
2017/02/17 01:46:21
Everything below this shouldn't be here.
BigBossZhiling
2017/02/17 21:10:41
Done.
| |
1117 logging.error( | |
1118 'Logcat sources not found at %s. Unable to upload logcats.', | |
1119 '${ISOLATED_OUTDIR}/logcats') | |
1120 cmdline = test_cmdline | |
1121 else: | |
1122 stream_source_cmdline = [ | |
1123 './../../bin/logdog_butler', '-project', project, | |
mikecase (-- gone --)
2017/02/17 01:40:57
nit: Can remove the "./" at the beginning of the p
BigBossZhiling
2017/02/17 21:10:41
Done.
| |
1124 '-output', output, | |
1125 '-prefix', prefix, | |
1126 '-service-account-json', service_account_json, | |
1127 'stream', '-source', '${ISOLATED_OUTDIR}/logcats', | |
1128 '-stream', '-name=unified_logcats'] | |
1129 cmdline = test_cmdline + ['&&'] + stream_source_cmdline | |
1106 elif use_xvfb and test_type == 'windowed_test_launcher': | 1130 elif use_xvfb and test_type == 'windowed_test_launcher': |
1107 extra_files = [ | 1131 extra_files = [ |
1108 '../../testing/test_env.py', | 1132 '../../testing/test_env.py', |
1109 '../../testing/xvfb.py', | 1133 '../../testing/xvfb.py', |
1110 ] | 1134 ] |
1111 cmdline = [ | 1135 cmdline = [ |
1112 '../../testing/xvfb.py', | 1136 '../../testing/xvfb.py', |
1113 './' + str(executable) + executable_suffix, | 1137 './' + str(executable) + executable_suffix, |
1114 '--brave-new-test-launcher', | 1138 '--brave-new-test-launcher', |
1115 '--test-launcher-bot-mode', | 1139 '--test-launcher-bot-mode', |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1569 # Then check to see if the arg contains any metacharacters other than | 1593 # Then check to see if the arg contains any metacharacters other than |
1570 # double quotes; if it does, quote everything (including the double | 1594 # double quotes; if it does, quote everything (including the double |
1571 # quotes) for safety. | 1595 # quotes) for safety. |
1572 if any(a in UNSAFE_FOR_CMD for a in arg): | 1596 if any(a in UNSAFE_FOR_CMD for a in arg): |
1573 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) | 1597 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) |
1574 return arg | 1598 return arg |
1575 | 1599 |
1576 | 1600 |
1577 if __name__ == '__main__': | 1601 if __name__ == '__main__': |
1578 sys.exit(main(sys.argv[1:])) | 1602 sys.exit(main(sys.argv[1:])) |
OLD | NEW |