Add syntax explanation
This commit is contained in:
parent
cc215524da
commit
25fe41ecc3
24
autotest.sh
24
autotest.sh
|
@ -6,6 +6,7 @@ DATABASEHOST=${MYSQL_HOST:-localhost}
|
|||
BASEDIR=$PWD
|
||||
|
||||
DBCONFIGS="mysql mariadb"
|
||||
TESTS="REDIS MEMCACHE MEMCACHED APCU NODB"
|
||||
|
||||
export MYSQL_DATABASE="$DATABASENAME"
|
||||
export MYSQL_USERNAME="$DATABASEUSER"
|
||||
|
@ -23,6 +24,24 @@ set -e
|
|||
_XDEBUG_CONFIG=$XDEBUG_CONFIG
|
||||
unset XDEBUG_CONFIG
|
||||
|
||||
function show_syntax() {
|
||||
echo -e "Syntax: ./autotest.sh [dbconfigname] [testfile]\n" >&2
|
||||
echo -e "\t\"dbconfigname\" can be one of: $DBCONFIGS" >&2
|
||||
echo -e "\t\"testfile\" is the name of a test file, for example lib/template.php" >&2
|
||||
echo -e "\nDatabase environment variables:\n" >&2
|
||||
echo -e "\t\"MYSQL_HOST\" Mysql Hostname (Default: localhost)" >&2
|
||||
echo -e "\t\"MYSQL_USDRNAME\" Mysql Username (Default: friendica)" >&2
|
||||
echo -e "\t\"MYSQL_DATABASE\" Mysql Database (Default: test)" >&2
|
||||
echo -e "\nOther environment variables:\n" >&2
|
||||
echo -e "\t\"TEST_SELECTION\" test a specific group of tests, can be one of: $TESTS" >&2
|
||||
echo -e "\t\"NOINSTALL\" If set to true, skip the db and install process" >&2
|
||||
echo -e "\t\"NOCOVERAGE\" If set to true, don't create a coverage output" >&2
|
||||
echo -e "\t\"USEDOCKER\" If set to true, the DB server will be executed inside a docker container" >&2
|
||||
echo -e "\nExample: NOCOVERAGE=true ./autotest.sh mysql src/Core/Cache/MemcacheTest.php" >&2
|
||||
echo "will run the test suite from \"tests/src/Core/Cache/MemcacheTest.php\" without a Coverage" >&2
|
||||
echo -e "\nIf no arguments are specified, all tests will be run with all database configs" >&2
|
||||
}
|
||||
|
||||
if [ -x "$PHP" ]; then
|
||||
echo "Using PHP executable $PHP"
|
||||
else
|
||||
|
@ -57,6 +76,7 @@ if [ "$1" ]; then
|
|||
done
|
||||
if [ $FOUND = 0 ]; then
|
||||
echo -e "Unknown database config name \"$1\"\n" >&2
|
||||
show_syntax
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
@ -66,7 +86,7 @@ if [ -f config/local.config.php ] && [ ! -f config/local.config-autotest-backup.
|
|||
mv config/local.config.php config/local.config-autotest-backup.php
|
||||
fi
|
||||
|
||||
function cleanup_config {
|
||||
function cleanup_config() {
|
||||
|
||||
if [ -n "$DOCKER_CONTAINER_ID" ]; then
|
||||
echo "Kill the docker $DOCKER_CONTAINER_ID"
|
||||
|
@ -85,7 +105,7 @@ function cleanup_config {
|
|||
# restore config on exit
|
||||
trap cleanup_config EXIT
|
||||
|
||||
function execute_tests {
|
||||
function execute_tests() {
|
||||
DB=$1
|
||||
echo "Setup environment for $DB testing ..."
|
||||
# back to root folder
|
||||
|
|
Loading…
Reference in a new issue