| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """A module to execute a subclass of MediaTastBase class. | 7 """A module to execute a subclass of MediaTastBase class. |
| 8 | 8 |
| 9 This executes a media test class (a subclass of MediaTastBase class) with | 9 This executes a media test class (a subclass of MediaTastBase class) with |
| 10 different configuration (parameters) which are passed in the form of | 10 different configuration (parameters) which are passed in the form of |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 help='Player.html Nickname [defaults to "%s"]' % | 86 help='Player.html Nickname [defaults to "%s"]' % |
| 87 DEFAULT_PLAYER_HTML_URL_NICKNAME) | 87 DEFAULT_PLAYER_HTML_URL_NICKNAME) |
| 88 parser.add_option('-n', '--number_of_runs', dest='number_of_runs', | 88 parser.add_option('-n', '--number_of_runs', dest='number_of_runs', |
| 89 default=DEFAULT_NUMBER_OF_RUNS, | 89 default=DEFAULT_NUMBER_OF_RUNS, |
| 90 help='The number of runs [defaults to "%d"]' % | 90 help='The number of runs [defaults to "%d"]' % |
| 91 DEFAULT_NUMBER_OF_RUNS) | 91 DEFAULT_NUMBER_OF_RUNS) |
| 92 parser.add_option('-m', '--measure_intervals', dest='measure_intervals', | 92 parser.add_option('-m', '--measure_intervals', dest='measure_intervals', |
| 93 default=DEFAULT_MEASURE_INTERVALS, | 93 default=DEFAULT_MEASURE_INTERVALS, |
| 94 help='Interval for measurement data [defaults to "%d"]' % | 94 help='Interval for measurement data [defaults to "%d"]' % |
| 95 DEFAULT_MEASURE_INTERVALS) | 95 DEFAULT_MEASURE_INTERVALS) |
| 96 parser.add_option('-o', '--test-one-combination', dest='one_combination', | 96 parser.add_option('-c', '--cache_test', dest='cache_test', |
| 97 default=True, # Currently default is True | 97 default=False, help='Include cache test', |
| 98 # since we want to test only 1 combination. | 98 action='store_true') |
| 99 help='Run only one parameter combination') | 99 parser.add_option('-z', '--test-one-video', dest='one_video', |
| 100 default=False, help='Run only one video', |
| 101 action='store_true') |
| 100 parser.add_option( | 102 parser.add_option( |
| 101 '-w', '--test_scenario_input_filename', | 103 '-w', '--test_scenario_input_filename', |
| 102 dest='test_scenario_input_filename', | 104 dest='test_scenario_input_filename', |
| 103 default='', help='Test scenario file (CSV form)', metavar='FILE') | 105 default='', help='Test scenario file (CSV form)', metavar='FILE') |
| 104 parser.add_option( | 106 parser.add_option( |
| 105 '-c', '--test_scenario', dest='test_scenario', | 107 '-q', '--test_scenario', dest='test_scenario', |
| 106 default='', help='Test scenario (action triples delimited by \'|\')') | 108 default='', help='Test scenario (action triples delimited by \'|\')') |
| 107 parser.add_option('-s', '--suite', dest='suite', | 109 parser.add_option('-s', '--suite', dest='suite', |
| 108 help='Suite file') | 110 help='Suite file') |
| 109 parser.add_option('-e', '--media_file', dest='media_file', | 111 parser.add_option('-e', '--media_file', dest='media_file', |
| 110 default='', | 112 default='', |
| 111 help=('Media file to be played using player.html. ' | 113 help=('Media file to be played using player.html. ' |
| 112 'The relative path needs to be specified starting ' | 114 'The relative path needs to be specified starting ' |
| 113 'from data/html/ directory.')) | 115 'from data/html/ directory.')) |
| 114 parser.add_option('-a', '--reference_build', dest='reference_build', | 116 parser.add_option('-a', '--reference_build', dest='reference_build', |
| 115 help='Include reference build run', default=False, | 117 help='Include reference build run', default=False, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 # There are two ways to disable the media cache: setting Chrome option | 169 # There are two ways to disable the media cache: setting Chrome option |
| 168 # to --media-cache-size=1 or adding t parameter in query parameter of | 170 # to --media-cache-size=1 or adding t parameter in query parameter of |
| 169 # URL in which player.js (data/media/html/player.js) disables the | 171 # URL in which player.js (data/media/html/player.js) disables the |
| 170 # media cache). We are doing both here. Please note the length of | 172 # media cache). We are doing both here. Please note the length of |
| 171 # CHROME_FLAGS and ADD_T_PARAMETERS should be the same. | 173 # CHROME_FLAGS and ADD_T_PARAMETERS should be the same. |
| 172 for j in range(len(CHROME_FLAGS)): | 174 for j in range(len(CHROME_FLAGS)): |
| 173 for reference_build in reference_build_list: | 175 for reference_build in reference_build_list: |
| 174 parent_envs = copy.deepcopy(os.environ) | 176 parent_envs = copy.deepcopy(os.environ) |
| 175 if options.input_matrix_filename is None: | 177 if options.input_matrix_filename is None: |
| 176 par_filename = os.path.join(os.pardir, filename) | 178 par_filename = os.path.join(os.pardir, filename) |
| 179 else: |
| 180 par_filename = filename |
| 177 envs = { | 181 envs = { |
| 178 MediaTestEnvNames.MEDIA_TAG_ENV_NAME: tag, | 182 MediaTestEnvNames.MEDIA_TAG_ENV_NAME: tag, |
| 179 MediaTestEnvNames.MEDIA_FILENAME_ENV_NAME: par_filename, | 183 MediaTestEnvNames.MEDIA_FILENAME_ENV_NAME: par_filename, |
| 180 MediaTestEnvNames.MEDIA_FILENAME_NICKNAME_ENV_NAME: nickname, | 184 MediaTestEnvNames.MEDIA_FILENAME_NICKNAME_ENV_NAME: nickname, |
| 181 MediaTestEnvNames.PLAYER_HTML_URL_ENV_NAME: | 185 MediaTestEnvNames.PLAYER_HTML_URL_ENV_NAME: |
| 182 options.player_html_url, | 186 options.player_html_url, |
| 183 MediaTestEnvNames.PLAYER_HTML_URL_NICKNAME_ENV_NAME: | 187 MediaTestEnvNames.PLAYER_HTML_URL_NICKNAME_ENV_NAME: |
| 184 options.player_html_url_nickname, | 188 options.player_html_url_nickname, |
| 185 MediaTestEnvNames.EXTRA_NICKNAME_ENV_NAME: | 189 MediaTestEnvNames.EXTRA_NICKNAME_ENV_NAME: |
| 186 EXTRA_NICKNAMES[j], | 190 EXTRA_NICKNAMES[j], |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 suite_name = DEFAULT_SUITE_NAME | 224 suite_name = DEFAULT_SUITE_NAME |
| 221 else: | 225 else: |
| 222 suite_name = options.suite | 226 suite_name = options.suite |
| 223 suite_string = ' --suite=%s' % suite_name | 227 suite_string = ' --suite=%s' % suite_name |
| 224 test_prog_name = sys.executable + ' ' + test_prog_name | 228 test_prog_name = sys.executable + ' ' + test_prog_name |
| 225 cmd = test_prog_name + suite_string + ' ' + CHROME_FLAGS[j] | 229 cmd = test_prog_name + suite_string + ' ' + CHROME_FLAGS[j] |
| 226 if options.verbose: | 230 if options.verbose: |
| 227 cmd += ' -v' | 231 cmd += ' -v' |
| 228 proc = Popen(cmd, env=envs, shell=True) | 232 proc = Popen(cmd, env=envs, shell=True) |
| 229 proc.communicate() | 233 proc.communicate() |
| 230 if options.one_combination: | 234 if not options.cache_test: |
| 231 sys.exit(0) | 235 break |
| 236 if options.one_video: |
| 237 break |
| 232 | 238 |
| 233 | 239 |
| 234 if __name__ == '__main__': | 240 if __name__ == '__main__': |
| 235 main() | 241 main() |
| OLD | NEW |