Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: tests/lab/run_lab_test.py

Issue 344013: Change from absolute paths to relative paths to allow tests,etc. to be locate... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/lab/runner_constants.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2.6.2 1 #!/usr/bin/python2.6.2
2 # Copyright 2009, Google Inc. 2 # Copyright 2009, Google Inc.
3 # All rights reserved. 3 # All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 import util 55 import util
56 56
57 # Resolution to configure video card to before running tests. 57 # Resolution to configure video card to before running tests.
58 SCREEN_WIDTH = 1280 58 SCREEN_WIDTH = 1280
59 SCREEN_HEIGHT = 1024 59 SCREEN_HEIGHT = 1024
60 SCREEN_BPP = 32 60 SCREEN_BPP = 32
61 61
62 join = os.path.join 62 join = os.path.join
63 63
64 if util.IsWindows(): 64 if util.IsWindows():
65 IMAGE_DIFF_PATH = join(const.O3D_PATH, 'third_party', 'pdiff', 'files', 65 IMAGE_DIFF_PATH = join(const.BASE_PATH, 'third_party', 'pdiff', 'files',
66 'bin', 'win', 'perceptualdiff.exe') 66 'bin', 'win', 'perceptualdiff.exe')
67 elif util.IsMac(): 67 elif util.IsMac():
68 IMAGE_DIFF_PATH = join(const.O3D_PATH, 'third_party', 'pdiff', 'files', 68 IMAGE_DIFF_PATH = join(const.BASE_PATH, 'third_party', 'pdiff', 'files',
69 'bin', 'mac', 'perceptualdiff') 69 'bin', 'mac', 'perceptualdiff')
70 else: 70 else:
71 IMAGE_DIFF_PATH = join(const.O3D_PATH, 'third_party', 'pdiff', 'files', 71 IMAGE_DIFF_PATH = join(const.BASE_PATH, 'third_party', 'pdiff', 'files',
72 'bin', 'linux', 'perceptualdiff') 72 'bin', 'linux', 'perceptualdiff')
73 73
74 SELENIUM_TEST_RUNNER_PATH = join(const.O3D_PATH, 'o3d', 'tests', 'selenium', 74 SELENIUM_TEST_RUNNER_PATH = join(const.TEST_PATH, 'selenium', 'main.py')
75 'main.py')
76 75
77 SELENIUM_JAR_PATH = join(const.O3D_PATH, 'third_party', 'selenium_rc', 'files', 76 SELENIUM_JAR_PATH = join(const.BASE_PATH, 'third_party', 'selenium_rc', 'files',
78 'selenium-server', 'selenium-server.jar') 77 'selenium-server', 'selenium-server.jar')
79 78
80 O3D_REFERENCE_IMAGES_PATH = join(const.O3D_PATH, 'o3d', 'o3d_assets', 'tests', 79 O3D_REFERENCE_IMAGES_PATH = join(const.O3D_PATH, 'o3d_assets', 'tests',
81 'screenshots') 80 'screenshots')
82 81
83 SCREENSHOTS_PATH = join(const.RESULTS_PATH,'screenshots') 82 SCREENSHOTS_PATH = join(const.RESULTS_PATH,'screenshots')
84 83
85 # Set total test timeout to 90 minutes. 84 # Set total test timeout to 90 minutes.
86 TEST_TIMEOUT_SECS = 60 * 90.0 85 TEST_TIMEOUT_SECS = 60 * 90.0
87 86
88 SELENIUM_BROWSER_PREFIXES = { 87 SELENIUM_BROWSER_PREFIXES = {
89 'ie': '*iexplore', 88 'ie': '*iexplore',
90 'ff': '*firefox', 89 'ff': '*firefox',
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 185
187 186
188 187
189 def RunTest(browser): 188 def RunTest(browser):
190 """Runs tests on |browser|. 189 """Runs tests on |browser|.
191 Args: 190 Args:
192 browser: the browser to test. 191 browser: the browser to test.
193 Returns: 192 Returns:
194 True on success. 193 True on success.
195 """ 194 """
196 # Run selenium test.
197 os.chdir(const.AUTO_PATH)
198
199 if util.IsWindows(): 195 if util.IsWindows():
200 if not run_util.EnsureWindowsScreenResolution(SCREEN_WIDTH, SCREEN_HEIGHT, 196 if not run_util.EnsureWindowsScreenResolution(SCREEN_WIDTH, SCREEN_HEIGHT,
201 SCREEN_BPP): 197 SCREEN_BPP):
202 logging.error('Failed to configure screen resolution.') 198 logging.error('Failed to configure screen resolution.')
203 return 1 199 return 1
204 200
205 201
206 202
207 # Clear all screenshots. 203 # Clear all screenshots.
208 logging.info('** Deleting previous screenshots.') 204 logging.info('** Deleting previous screenshots.')
209 if os.path.exists(SCREENSHOTS_PATH): 205 if os.path.exists(SCREENSHOTS_PATH):
210 shutil.rmtree(SCREENSHOTS_PATH) 206 shutil.rmtree(SCREENSHOTS_PATH)
211 207
212 os.makedirs(SCREENSHOTS_PATH) 208 os.makedirs(SCREENSHOTS_PATH)
213 209
214 logging.info('** Running selenium tests...') 210 logging.info('** Running selenium tests...')
215 211
216 # -u for unbuffered output. 212 # -u for unbuffered output.
217 # Use Python2.4 for two reasons. First, this is more or less the standard. 213 # Use Python2.4 for two reasons. First, this is more or less the standard.
218 # Second, if we use Python2.6 or later, we must manually shutdown the 214 # Second, if we use Python2.6 or later, we must manually shutdown the
219 # httpserver, or the next run will overlap ports, which causes 215 # httpserver, or the next run will overlap ports, which causes
220 # some strange problems/exceptions. 216 # some strange problems/exceptions.
221 args = [const.PYTHON, '-u', SELENIUM_TEST_RUNNER_PATH] 217 args = [const.PYTHON, '-u', SELENIUM_TEST_RUNNER_PATH]
222 218
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 252
257 if len(argv) > 2: 253 if len(argv) > 2:
258 logging.error('Usage: run_lab_test.py [test_config_file]') 254 logging.error('Usage: run_lab_test.py [test_config_file]')
259 return 1 255 return 1
260 256
261 if len(argv) == 2: 257 if len(argv) == 2:
262 # Use given config file. 258 # Use given config file.
263 config_path = argv[1] 259 config_path = argv[1]
264 else: 260 else:
265 # Use default config file. 261 # Use default config file.
266 config_path = os.path.join(const.HOME_PATH, 'test_config.txt') 262 config_path = os.path.join(const.HOME, 'test_config.txt')
267 263
268 # Uninstall/Install plugin. 264 # Uninstall/Install plugin.
269 if not run_util.UninstallO3DPlugin(): 265 if not run_util.UninstallO3DPlugin():
270 logging.error('Could not successfully uninstall O3D. Tests will not be run.' ) 266 logging.error('Could not successfully uninstall O3D. Tests will not be run.' )
271 return 1 267 return 1
272 if not run_util.InstallO3DPlugin(): 268 if not run_util.InstallO3DPlugin():
273 logging.error('Unable to install O3D plugin. Tests will not be run.') 269 logging.error('Unable to install O3D plugin. Tests will not be run.')
274 return 1 270 return 1
275 271
276 # Grab test configuration info from config file. 272 # Grab test configuration info from config file.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 if all_test_passed: 313 if all_test_passed:
318 logging.info('All tests passed.') 314 logging.info('All tests passed.')
319 return 0 315 return 0
320 else: 316 else:
321 logging.info('Tests failed.') 317 logging.info('Tests failed.')
322 return 1 318 return 1
323 319
324 if __name__ == '__main__': 320 if __name__ == '__main__':
325 code = main(sys.argv) 321 code = main(sys.argv)
326 sys.exit(code) 322 sys.exit(code)
OLDNEW
« no previous file with comments | « no previous file | tests/lab/runner_constants.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698