Commit 8b160034 authored by kkania@google.com's avatar kkania@google.com

Change from absolute paths to relative paths to allow tests,etc. to be located...

Change from absolute paths to relative paths to allow tests,etc. to be located in any directory, as long as the directory structure is correct.
Original review at: http://codereview.chromium.org/344013.


git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30377 0039d316-1c4b-4281-b951-d872f2087c98
parent e48aeb48
...@@ -62,22 +62,21 @@ SCREEN_BPP = 32 ...@@ -62,22 +62,21 @@ SCREEN_BPP = 32
join = os.path.join join = os.path.join
if util.IsWindows(): if util.IsWindows():
IMAGE_DIFF_PATH = join(const.O3D_PATH, 'third_party', 'pdiff', 'files', IMAGE_DIFF_PATH = join(const.BASE_PATH, 'third_party', 'pdiff', 'files',
'bin', 'win', 'perceptualdiff.exe') 'bin', 'win', 'perceptualdiff.exe')
elif util.IsMac(): elif util.IsMac():
IMAGE_DIFF_PATH = join(const.O3D_PATH, 'third_party', 'pdiff', 'files', IMAGE_DIFF_PATH = join(const.BASE_PATH, 'third_party', 'pdiff', 'files',
'bin', 'mac', 'perceptualdiff') 'bin', 'mac', 'perceptualdiff')
else: else:
IMAGE_DIFF_PATH = join(const.O3D_PATH, 'third_party', 'pdiff', 'files', IMAGE_DIFF_PATH = join(const.BASE_PATH, 'third_party', 'pdiff', 'files',
'bin', 'linux', 'perceptualdiff') 'bin', 'linux', 'perceptualdiff')
SELENIUM_TEST_RUNNER_PATH = join(const.O3D_PATH, 'o3d', 'tests', 'selenium', SELENIUM_TEST_RUNNER_PATH = join(const.TEST_PATH, 'selenium', 'main.py')
'main.py')
SELENIUM_JAR_PATH = join(const.O3D_PATH, 'third_party', 'selenium_rc', 'files', SELENIUM_JAR_PATH = join(const.BASE_PATH, 'third_party', 'selenium_rc', 'files',
'selenium-server', 'selenium-server.jar') 'selenium-server', 'selenium-server.jar')
O3D_REFERENCE_IMAGES_PATH = join(const.O3D_PATH, 'o3d', 'o3d_assets', 'tests', O3D_REFERENCE_IMAGES_PATH = join(const.O3D_PATH, 'o3d_assets', 'tests',
'screenshots') 'screenshots')
SCREENSHOTS_PATH = join(const.RESULTS_PATH,'screenshots') SCREENSHOTS_PATH = join(const.RESULTS_PATH,'screenshots')
...@@ -193,16 +192,11 @@ def RunTest(browser): ...@@ -193,16 +192,11 @@ def RunTest(browser):
Returns: Returns:
True on success. True on success.
""" """
# Run selenium test.
os.chdir(const.AUTO_PATH)
if util.IsWindows(): if util.IsWindows():
if not run_util.EnsureWindowsScreenResolution(SCREEN_WIDTH, SCREEN_HEIGHT, if not run_util.EnsureWindowsScreenResolution(SCREEN_WIDTH, SCREEN_HEIGHT,
SCREEN_BPP): SCREEN_BPP):
logging.error('Failed to configure screen resolution.') logging.warn('Could not detect/change screen resolution.')
return 1
# Clear all screenshots. # Clear all screenshots.
logging.info('** Deleting previous screenshots.') logging.info('** Deleting previous screenshots.')
...@@ -263,7 +257,7 @@ def main(argv): ...@@ -263,7 +257,7 @@ def main(argv):
config_path = argv[1] config_path = argv[1]
else: else:
# Use default config file. # Use default config file.
config_path = os.path.join(const.HOME_PATH, 'test_config.txt') config_path = os.path.join(const.HOME, 'test_config.txt')
# Uninstall/Install plugin. # Uninstall/Install plugin.
if not run_util.UninstallO3DPlugin(): if not run_util.UninstallO3DPlugin():
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Defines common O3D test runner constants. """Defines common O3D test runner constants. This file determines paths to
other O3D components relatively, so it must be placed in the right location.
""" """
...@@ -40,55 +41,58 @@ import util ...@@ -40,55 +41,58 @@ import util
join = os.path.join join = os.path.join
if util.IsWindows(): # Make sure OS is supported.
AUTO_PATH = r'C:\auto' if not util.IsWindows() and not util.IsMac() and not util.IsLinux():
PYTHON = r'C:\Python24\python.exe' print 'Only Windows, Mac, and Linux are supported.'
if util.IsXP(): sys.exit(1)
HOME_PATH = r'C:\Documents and Settings\testing'
else:
HOME_PATH = r'C:\Users\testing'
elif util.IsMac(): # This path should be root/o3d/tests.
AUTO_PATH = '/Users/testing/auto' TEST_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PYTHON = 'python' # This path should be root/o3d.
HOME_PATH = '/Users/testing' O3D_PATH = os.path.dirname(TEST_PATH)
# This path should be root, i.e., the checkout location.
BASE_PATH = os.path.dirname(O3D_PATH)
elif util.IsLinux():
AUTO_PATH = '/home/testing/auto'
PYTHON = 'python'
HOME_PATH = '/home/testing'
else: HOME = os.path.expanduser('~')
print 'Only Windows, Mac, and Linux are supported.' if HOME == '~':
print 'Cannot find user home directory.'
sys.exit(1) sys.exit(1)
O3D_PATH = join(AUTO_PATH, 'o3d') if util.IsWindows():
SCRIPTS_PATH = join(AUTO_PATH, 'scripts') PYTHON = r'C:\Python24\python.exe'
RESULTS_PATH = join(AUTO_PATH, 'results') else:
SOFTWARE_PATH = join(AUTO_PATH, 'software') PYTHON = 'python'
# Note: this path may or may not exist.
RESULTS_PATH = join(TEST_PATH, 'results')
# Build directories. # Build directories.
if util.IsWindows(): if util.IsWindows():
BUILD_PATH = join(O3D_PATH, 'o3d', 'build') BUILD_PATH = join(O3D_PATH, 'build')
elif util.IsMac(): elif util.IsMac():
BUILD_PATH = join(O3D_PATH, 'xcodebuild') BUILD_PATH = join(BASE_PATH, 'xcodebuild')
else: else:
BUILD_PATH = join(O3D_PATH, 'sconsbuild') BUILD_PATH = join(BASE_PATH, 'sconsbuild')
# Product directory.
if os.path.exists(join(BUILD_PATH, 'Debug')): if os.path.exists(join(BUILD_PATH, 'Debug')):
PRODUCT_DIR_PATH = join(BUILD_PATH, 'Debug') PRODUCT_DIR_PATH = join(BUILD_PATH, 'Debug')
else: elif os.path.exists(join(BUILD_PATH, 'Release')):
PRODUCT_DIR_PATH = join(BUILD_PATH, 'Release') PRODUCT_DIR_PATH = join(BUILD_PATH, 'Release')
else:
print 'Cannot find Debug or Release folder in ' + BUILD_PATH
sys.exit(1)
# Plugin locations. # Plugin locations.
INSTALL_PATHS = [] INSTALL_PATHS = []
if util.IsWindows(): if util.IsWindows():
INSTALL_PATHS += [join(HOME_PATH, 'Application Data', 'Mozilla', INSTALL_PATHS += [join(HOME, 'Application Data', 'Mozilla',
'plugins', 'npo3dautoplugin.dll')] 'plugins', 'npo3dautoplugin.dll')]
INSTALL_PATHS += [join(HOME_PATH, 'Application Data', 'Google', 'O3D', INSTALL_PATHS += [join(HOME, 'Application Data', 'Google', 'O3D',
'o3d_host.dll')] 'o3d_host.dll')]
elif util.IsMac(): elif util.IsMac():
INSTALL_PATHS += ['/Library/Internet Plug-Ins/O3D.plugin'] INSTALL_PATHS += ['/Library/Internet Plug-Ins/O3D.plugin']
else: else:
INSTALL_PATHS += [join(HOME_PATH, '.mozilla', 'plugins', INSTALL_PATHS += [join(HOME, '.mozilla', 'plugins',
'libnpo3dautoplugin.so')] 'libnpo3dautoplugin.so')]
...@@ -42,8 +42,9 @@ import sys ...@@ -42,8 +42,9 @@ import sys
import runner_constants as const import runner_constants as const
import util import util
CHANGE_RESOLUTION_PATH = (const.O3D_PATH + '/o3d/tests/lab' CHANGE_RESOLUTION_PATH = os.path.join(const.TEST_PATH, 'lab',
'/ChangeResolution/Debug/changeresolution.exe') 'ChangeResolution','Debug',
'changeresolution.exe')
def EnsureWindowsScreenResolution(width, height, bpp): def EnsureWindowsScreenResolution(width, height, bpp):
"""Performs all steps needed to configure system for testing on Windows. """Performs all steps needed to configure system for testing on Windows.
...@@ -55,10 +56,10 @@ def EnsureWindowsScreenResolution(width, height, bpp): ...@@ -55,10 +56,10 @@ def EnsureWindowsScreenResolution(width, height, bpp):
Returns: Returns:
True on success. True on success.
""" """
if not os.path.exists(CHANGE_RESOLUTION_PATH):
return False
command = 'call "%s" %d %d %d' % (CHANGE_RESOLUTION_PATH, width, height, bpp) command = 'call "%s" %d %d %d' % (CHANGE_RESOLUTION_PATH, width, height, bpp)
our_process = subprocess.Popen(command, our_process = subprocess.Popen(command,
shell=True, shell=True,
stdout=None, stdout=None,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment