pts-core: Just mention PHP 5.3 as the new base requirement. Code still should largely...
[phoronix-test-suite.git] / phoronix-test-suite
blobe1499deb38ed7489e776ea46e12b9623234608a7
1 #!/bin/sh
4 # Phoronix Test Suite
5 # URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
6 # Copyright (C) 2008 - 2015, Phoronix Media
7 # Copyright (C) 2008 - 2015, Michael Larabel
8 # phoronix-test-suite: The Phoronix Test Suite is an extensible open-source testing / benchmarking platform
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # Full path to root directory of the actual Phoronix Test Suite code
25 # export PTS_DIR=$(readlink -f `dirname $0`)
26 export PTS_DIR=`pwd`
27 export PTS_MODE="CLIENT"
29 if [ $PTS_DIR != "`pwd`" ]
30 then
31 cd $PTS_DIR
34 # Run any start-up hooks, such as to pre-seed environment variables or other non-default behaviors / customizations
35 if [ -d pts-core/hooks/startup ]
36 then
37 for file in pts-core/hooks/startup/*.sh
39 ./$file
40 done
43 # Determine PHP binary location
44 if [ ! "X$PHP_BIN" = "X" ] && [ -x $PHP_BIN ]
45 then
46 export PHP_BIN=$PHP_BIN
47 elif [ -x /usr/bin/php5 ] || [ -x /usr/local/bin/php5 ] || [ -x /usr/pkg/bin/php5 ]
48 then
49 export PHP_BIN="php5"
50 elif [ -x /usr/bin/php ] || [ -x /usr/local/bin/php ] || [ -x /usr/pkg/bin/php ]
51 then
52 export PHP_BIN="php"
53 elif [ -x /usr/php5/bin/php ]
54 then
55 export PHP_BIN="/usr/php5/bin/php"
56 elif [ -x /usr/php/bin/php ]
57 then
58 export PHP_BIN="/usr/php/bin/php"
59 elif [ -x /opt/bin/php ]
60 then
61 export PHP_BIN="/opt/bin/php"
62 elif [ -x /usr/pkg/libexec/cgi-bin/php ]
63 then
64 export PHP_BIN="/usr/pkg/libexec/cgi-bin/php"
65 elif which php >/dev/null 2>&1 ;
66 then
67 export PHP_BIN="php"
68 elif which php5 >/dev/null 2>&1 ;
69 then
70 export PHP_BIN="php5"
71 elif [ -x /usr/bin/hhvm ]
72 then
73 export PHP_BIN="/usr/bin/hhvm"
74 elif which hhvm >/dev/null 2>&1 ;
75 then
76 export PHP_BIN="hhvm"
77 else
78 export PHP_BIN=""
81 # Make sure PHP is installed
82 if [ "X$PHP_BIN" = "X" ]
83 then
84 cat <<'EOT'
86 PHP 5.3 or newer must be installed for the Phoronix Test Suite
87 The PHP command-line package is commonly called php-cli, php5-cli, or php.
88 For more information visit: http://www.phoronix-test-suite.com/
90 EOT
92 if [ -x /usr/bin/apt-get ]
93 then
94 echo "The command to likely run for your operating system is: "
95 echo "# apt-get install php5-cli"
96 echo " "
97 elif [ -x /usr/bin/yum ] || [ -x /usr/bin/dnf ]
98 then
99 echo "The command to likely run for your operating system is: "
100 echo "# yum install php-cli php-xml"
101 echo " "
102 elif [ -x /usr/bin/zypper ]
103 then
104 echo "The command to likely run for your operating system is: "
105 echo "# zypper install php5 php5-zip"
106 echo " "
107 elif [ -x /usr/bin/pkg_radd ]
108 then
109 echo "The command to likely run for your operating system is: "
110 echo "# pkg_radd php5 php5-json php5-zip php5-dom"
111 echo " "
112 elif [ -x /usr/bin/pacman ]
113 then
114 echo "The command to likely run for your operating system is: "
115 echo "# pacman -S php"
116 echo " "
119 exit
122 if [ ! -f pts-core/phoronix-test-suite.php ] && [ -f `dirname $0`/pts-core/phoronix-test-suite.php ]
123 then
124 cd `dirname $0`
127 # Ensure the user is in the correct directory
128 if [ ! -f pts-core/phoronix-test-suite.php ]
129 then
130 cat <<'EOT'
132 To run the Phoronix Test Suite locally you must first change directories to phoronix-test-suite/
133 or install the program using the install-sh script. For support visit: http://www.phoronix-test-suite.com/
136 exit
139 # Command-specific conditions
140 case "$1" in
141 "test-module" | "debug-module" | "webui")
142 export PTS_IGNORE_MODULES=1
144 "enterprise-setup")
145 export PTS_SILENT_MODE=1
147 esac
149 export PTS_EXT_LAUNCH_SCRIPT_DIR=`mktemp -d 2>/dev/null || mktemp -d -t ptstmp`
151 # Run The Phoronix Test Suite
152 PTS_EXIT_STATUS=8
153 while [ $PTS_EXIT_STATUS -eq 8 ]; do
154 $PHP_BIN pts-core/phoronix-test-suite.php $@
155 PTS_EXIT_STATUS=$?
156 done
158 if [ -f $PTS_EXT_LAUNCH_SCRIPT_DIR/web-server-launcher ]
159 then
160 chmod +x $PTS_EXT_LAUNCH_SCRIPT_DIR/web-server-launcher
161 exec $PTS_EXT_LAUNCH_SCRIPT_DIR/web-server-launcher
162 rm -f $PTS_EXT_LAUNCH_SCRIPT_DIR/web-server-launcher
163 elif [ -f $PTS_EXT_LAUNCH_SCRIPT_DIR/phoromatic-server-launcher ]
164 then
165 chmod +x $PTS_EXT_LAUNCH_SCRIPT_DIR/phoromatic-server-launcher
166 exec $PTS_EXT_LAUNCH_SCRIPT_DIR/phoromatic-server-launcher
167 rm -f $PTS_EXT_LAUNCH_SCRIPT_DIR/phoromatic-server-launcher
169 # rm -rf $PTS_EXT_LAUNCH_SCRIPT_DIR