3 # Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
4 # Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
5 # Copyright (C) 2011 Research In Motion Limited. All rights reserved.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
16 # 3. Neither the name of Apple Inc. ("Apple") nor the names of
17 # its contributors may be used to endorse or promote products derived
18 # from this software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
21 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
24 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 # Script to run Apache with the same configuration as used in http layout tests.
42 use lib $FindBin::Bin;
43 use webkitperl::httpd;
46 # FIXME: Dynamic HTTP-port configuration in this file is wrong. The various
47 # apache config files in LayoutTests/http/config govern the port numbers.
48 # Dynamic configuration as-written will also cause random failures in
49 # an IPv6 environment. See https://bugs.webkit.org/show_bug.cgi?id=37104.
52 my $allInterfaces = 0;
55 my $result = GetOptions(
56 'all-interfaces|a' => \$allInterfaces,
57 'help|h' => \$showHelp,
58 'port=i' => \$httpdPort,
61 if (!$result || @ARGV || $showHelp) {
62 print "Usage: " . basename($0) . " [options]\n";
63 print " -a|--all-interfaces Bind to all interfaces\n";
64 print " -h|--help Show this help message\n";
65 print " -p|--port NNNN Bind to port NNNN\n";
70 my $productDir = productDir();
72 my $testDirectory = File::Spec->catfile(getcwd(), "LayoutTests");
73 $testDirectory = convertMsysPath($testDirectory) if isMsys();
74 my $listen = "127.0.0.1:$httpdPort";
75 $listen = "$httpdPort" if ($allInterfaces);
78 print "Starting httpd on port $httpdPort (all interfaces)...\n";
80 print "Starting httpd on <http://$listen/>...\n";
82 setShouldWaitForUserInterrupt();
83 print "Press Ctrl+C to stop it.\n\n";
86 "-C", "Listen $listen",
87 # Disable Keep-Alive support. Makes testing in multiple browsers easier (no need to wait
88 # for another browser's connection to expire).
92 "-c", "CustomLog |/usr/bin/tee common",
93 "-c", "ErrorLog |/usr/bin/tee",
94 # Run in single-process mode, do not detach from the controlling terminal.
98 my @defaultArgs = getDefaultConfigForTestDirectory($testDirectory);
99 @args = (@defaultArgs, @args);