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

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

Issue 332030: Adjusted timeouts for a couple failing tests; switched from umount to hdiutil... (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/util.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 20 matching lines...) Expand all
31 31
32 """Utility functions for running the lab tests. 32 """Utility functions for running the lab tests.
33 33
34 """ 34 """
35 35
36 import logging 36 import logging
37 import os 37 import os
38 import subprocess 38 import subprocess
39 import shutil 39 import shutil
40 import sys 40 import sys
41 import time
42 41
43 import runner_constants as const 42 import runner_constants as const
44 import util 43 import util
45 44
46 CHANGE_RESOLUTION_PATH = (const.O3D_PATH + '/o3d/tests/lab' 45 CHANGE_RESOLUTION_PATH = (const.O3D_PATH + '/o3d/tests/lab'
47 '/ChangeResolution/Debug/changeresolution.exe') 46 '/ChangeResolution/Debug/changeresolution.exe')
48 47
49 def EnsureWindowsScreenResolution(width, height, bpp): 48 def EnsureWindowsScreenResolution(width, height, bpp):
50 """Performs all steps needed to configure system for testing on Windows. 49 """Performs all steps needed to configure system for testing on Windows.
51 50
(...skipping 27 matching lines...) Expand all
79 os.environ['PYTHONPATH'] = path 78 os.environ['PYTHONPATH'] = path
80 79
81 # Need to put at front of sys.path so python will try to import modules from 80 # Need to put at front of sys.path so python will try to import modules from
82 # path before locations further down the sys.path. 81 # path before locations further down the sys.path.
83 sys.path = [path] + sys.path 82 sys.path = [path] + sys.path
84 83
85 84
86 def InstallO3DPlugin(): 85 def InstallO3DPlugin():
87 """Installs O3D plugin.""" 86 """Installs O3D plugin."""
88 87
88 logging.info('Installing plugin...')
89 if util.IsWindows(): 89 if util.IsWindows():
90 installer_path = os.path.join(const.PRODUCT_DIR_PATH, 'o3d.msi') 90 installer_path = os.path.join(const.PRODUCT_DIR_PATH, 'o3d.msi')
91
92 if not os.path.exists(installer_path):
93 logging.error('Installer path not found, %s' % installer_path)
94 return False
95
96 install_command = 'msiexec.exe /i "%s"' % installer_path
97 if util.RunStr(install_command) != 0:
98 return False
99
91 elif util.IsMac(): 100 elif util.IsMac():
92 dmg_path = os.path.join(const.PRODUCT_DIR_PATH, 'o3d.dmg') 101 dmg_path = os.path.join(const.PRODUCT_DIR_PATH, 'o3d.dmg')
93 volumes_path = util.MountDiskImage(dmg_path) 102 mnt = util.MountDiskImage(dmg_path)
94 if volumes_path is None: 103 if mnt is None:
95 return False 104 return False
96 else: 105 (device, volumes_path) = mnt
97 installer_path = os.path.join(volumes_path, 'O3D.mpkg') 106
107 installer_path = os.path.join(volumes_path, 'O3D.mpkg')
108
109 if not os.path.exists(installer_path):
110 logging.error('Installer path not found, %s' % installer_path)
111 util.UnmountDiskImage(device)
112 return False
113
114 admin_password = 'g00gl3'
115 install_command = ('echo %s | sudo -S /usr/sbin/installer -pkg '
116 '"%s" -target /' % (admin_password, installer_path))
117
118 ret_code = util.RunStr(install_command)
119 util.UnmountDiskImage(device)
120 if ret_code != 0:
121 return False
122
98 else: 123 else:
99 plugin_path = os.path.join(const.PRODUCT_DIR_PATH, 'libnpo3dautoplugin.so') 124 plugin_path = os.path.join(const.PRODUCT_DIR_PATH, 'libnpo3dautoplugin.so')
100 plugin_dst_dir = os.path.expanduser('~/.mozilla/plugins') 125 plugin_dst_dir = os.path.expanduser('~/.mozilla/plugins')
101 try: 126 try:
102 os.makedirs(plugin_dst_dir) 127 os.makedirs(plugin_dst_dir)
103 except os.error: 128 except os.error:
104 pass 129 pass
105 130
106 plugin_dst = os.path.join(plugin_dst_dir, 'libnpo3dautoplugin.so') 131 plugin_dst = os.path.join(plugin_dst_dir, 'libnpo3dautoplugin.so')
107 shutil.copyfile(plugin_path, plugin_dst) 132 shutil.copyfile(plugin_path, plugin_dst)
108 return True 133 return True
109 134
110 logging.info('Installing plugin:"%s"', installer_path)
111
112 if not os.path.exists(installer_path):
113 logging.error('Installer path not found, %s' % installer_path)
114 return False
115
116 if util.IsWindows():
117 install_command = 'msiexec.exe /i "%s"' % installer_path
118 elif util.IsMac():
119 admin_password = 'g00gl3'
120 install_command = ('echo %s | sudo -S /usr/sbin/installer -pkg '
121 '"%s" -target /' % (admin_password, installer_path))
122
123 logging.info('Installing...')
124 result = os.system(install_command)
125 if result:
126 logging.error('Install failed.')
127 return False
128 logging.info('Installed.')
129
130 if util.IsMac():
131 util.UnmountDiskImage(volumes_path)
132
133 return True 135 return True
134 136
135 def UninstallO3DPlugin(): 137 def UninstallO3DPlugin():
136 """Uninstalls O3D. 138 """Uninstalls O3D.
137 139
138 Returns: 140 Returns:
139 True, if O3D is no longer installed.""" 141 True, if O3D is no longer installed."""
140 142
141 if util.IsWindows(): 143 if util.IsWindows():
142 installer_path = os.path.join(const.PRODUCT_DIR_PATH, 'o3d.msi') 144 installer_path = os.path.join(const.PRODUCT_DIR_PATH, 'o3d.msi')
(...skipping 10 matching lines...) Expand all
153 return not DoesAnO3DPluginExist() 155 return not DoesAnO3DPluginExist()
154 156
155 def DoesAnO3DPluginExist(): 157 def DoesAnO3DPluginExist():
156 for path in const.INSTALL_PATHS: 158 for path in const.INSTALL_PATHS:
157 if os.path.exists(path): 159 if os.path.exists(path):
158 return True 160 return True
159 return False 161 return False
160 162
161 163
162 164
OLDNEW
« no previous file with comments | « no previous file | tests/lab/util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698