#!/bin/sh
#
# Phoronix Test Suite
# URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
# Copyright (C) 2008, Phoronix Media
# Copyright (C) 2008, Michael Larabel
# phoronix-test-suite: The Phoronix Test Suite is an extensible open-source testing platform for Linux.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
# Full path to root directory of the actual Phoronix Test Suite code
export PTS_DIR=`pwd`
CALL_DIR=`pwd`
OPTION_HANDLE=$1
OPTION_ARG=$2
if [ $PTS_DIR != `pwd` ]
then
cd $PTS_DIR
fi
# Ensure the user is in the correct directory
if [ ! -f pts-core/phoronix-test-suite.php ]
then
cat <<'EOT'
To run the Phoronix Test Suite locally you must first change directories to phoronix-test-suite/ or install the program using the install-sh script. For support visit: http://www.phoronix-test-suite.com/
EOT
exit
fi
# Determine PHP binary location
if [ -x /usr/bin/php5 ] || [ -x /usr/local/bin/php5 ]
then
export PHP_BIN="php5"
elif [ -x /usr/bin/php ] || [ -x /usr/local/bin/php ]
then
export PHP_BIN="php"
elif [ -x /usr/php5/bin/php ]
then
export PHP_BIN="/usr/php5/bin/php"
elif [ -x /usr/php/bin/php ]
then
export PHP_BIN="/usr/php/bin/php"
else
export PHP_BIN=""
fi
# Make sure PHP is installed
if [ "X$PHP_BIN" = "X" ]
then
cat <<'EOT'
PHP5 CLI Must Be Installed To Run The Phoronix Test Suite.
Only PHP For The Command Line Is Needed, Not A Complete PHP w/ Web Server Installation
The PHP CLI package is usually called php-cli or php5-cli. Also recommended is the PHP GD library (php-gd)
For support visit: http://www.phoronix-test-suite.com/
EOT
exit
fi
# Check if being called from a Self Contained test profile
export SCTP_FILE=`echo $CALL_DIR/$1 | sed 's:\./::g'`
if [ -e $SCTP_FILE ]
then
OPTION_HANDLE="benchmark"
OPTION_ARG=$SCTP_FILE
fi
export PTS_COMMAND=$1
case "$1" in
"install" | "force-install")
$PHP_BIN pts-core/phoronix-test-suite.php INSTALL_TEST $OPTION_ARG
;;
"install-dependencies")
$PHP_BIN pts-core/phoronix-test-suite.php INSTALL_EXTERNAL_DEPENDENCIES $OPTION_ARG
;;
"run" | "batch-run")
if [ "$1" = "batch-run" ]
then
export PTS_BATCH_MODE=1
fi
$PHP_BIN pts-core/phoronix-test-suite.php RUN_TEST $OPTION_ARG
;;
"benchmark" | "batch-benchmark")
if [ "$1" = "batch-benchmark" ]
then
export PTS_BATCH_MODE=1
fi
$PHP_BIN pts-core/phoronix-test-suite.php BENCHMARK $OPTION_ARG
;;
"merge-results")
$PHP_BIN pts-core/phoronix-test-suite.php MERGE_RESULTS $OPTION_ARG $3 $4
;;
"analyze-batch")
$PHP_BIN pts-core/phoronix-test-suite.php ANALYZE_BATCH $OPTION_ARG $3
;;
"analyze-all-runs")
$PHP_BIN pts-core/phoronix-test-suite.php ANALYZE_ALL_RUNS $OPTION_ARG
;;
"remove-result")
$PHP_BIN pts-core/phoronix-test-suite.php REMOVE_RESULT $OPTION_ARG
;;
"remove-installed-test")
$PHP_BIN pts-core/phoronix-test-suite.php REMOVE_INSTALLED_TEST $OPTION_ARG
;;
"remove-all-results")
$PHP_BIN pts-core/phoronix-test-suite.php REMOVE_ALL_RESULTS
;;
"upload" | "upload-result" | "upload-results" | "upload-saved-result")
$PHP_BIN pts-core/phoronix-test-suite.php UPLOAD_RESULT $OPTION_ARG
;;
"make-download-cache")
$PHP_BIN pts-core/phoronix-test-suite.php MAKE_DOWNLOAD_CACHE
;;
"list-tests" | "list-all-tests")
$PHP_BIN pts-core/phoronix-test-suite.php LIST_TESTS
;;
"list-suites")
$PHP_BIN pts-core/phoronix-test-suite.php LIST_SUITES
;;
"list-modules")
$PHP_BIN pts-core/phoronix-test-suite.php LIST_MODULES
;;
"list-possible-dependencies")
$PHP_BIN pts-core/phoronix-test-suite.php LIST_POSSIBLE_DEPENDENCIES
;;
"list-installed-tests")
$PHP_BIN pts-core/phoronix-test-suite.php LIST_INSTALLED_TESTS
;;
"list-usage" | "list-test-usage")
$PHP_BIN pts-core/phoronix-test-suite.php LIST_TEST_USAGE
;;
"list-results" | "list-saved-results" | "list-test-results")
$PHP_BIN pts-core/phoronix-test-suite.php LIST_SAVED_RESULTS
;;
"result-info" | "results-info")
$PHP_BIN pts-core/phoronix-test-suite.php RESULT_INFORMATION $OPTION_ARG
;;
"show-result" | "show-results" | "view-result" | "view-results")
$PHP_BIN pts-core/phoronix-test-suite.php SHOW_RESULT $OPTION_ARG
;;
"info" | "suite-info" | "test-info")
$PHP_BIN pts-core/phoronix-test-suite.php INFORMATION $OPTION_ARG
;;
"module-info")
$PHP_BIN pts-core/phoronix-test-suite.php MODULE_INFORMATION $OPTION_ARG
;;
"module-setup")
$PHP_BIN pts-core/phoronix-test-suite.php MODULE_SETUP $OPTION_ARG
;;
"system-info" | "system-information")
$PHP_BIN pts-core/phoronix-test-suite.php SYSTEM_INFORMATION
;;
"diagnostics")
$PHP_BIN pts-core/phoronix-test-suite.php DIAGNOSTICS_DUMP
;;
"clone")
$PHP_BIN pts-core/phoronix-test-suite.php CLONE_GLOBAL_RESULT $OPTION_ARG
;;
"download-test-files")
$PHP_BIN pts-core/phoronix-test-suite.php DOWNLOAD_TEST_FILES $OPTION_ARG
;;
"install-all" | "force-install-all")
$PHP_BIN pts-core/phoronix-test-suite.php INSTALL_ALL
;;
"initial-config")
$PHP_BIN pts-core/phoronix-test-suite.php INITIAL_CONFIG
;;
"version")
$PHP_BIN pts-core/phoronix-test-suite.php CORE_VERSION
;;
"login")
$PHP_BIN pts-core/phoronix-test-suite.php GLOBAL_LOGIN
;;
"batch-setup")
$PHP_BIN pts-core/phoronix-test-suite.php BATCH_SETUP
;;
"refresh-graph" | "refresh-graphs" | "refresh-result")
$PHP_BIN pts-core/phoronix-test-suite.php REFRESH_GRAPHS $OPTION_ARG
;;
"test-module" | "debug-module")
if [ "$1" = "debug-module" ]
then
export PTS_DEBUG=1
fi
export PTS_IGNORE_MODULES=1
$PHP_BIN pts-core/phoronix-test-suite.php TEST_MODULE $OPTION_ARG
;;
"sensors" | "sensor-options" | "analyze" | "analyze-results")
echo "\nThis option was dropped or changed in the Phoronix Test Suite.\nFor more information and the replacement option, view the documentation.\n"
;;
*)
cat <<'EOT'
=================================
Phoronix Test Suite
URL: http://www.phoronix-test-suite.com/
=================================
Installation Options:
install : Install or update the specified suite/test(s)
install-dependencies : Install the external (distribution-level) dependencies
install-all: Install or update all available tests
list-installed-tests: List all tests that are installed
Testing Options:
benchmark : Install and then run the test(s)
run : Run the specified test(s)
list-tests: List all tests and relevant information
list-suites: List all suites and relevant information
Batch Testing Options:
batch-setup: Setup the batch mode options
batch-run : Run the specified test(s) in batch mode
batch-benchmark : Install and run the test(s) in batch mode
Result Viewing Options:
list-results: List all saved results
show-result : Show this result file in your web browser
remove-result : Remove this saved result file
remove-all-results: Removes all saved results
merge-results : Merge two sets of results
Phoronix Global Options:
upload-results : Upload a saved set of results to Phoronix Global
login: Enter your Phoronix Global log-in information for uploading results
Analytical Options:
analyze-batch : Provide an analysis of the results generated from a batch run
analyze-all-runs : Generate a candlestick graph from all trial runs
Module Options:
list-modules: List all installed/available PTS modules
module-info: Show detailed information on a PTS module
module-setup: Configure the end-user options for a PTS module
Miscellaneous Options:
make-download-cache: Backup all downloaded test files to ~/.phoronix-test-suite/download-cache/
info : Show detailed information about a test or suite
system-info: Show detected software and hardware information
diagnostics: Useful information when reporting a bug or problem
version: Print the Phoronix Test Suite version and code-name
EOT
;;
esac