Adding tests

This commit is contained in:
cytopia
2018-03-01 21:23:55 +01:00
parent dd164869c1
commit 42fdf7f929
11 changed files with 732 additions and 7 deletions

View File

@@ -52,9 +52,16 @@ before_script:
# Build (multiple tries due to network outages)
- max=100; i=0; while [ $i -lt $max ]; do if make build-base-${PHP//.}; then break; else i=$((i+1)); fi; done; if [ $i -gt 98 ]; then false; fi
- make test-base-${PHP//.}
- max=100; i=0; while [ $i -lt $max ]; do if make build-mods-${PHP//.}; then break; else i=$((i+1)); fi; done; if [ $i -gt 98 ]; then false; fi
- make test-mods-${PHP//.}
- max=100; i=0; while [ $i -lt $max ]; do if make build-prod-${PHP//.}; then break; else i=$((i+1)); fi; done; if [ $i -gt 98 ]; then false; fi
- make test-prod-${PHP//.}
- max=100; i=0; while [ $i -lt $max ]; do if make build-work-${PHP//.}; then break; else i=$((i+1)); fi; done; if [ $i -gt 98 ]; then false; fi
- make test-work-${PHP//.}
# Test if PHP modules have changed
- ./build/gen-readme.sh "${PHP}"

View File

@@ -13,7 +13,10 @@ set -o pipefail
### Setup Postfix for catch-all
###
fix_mds_permissions() {
local debug="${1}"
local user="${1}"
local group="${2}"
local debug="${3}"
local mds_cfg=/etc/mysqldump-secure.conf
local mds_cnf=/etc/mysqldump-secure.cnf
local mds_log=/var/log/mysqldump-secure.log
@@ -23,10 +26,10 @@ fix_mds_permissions() {
run "mkdir -p ${mds_dir}" "${debug}"
fi
run "chown ${MY_USER}:${MY_GROUP} ${mds_cfg}" "${debug}"
run "chown ${MY_USER}:${MY_GROUP} ${mds_cnf}" "${debug}"
run "chown ${MY_USER}:${MY_GROUP} ${mds_log}" "${debug}"
run "chown ${MY_USER}:${MY_GROUP} ${mds_dir}" "${debug}"
run "chown ${user}:${group} ${mds_cfg}" "${debug}"
run "chown ${user}:${group} ${mds_cnf}" "${debug}"
run "chown ${user}:${group} ${mds_log}" "${debug}"
run "chown ${user}:${group} ${mds_dir}" "${debug}"
}
set_mds_settings() {

View File

@@ -134,7 +134,7 @@ copy_ini_files "${PHP_CUST_INI_DIR}" "${PHP_INI_DIR}" "${DEBUG_LEVEL}"
###
### mysqldump-secure
###
fix_mds_permissions "${DEBUG_LEVEL}"
fix_mds_permissions "${MY_USER}" "${MY_GROUP}" "${DEBUG_LEVEL}"
set_mds_settings "MYSQL_BACKUP_USER" "MYSQL_BACKUP_PASS" "MYSQL_BACKUP_HOST" "${DEBUG_LEVEL}"

View File

@@ -258,3 +258,60 @@ pull-from-71:
docker pull $(shell grep FROM $(location)/base/Dockerfile-7.1 | sed 's/^FROM//g'; done)
pull-from-72:
docker pull $(shell grep FROM $(location)/base/Dockerfile-7.2 | sed 's/^FROM//g'; done)
###
### Tests
###
test-base-54:
./tests/test.sh 5.4 base
test-base-55:
./tests/test.sh 5.5 base
test-base-56:
./tests/test.sh 5.6 base
test-base-70:
./tests/test.sh 7.0 base
test-base-71:
./tests/test.sh 7.1 base
test-base-72:
./tests/test.sh 7.2 base
test-mods-54:
./tests/test.sh 5.4 mods
test-mods-55:
./tests/test.sh 5.5 mods
test-mods-56:
./tests/test.sh 5.6 mods
test-mods-70:
./tests/test.sh 7.0 mods
test-mods-71:
./tests/test.sh 7.1 mods
test-mods-72:
./tests/test.sh 7.2 mods
test-prod-54:
./tests/test.sh 5.4 prod
test-prod-55:
./tests/test.sh 5.5 prod
test-prod-56:
./tests/test.sh 5.6 prod
test-prod-70:
./tests/test.sh 7.0 prod
test-prod-71:
./tests/test.sh 7.1 prod
test-prod-72:
./tests/test.sh 7.2 prod
test-work-54:
./tests/test.sh 5.4 work
test-work-55:
./tests/test.sh 5.5 work
test-work-56:
./tests/test.sh 5.6 work
test-work-70:
./tests/test.sh 7.0 work
test-work-71:
./tests/test.sh 7.1 work
test-work-72:
./tests/test.sh 7.2 work

View File

@@ -1,8 +1,95 @@
# Docker PHP-FPM images
<h2><img id="options" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Options</h2>
### Environment variables
## Available PHP Modules
Have a look at the following table to see all supported environment variables for each Docker image flavour.
<table>
<thead>
<tr>
<th>Image</th>
<th>Env Variable</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="3"><strong>base</strong><br/><br/><strong>mods</strong><br/><br/><strong>prod</strong><br/><br/><strong>work</strong></td>
<td><code>DEBUG_ENTRYPOINT</code></td>
<td>int</td>
<td><code>0</code></td>
<td>Set debug level for startup.<br/><sub><code>0</code> Only warnings and errors are shown.<br/><code>1</code> All log messages are shown<br/><code>2</code> All log messages and executed commands are shown.</sub></td>
</tr>
<tr>
<td><code>NEW_UID</code></td>
<td>int</td>
<td><code>1000</code></td>
<td>Assign the PHP-FPM user a new <code>uid</code> in order to syncronize file system permissions with your host computer and the Docker container. You should use a value that matches your host systems local user.<br/><sub>(Type <code>id</code> for your uid).</sub></td>
</tr>
<tr>
<td><code>NEW_GID</code></td>
<td>int</td>
<td><code>1000</code></td>
<td>Assign the PHP-FPM group a new <code>gid</code> in order to syncronize file system permissions with your host computer and the Docker container. You should use a value that matches your host systems local group.<br/><sub>(Type <code>id</code> for your gid).</sub></td>
</tr>
<tr>
<td colspan="5"></td>
</tr>
<tr>
<td rowspan="4"><strong>prod</strong><br/><br/><strong>work</strong></td>
<td><code>TIMEZONE</code></td>
<td>string</td>
<td><code>UTC</code></td>
<td>Set docker OS timezone as well as PHP timezone.<br/>(Example: <code>Europe/Berlin</code>)</td>
</tr>
<tr>
<td><code>DOCKER_LOGS</code></td>
<td>bool</td>
<td><code>1</code></td>
<td>By default all Docker images are configured to output their PHP-FPM access and error logs to stdout and stderr. Those which support it can change the behaviour to log into files inside the container. Their respective directories are available as volumes that can be mounted to the host computer. This feature might help developer who are more comfortable with tailing or searching through actual files instead of using docker logs.<br/><br/>Set this variable to <code>0</code> in order to enable logging to files. Log files are avilable under <code>/var/log/php/</code> which is also a docker volume that can be mounted locally.</td>
</tr>
<tr>
<td><code>ENABLE_MAIL</code></td>
<td>bool</td>
<td><code>0</code></td>
<td>Enable local email catch-all.<br/>Postfix will be configured for local delivery and all mails sent (even to real domains) will be catched locally. No email will ever go out. They will all be stored in a local devilbox account.<br/>Value: <code>0</code> or <code>1</code></td>
</tr>
<tr>
<td><code>FORWARD_PORTS_TO_LOCALHOST</code></td>
<td>string</td>
<td></td>
<td>List of remote ports to forward to 127.0.0.1.<br/><strong>Format:</strong><br/><sub><code>&lt;local-port&gt;:&lt;remote-host&gt;:&lt;remote-port&gt;</code></sub><br/>You can separate multiple entries by comma.<br/><strong>Example:</strong><br/><sub><code>3306:mysqlhost:3306, 6379:192.0.1.1:6379</code></sub></td>
</tr>
<tr>
<td colspan="5"></td>
</tr>
<tr>
<td rowspan="3"><strong>work</strong></td>
<td><code>MYSQL_BACKUP_USER</code></td>
<td>string</td>
<td><code>''</code></td>
<td>Username for mysql backups used for bundled <a href="https://mysqldump-secure.org" >mysqldump-secure</a></td>
</tr>
<tr>
<td><code>MYSQL_BACKUP_PASS</code></td>
<td>string</td>
<td><code>''</code></td>
<td>Password for mysql backups used for bundled <a href="https://mysqldump-secure.org" >mysqldump-secure</a></td>
</tr>
<tr>
<td><code>MYSQL_BACKUP_HOST</code></td>
<td>string</td>
<td><code>''</code></td>
<td>Hostname for mysql backups used for bundled <a href="https://mysqldump-secure.org" >mysqldump-secure</a></td>
</tr>
</tbody>
</table>
<h2><img id="modules" width="20" src="https://github.com/devilbox/artwork/raw/master/submissions_logo/cytopia/01/png/logo_64_trans.png"> Modules</h2>
<table>
<thead>

168
tests/.lib.sh Executable file
View File

@@ -0,0 +1,168 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
###
### Run
###
function run() {
local cmd="${1}"
local to_stderr=0
# Output to stderr instead?
if [ "${#}" -eq "2" ]; then
to_stderr="${2}"
fi
local red="\033[0;31m"
local green="\033[0;32m"
local yellow="\033[0;33m"
local reset="\033[0m"
if [ "${to_stderr}" -eq "0" ]; then
printf "${yellow}[%s] ${red}%s \$ ${green}${cmd}${reset}\n" "$(hostname)" "$(whoami)"
else
printf "${yellow}[%s] ${red}%s \$ ${green}${cmd}${reset}\n" "$(hostname)" "$(whoami)" >&2
fi
if sh -c "LANG=C LC_ALL=C ${cmd}"; then
if [ "${to_stderr}" -eq "0" ]; then
printf "${green}[%s]${reset}\n" "OK"
else
printf "${green}[%s]${reset}\n" "OK" >&2
fi
return 0
else
if [ "${to_stderr}" -eq "0" ]; then
printf "${red}[%s]${reset}\n" "NO"
else
printf "${red}[%s]${reset}\n" "NO" >&2
fi
return 1
fi
}
###
### Run (must fail in order to succeed)
###
function run_fail() {
local cmd="${1}"
local to_stderr=0
# Output to stderr instead?
if [ "${#}" -eq "2" ]; then
to_stderr="${2}"
fi
local red="\033[0;31m"
local green="\033[0;32m"
local yellow="\033[0;33m"
local reset="\033[0m"
if [ "${to_stderr}" -eq "0" ]; then
printf "${yellow}[%s] ${red}%s \$ ${yellow}[NOT] ${green}${cmd}${reset}\n" "$(hostname)" "$(whoami)"
else
printf "${yellow}[%s] ${red}%s \$ ${yellow}[NOT] ${green}${cmd}${reset}\n" "$(hostname)" "$(whoami)" >&2
fi
if ! sh -c "LANG=C LC_ALL=C ${cmd}"; then
if [ "${to_stderr}" -eq "0" ]; then
printf "${green}[%s]${reset}\n" "OK"
else
printf "${green}[%s]${reset}\n" "OK" >&2
fi
return 0
else
if [ "${to_stderr}" -eq "0" ]; then
printf "${red}[%s]${reset}\n" "NO"
else
printf "${red}[%s]${reset}\n" "NO" >&2
fi
return 1
fi
}
###
### Get 15 character random word
###
function get_random_name() {
local chr=(a b c d e f g h i j k l m o p q r s t u v w x y z)
local len="${#chr[@]}"
local name=
for i in {1..15}; do
rand="$( shuf -i 0-${len} -n 1 )"
rand=$(( rand - 1 ))
name="${name}${chr[$rand]}"
i="${i}" # simply to get rid of shellcheck complaints
done
echo "${name}"
}
###
### Docker run
###
function docker_run() {
local image_name="${1}"
shift
local args="${*}"
# Returns docker-id
did="$( run "docker run -d --name $( get_random_name ) ${args} ${image_name}" "1" )"
sleep 4
# If it fails, start again in foreground to fail again, but show errors
if ! docker exec -it ${did} ls >/dev/null 2>&1; then
docker run "${args}" "${image_name}" "1"
return 1
fi
# Only get 8 digits of docker id
echo "${did}" | grep -Eo '^[0-9a-zA-Z]{8}'
}
###
### Show Docker logs
###
function docker_logs() {
local docker_id="${1}"
run "docker logs ${docker_id}"
}
###
### Docker exec
###
function docker_exec() {
local did="${1}"
local cmd="${2}"
shift
shift
local args="${*}"
run "docker exec ${args} -it ${did} ${cmd}"
}
###
### Stop container
###
function docker_stop() {
local did="${1}"
local name=
name="$( docker ps --no-trunc --format='{{.ID}} {{.Names}}' | grep "${did}" | head -1 | awk '{print $2}' )"
# Stop
run "docker stop ${did} >/dev/null"
if docker ps | grep -q "${did}"; then
run "docker kill ${did} >/dev/null" || true
fi
# Remove if still exist
run "docker rm ${name} >/dev/null 2>&1 || true"
}

View File

@@ -0,0 +1,97 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
IMAGE="${1}"
VERSION="${2}"
FLAVOUR="${3}"
# shellcheck disable=SC1090
. "${CWD}/../.lib.sh"
############################################################
# Tests
############################################################
###
### Debug == 0
###
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=0" )"
if ! run_fail "docker logs ${did} 2>&1 | grep 'Debug level'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! run_fail "docker logs ${did} 2>&1 | grep '\[INFO\]'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! run_fail "docker logs ${did} 2>&1 | grep -E '\[(ERR|\?\?\?)\]'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
docker_stop "${did}"
###
### Debug == 1
###
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=1" )"
if ! run "docker logs ${did} 2>&1 | grep 'Debug level: 1'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! run "docker logs ${did} 2>&1 | grep '\[INFO\]'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! run_fail "docker logs ${did} 2>&1 | grep -E '\[(ERR|\?\?\?)\]'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
docker_stop "${did}"
###
### Debug == 2
###
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=2" )"
if ! run "docker logs ${did} 2>&1 | grep 'Debug level: 2'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! run "docker logs ${did} 2>&1 | grep '\[INFO\]'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! run_fail "docker logs ${did} 2>&1 | grep -E '\[(ERR|\?\?\?)\]'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
docker_stop "${did}"

77
tests/base/02-test-env-uid.sh Executable file
View File

@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
IMAGE="${1}"
VERSION="${2}"
FLAVOUR="${3}"
# shellcheck disable=SC1090
. "${CWD}/../.lib.sh"
############################################################
# Tests
############################################################
###
### uid: 1005 (new uid)
###
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=2 -e NEW_UID=1005" )"
if ! run "docker logs ${did} 2>&1 | grep -q '1005'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! docker_exec "${did}" "id | grep 'uid=1005'" "--user=devilbox"; then
docker_logs "${did}"
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
docker_stop "${did}"
###
### uid: 1000 (same uid)
###
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=2 -e NEW_UID=1000" )"
if ! run "docker logs ${did} 2>&1 | grep -q '1000'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! docker_exec "${did}" "id | grep 'uid=1000'" "--user=devilbox"; then
docker_logs "${did}"
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
docker_stop "${did}"
###
### uid: 33 (existing uid)
###
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=2 -e NEW_UID=33" )"
if ! run "docker logs ${did} 2>&1 | grep -q '33'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! docker_exec "${did}" "id | grep 'uid=33'" "--user=devilbox"; then
docker_logs "${did}"
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
docker_stop "${did}"

77
tests/base/03-test-env-gid.sh Executable file
View File

@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
IMAGE="${1}"
VERSION="${2}"
FLAVOUR="${3}"
# shellcheck disable=SC1090
. "${CWD}/../.lib.sh"
############################################################
# Tests
############################################################
###
### gid: 1005 (new gid)
###
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=2 -e NEW_GID=1005" )"
if ! run "docker logs ${did} 2>&1 | grep -q '1005'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! docker_exec "${did}" "id | grep 'gid=1005'" "--user=devilbox"; then
docker_logs "${did}"
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
docker_stop "${did}"
###
### gid: 1000 (same gid)
###
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=2 -e NEW_GID=1000" )"
if ! run "docker logs ${did} 2>&1 | grep -q '1000'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! docker_exec "${did}" "id | grep 'gid=1000'" "--user=devilbox"; then
docker_logs "${did}"
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
docker_stop "${did}"
###
### gid: 33 (existing gid)
###
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=2 -e NEW_GID=33" )"
if ! run "docker logs ${did} 2>&1 | grep -q '33'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! docker_exec "${did}" "id | grep 'gid=33'" "--user=devilbox"; then
docker_logs "${did}"
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
docker_stop "${did}"

View File

@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
IMAGE="${1}"
VERSION="${2}"
FLAVOUR="${3}"
# shellcheck disable=SC1090
. "${CWD}/../.lib.sh"
############################################################
# Tests
############################################################
###
### Europe/Berlin
###
did="$( docker_run "${IMAGE}:${VERSION}-${FLAVOUR}" "-e DEBUG_ENTRYPOINT=2 -e TIMEZONE=Europe/Berlin" )"
if ! run "docker logs ${did} 2>&1 | grep -q 'Europe/Berlin'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! docker_exec "${did}" "date | grep -E 'CE(S)*T'"; then
docker_exec "${did}" "date"
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
if ! docker_exec "${did}" "php -i | grep -E 'date\.timezone' | grep 'Europe/Berlin'"; then
docker_logs "${did}" || true
docker_stop "${did}" || true
echo "Failed"
exit 1
fi
docker_stop "${did}"

107
tests/test.sh Executable file
View File

@@ -0,0 +1,107 @@
#!/usr/bin/env bash
###
### Settings
###
# Be strict
set -e
set -u
set -o pipefail
# Loop over newlines instead of spaces
IFS=$'\n'
###
### Variables
###
# Current directory
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
# Array of tests to run
declare -a BASE_TESTS=()
declare -a MODS_TESTS=()
declare -a PROD_TESTS=()
declare -a WORK_TESTS=()
###
### Source libs
###
# shellcheck disable=SC1090
. "${CWD}/.lib.sh"
###
### Sanity check
###
if [ "${#}" -ne "2" ]; then
echo "Usage: start.ci <version> <flavour>"
exit 1
fi
###
### Find test files
###
FILES="$( find ${CWD} -regex "${CWD}/base/[0-9].+.*\.sh" | sort -u )"
for f in ${FILES}; do
BASE_TESTS+=("${f}")
done
FILES="$( find ${CWD} -regex "${CWD}/mods/[0-9].+.*\.sh" | sort -u )"
for f in ${FILES}; do
MODS_TESTS+=("${f}")
done
FILES="$( find ${CWD} -regex "${CWD}/prod/[0-9].+.*\.sh" | sort -u )"
for f in ${FILES}; do
PROD_TESTS+=("${f}")
done
FILES="$( find ${CWD} -regex "${CWD}/work/[0-9].+.*\.sh" | sort -u )"
for f in ${FILES}; do
WORK_TESTS+=("${f}")
done
###
### Run tests
###
if [ "${2}" = "base" ] || [ "${2}" = "mods" ] || [ "${2}" = "prod" ] || [ "${2}" = "work" ]; then
for t in "${BASE_TESTS[@]}"; do
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
printf "\033[0;33m%s %s\033[0m\n" "#" "[${1}-${2}]: ${t}"
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
time ${t} devilbox/php-fpm ${1} ${2}
done
fi
if [ "${2}" = "mods" ] || [ "${2}" = "prod" ] || [ "${2}" = "work" ]; then
for t in "${MODS_TESTS[@]}"; do
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
printf "\033[0;33m%s %s\033[0m\n" "#" "[${1}-${2}]: ${t}"
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
time ${t} devilbox/php-fpm ${1} ${2}
done
fi
if [ "${2}" = "prod" ] || [ "${2}" = "work" ]; then
for t in "${PROD_TESTS[@]}"; do
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
printf "\033[0;33m%s %s\033[0m\n" "#" "[${1}-${2}]: ${t}"
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
time ${t} devilbox/php-fpm ${1} ${2}
done
fi
if [ "${2}" = "work" ]; then
for t in "${WORK_TESTS[@]}"; do
printf "\n\n\033[0;33m%s\033[0m\n" "################################################################################"
printf "\033[0;33m%s %s\033[0m\n" "#" "[${1}-${2}]: ${t}"
printf "\033[0;33m%s\033[0m\n\n" "################################################################################"
time ${t} devilbox/php-fpm ${1} ${2}
done
fi