summaryrefslogtreecommitdiffstats
path: root/tests/DumpRenderTree2
diff options
context:
space:
mode:
authorMaksymilian Osowski <maxosowski@google.com>2010-09-17 07:28:58 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-17 07:28:58 -0700
commit517ebf14d4da3c4f2f07f520cdeabc1911442cd3 (patch)
tree6c45273354160f446d44cc6293b2ea5035b7f825 /tests/DumpRenderTree2
parentb6a2364ebad11596858892fa9806346e1c011ad6 (diff)
parent4af7705631880a8f0b1d2c34df47be4b554b7a15 (diff)
downloadframeworks_base-517ebf14d4da3c4f2f07f520cdeabc1911442cd3.zip
frameworks_base-517ebf14d4da3c4f2f07f520cdeabc1911442cd3.tar.gz
frameworks_base-517ebf14d4da3c4f2f07f520cdeabc1911442cd3.tar.bz2
Merge "Changed the behaviour of run_apache2.py restart."
Diffstat (limited to 'tests/DumpRenderTree2')
-rwxr-xr-xtests/DumpRenderTree2/assets/run_apache2.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/DumpRenderTree2/assets/run_apache2.py b/tests/DumpRenderTree2/assets/run_apache2.py
index 25638ba..6c3b2f2 100755
--- a/tests/DumpRenderTree2/assets/run_apache2.py
+++ b/tests/DumpRenderTree2/assets/run_apache2.py
@@ -27,6 +27,7 @@ import os
import subprocess
import logging
import optparse
+import time
def main(options, args):
if len(args) < 1:
@@ -71,7 +72,7 @@ def main(options, args):
custom_log_path = os.path.join(tmp_WebKit, "apache2-access.log")
# Prepare the command to (re)start/stop the server with specified settings
- apache2_restart_cmd = "apache2 -k " + run_cmd
+ apache2_restart_template = "apache2 -k %s"
directives = " -c \"ServerRoot " + android_tree_root + "\""
# We use http/tests as the document root as the HTTP tests use hardcoded
@@ -104,7 +105,20 @@ def main(options, args):
# Try to execute the commands
logging.info("Will " + run_cmd + " apache2 server.")
- cmd = export_envvars_cmd + " && " + apache2_restart_cmd + directives + conf_file_cmd
+ cmd_template = export_envvars_cmd + " && " + apache2_restart_template + directives + conf_file_cmd
+
+ # It is worth noting here that if the configuration file with which we restart the server points
+ # to a different PidFile it will not work and result in second apache2 instance.
+ if (run_cmd == 'restart'):
+ logging.info("First will stop...")
+ execute_cmd(cmd_template % ('stop'))
+ logging.info("Stopped. Will start now...")
+ # We need to sleep breifly to avoid errors with apache being stopped and started too quickly
+ time.sleep(0.5)
+
+ execute_cmd(cmd_template % (run_cmd))
+
+def execute_cmd(cmd):
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(out, err) = p.communicate()