Index: chrome/test/functional/media/media_test_runner.py |
diff --git a/chrome/test/functional/media/media_test_runner.py b/chrome/test/functional/media/media_test_runner.py |
index c605f9c2cf6dc33204a768037598f7c041356750..0f2d3f2174f830bf30937545ce4c92b658030e3f 100755 |
--- a/chrome/test/functional/media/media_test_runner.py |
+++ b/chrome/test/functional/media/media_test_runner.py |
@@ -36,7 +36,7 @@ def main(): |
CHROME_FLAGS = ['--chrome-flags=\'--media-cache-size=1\'', ''] |
# The 't' parameter is passed to player.html to disable/enable the media |
# cache (refer to data/media/html/player.js). |
- ADD_T_PARAMETERS = ['Y', 'N'] |
+ ADD_T_PARAMETERS = [False, True] |
# Player.html should contain all the HTML and Javascript that is |
# necessary to run these tests. |
DEFAULT_PLAYER_HTML_URL = 'DEFAULT' |
@@ -44,8 +44,7 @@ def main(): |
# Default base url nickname used to display the result in case it is not |
# specified by the environment variable. |
DEFAULT_PLAYER_HTML_URL_NICKNAME = 'local' |
- PRINT_ONLY_TIME = 'Y' |
- REMOVE_FIRST_RESULT = 'Y' |
+ REMOVE_FIRST_RESULT = True |
# The number of runs for each test. This is used to compute average values |
# from among all runs. |
DEFAULT_NUMBER_OF_RUNS = 3 |
@@ -112,6 +111,13 @@ def main(): |
help=('Media file to be played using player.html. ' |
'The relative path needs to be specified starting ' |
'from data/html/ directory.')) |
+ parser.add_option('-a', '--reference_build', dest='reference_build', |
+ help='Include reference build run', default=False, |
+ action='store_true') |
+ parser.add_option('-k', '--reference_build_dir', dest='reference_build_dir', |
+ help='reference build dir location') |
dennis_jeffrey
2011/05/20 18:10:46
reference -->
Reference
dennis_jeffrey
2011/05/20 18:10:46
Maybe this would be more clear?
dir location -->
imasaki1
2011/05/20 20:50:14
Done.
imasaki1
2011/05/20 20:50:14
Rewrite to match in the comments in the code below
|
+ parser.add_option('-v', '--verbose', dest='verbose', help='verbose mode', |
dennis_jeffrey
2011/05/20 18:10:46
verbose mode -->
Verbose mode
imasaki1
2011/05/20 20:50:14
Done.
|
+ default=False, action='store_true') |
options, args = parser.parse_args() |
if args: |
@@ -143,6 +149,13 @@ def main(): |
all_data_list, options.input_matrix_testcase_name) |
if media_info is not None: |
test_data_list.append(media_info) |
+ |
+ # Determine whether we need to repeat a test using a reference build. |
+ # The default is not to include a test using a reference build. |
+ if options.reference_build: |
+ reference_build_list = [False, True] |
+ else: |
+ reference_build_list = [False] |
# This is a loop for iterating through all videos defined above (list |
# or matrix). Each video has associated tag and nickname for display |
# purpose. |
@@ -156,51 +169,63 @@ def main(): |
# media cache). We are doing both here. Please note the length of |
# CHROME_FLAGS and ADD_T_PARAMETERS should be the same. |
for j in range(len(CHROME_FLAGS)): |
- parent_envs = copy.deepcopy(os.environ) |
- if options.input_matrix_filename is None: |
- filename = os.path.join(os.pardir, filename) |
- envs = { |
- MediaTestEnvNames.MEDIA_TAG_ENV_NAME: tag, |
- MediaTestEnvNames.MEDIA_FILENAME_ENV_NAME: filename, |
- MediaTestEnvNames.MEDIA_FILENAME_NICKNAME_ENV_NAME: nickname, |
- MediaTestEnvNames.PLAYER_HTML_URL_ENV_NAME: |
- options.player_html_url, |
- MediaTestEnvNames.PLAYER_HTML_URL_NICKNAME_ENV_NAME: |
- options.player_html_url_nickname, |
- MediaTestEnvNames.EXTRA_NICKNAME_ENV_NAME: |
- EXTRA_NICKNAMES[j], |
- # Enables or disables the media cache. |
- # (refer to data/media/html/player.js) |
- MediaTestEnvNames.ADD_T_PARAMETER_ENV_NAME: ADD_T_PARAMETERS[j], |
- MediaTestEnvNames.PRINT_ONLY_TIME_ENV_NAME: PRINT_ONLY_TIME, |
- MediaTestEnvNames.N_RUNS_ENV_NAME: str(options.number_of_runs), |
- MediaTestEnvNames.REMOVE_FIRST_RESULT_ENV_NAME: |
- REMOVE_FIRST_RESULT, |
- MediaTestEnvNames.MEASURE_INTERVAL_ENV_NAME: |
- str(options.measure_intervals), |
- MediaTestEnvNames.TEST_SCENARIO_FILE_ENV_NAME: |
- options.test_scenario_input_filename, |
- MediaTestEnvNames.TEST_SCENARIO_ENV_NAME: |
- options.test_scenario, |
- } |
- envs.update(parent_envs) |
- if options.suite is None and options.test_prog_name is not None: |
- # Suite is not used - run test program directly. |
- test_prog_name = options.test_prog_name |
- suite_string = '' |
- else: |
- # Suite is used. |
- # The test script names are in the PYAUTO_TEST file. |
- test_prog_name = pyauto_functional_script_name |
- if options.suite is None: |
- suite_name = DEFAULT_SUITE_NAME |
+ for reference_build in reference_build_list: |
+ parent_envs = copy.deepcopy(os.environ) |
+ if options.input_matrix_filename is None: |
+ par_filename = os.path.join(os.pardir, filename) |
+ envs = { |
+ MediaTestEnvNames.MEDIA_TAG_ENV_NAME: tag, |
+ MediaTestEnvNames.MEDIA_FILENAME_ENV_NAME: par_filename, |
+ MediaTestEnvNames.MEDIA_FILENAME_NICKNAME_ENV_NAME: nickname, |
+ MediaTestEnvNames.PLAYER_HTML_URL_ENV_NAME: |
+ options.player_html_url, |
+ MediaTestEnvNames.PLAYER_HTML_URL_NICKNAME_ENV_NAME: |
+ options.player_html_url_nickname, |
+ MediaTestEnvNames.EXTRA_NICKNAME_ENV_NAME: |
+ EXTRA_NICKNAMES[j], |
+ # Enables or disables the media cache. |
+ # (refer to data/media/html/player.js) |
+ MediaTestEnvNames.N_RUNS_ENV_NAME: str(options.number_of_runs), |
+ MediaTestEnvNames.MEASURE_INTERVAL_ENV_NAME: |
+ str(options.measure_intervals), |
+ MediaTestEnvNames.TEST_SCENARIO_FILE_ENV_NAME: |
+ options.test_scenario_input_filename, |
+ MediaTestEnvNames.TEST_SCENARIO_ENV_NAME: |
+ options.test_scenario, |
+ } |
+ # Boolean variables and their related variables. |
+ if ADD_T_PARAMETERS[j]: |
+ envs[MediaTestEnvNames.ADD_T_PARAMETER_ENV_NAME] = str( |
+ ADD_T_PARAMETERS[j]) |
+ if reference_build: |
+ envs[MediaTestEnvNames.REFERENCE_BUILD_ENV_NAME] = str( |
+ reference_build) |
+ if REMOVE_FIRST_RESULT: |
+ envs[MediaTestEnvNames.REMOVE_FIRST_RESULT_ENV_NAME] = str( |
+ REMOVE_FIRST_RESULT) |
+ if options.reference_build_dir: |
+ envs[MediaTestEnvNames.REFERENCE_BUILD_DIR_ENV_NAME] = ( |
+ options.reference_build_dir) |
+ envs.update(parent_envs) |
+ if options.suite is None and options.test_prog_name is not None: |
+ # Suite is not used - run test program directly. |
+ test_prog_name = options.test_prog_name |
+ suite_string = '' |
else: |
- suite_name = options.suite |
- suite_string = ' --suite=%s' % suite_name |
- test_prog_name = sys.executable + ' ' + test_prog_name |
- cmd = test_prog_name + suite_string + ' ' + CHROME_FLAGS[j] |
- proc = Popen(cmd, env=envs, shell=True) |
- proc.communicate() |
+ # Suite is used. |
+ # The test script names are in the PYAUTO_TEST file. |
+ test_prog_name = pyauto_functional_script_name |
+ if options.suite is None: |
+ suite_name = DEFAULT_SUITE_NAME |
+ else: |
+ suite_name = options.suite |
+ suite_string = ' --suite=%s' % suite_name |
+ test_prog_name = sys.executable + ' ' + test_prog_name |
+ cmd = test_prog_name + suite_string + ' ' + CHROME_FLAGS[j] |
+ if options.verbose: |
+ cmd += ' -v' |
+ proc = Popen(cmd, env=envs, shell=True) |
+ proc.communicate() |
if options.one_combination: |
sys.exit(0) |