From 78fbc54c182cfc6b21fe745213b02b7ea18775e7 Mon Sep 17 00:00:00 2001 From: Maksymilian Osowski Date: Thu, 16 Sep 2010 19:13:01 +0100 Subject: Changed run_layout_tests.py and run_apache2.py to accept alternative tests root dir. Change-Id: I6d0537b6712ca6f68ec004e5e8bf95b97b9017fc --- tests/DumpRenderTree2/assets/run_apache2.py | 21 +++++++++++++++------ tests/DumpRenderTree2/assets/run_layout_tests.py | 11 ++++++++++- 2 files changed, 25 insertions(+), 7 deletions(-) (limited to 'tests/DumpRenderTree2') diff --git a/tests/DumpRenderTree2/assets/run_apache2.py b/tests/DumpRenderTree2/assets/run_apache2.py index 5d1e66c..25638ba 100755 --- a/tests/DumpRenderTree2/assets/run_apache2.py +++ b/tests/DumpRenderTree2/assets/run_apache2.py @@ -26,12 +26,13 @@ import sys import os import subprocess import logging +import optparse -def main(): - if len(sys.argv) < 2: +def main(options, args): + if len(args) < 1: run_cmd = "" else: - run_cmd = sys.argv[1] + run_cmd = args[0] # Setup logging class logging.basicConfig(level=logging.INFO, format='%(message)s') @@ -53,9 +54,13 @@ def main(): android_tree_root = os.path.join(script_location, parent, parent, parent, parent, parent) android_tree_root = os.path.normpath(android_tree_root) - # Paths relative to android_tree_root + # If any of these is relative, then it's relative to ServerRoot (in our case android_tree_root) webkit_path = os.path.join("external", "webkit") - layout_tests_path = os.path.join(webkit_path, "LayoutTests") + if (options.tests_root_directory != None): + # if options.tests_root_directory is absolute, os.getcwd() is discarded! + layout_tests_path = os.path.normpath(os.path.join(os.getcwd(), options.tests_root_directory)) + else: + layout_tests_path = os.path.join(webkit_path, "LayoutTests") http_conf_path = os.path.join(layout_tests_path, "http", "conf") # Prepare the command to set ${APACHE_RUN_USER} and ${APACHE_RUN_GROUP} @@ -121,4 +126,8 @@ def main(): logging.info("OK") if __name__ == "__main__": - main(); + option_parser = optparse.OptionParser(usage="Usage: %prog [options] start|stop|restart") + option_parser.add_option("", "--tests-root-directory", + help="The directory from which to take the tests, default is external/webkit/LayoutTests in this checkout of the Android tree") + options, args = option_parser.parse_args(); + main(options, args); diff --git a/tests/DumpRenderTree2/assets/run_layout_tests.py b/tests/DumpRenderTree2/assets/run_layout_tests.py index d5bf8b3..fd76e4a 100755 --- a/tests/DumpRenderTree2/assets/run_layout_tests.py +++ b/tests/DumpRenderTree2/assets/run_layout_tests.py @@ -32,8 +32,15 @@ def main(options, args): tmpdir = tempfile.gettempdir() + if options.tests_root_directory != None: + # if options.tests_root_directory is absolute, os.getcwd() is discarded! + tests_root_directory = os.path.normpath(os.path.join(os.getcwd(), options.tests_root_directory)) + server_options = " --tests-root-directory=" + tests_root_directory + else: + server_options = ""; + # Restart the server - cmd = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "run_apache2.py") + " restart" + cmd = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "run_apache2.py") + server_options + " restart" os.system(cmd); # Run the tests in path @@ -73,5 +80,7 @@ if __name__ == "__main__": option_parser = optparse.OptionParser(usage="Usage: %prog [options] test-relative-path") option_parser.add_option("", "--show-results-in-browser", default="true", help="Show the results the host's default web browser, default=true") + option_parser.add_option("", "--tests-root-directory", + help="The directory from which to take the tests, default is external/webkit/LayoutTests in this checkout of the Android tree") options, args = option_parser.parse_args(); main(options, args); -- cgit v1.1