1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-04 15:54:48 +01:00

Add Vagrant support for running automated tests

This commit is contained in:
downtownallday
2020-06-21 09:13:54 -04:00
parent 25f5690655
commit a5ab29c83f
12 changed files with 166 additions and 23 deletions

View File

@@ -1,9 +1,23 @@
# ansi escapes for hilighting text
F_DANGER=$(echo -e "\033[31m")
F_WARN=$(echo -e "\033[93m")
F_SUCCESS=$(echo -e "\033[32m")
F_RESET=$(echo -e "\033[39m")
success() {
local echoarg
case "$1" in
-n )
echoarg="$1"
shift
;;
* )
echoarg=""
esac
echo $echoarg "${F_SUCCESS}$1${F_RESET}"
}
danger() {
local echoarg
case "$1" in

View File

@@ -67,3 +67,17 @@ sha1() {
python3 -c "import hashlib; m=hashlib.sha1(); m.update(bytearray(r'''$txt''','utf-8')); print(m.hexdigest());" || die "Unable to generate sha1 hash"
}
elapsed_pretty() {
local start_s="$1"
local end_s="$2"
local elapsed elapsed_m elapsed_s
if [ -z "$end_s" ]; then
elapsed="$start_s"
else
let elapsed="$end_s - $start_s"
fi
let elapsed_m="$elapsed / 60"
let elapsed_s="$elapsed % 60"
echo "${elapsed_m}m ${elapsed_s}s"
}