summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2017-01-11 10:31:28 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2017-01-11 10:31:28 +0100
commit67defaf0521dce0ac2dc4e2af2813ff8090b8619 (patch)
tree1b26c780068c3251aa446c930d4cd5f8c6ee1764
parent7e5b3e5f275d6faab250de45c595f00d5ea38402 (diff)
downloadbin-67defaf0521dce0ac2dc4e2af2813ff8090b8619.zip
bin-67defaf0521dce0ac2dc4e2af2813ff8090b8619.tar.gz
mtests: add -c|--color option
-rwxr-xr-xmtests.sh26
1 files changed, 21 insertions, 5 deletions
diff --git a/mtests.sh b/mtests.sh
index 37e00a4..888406a 100755
--- a/mtests.sh
+++ b/mtests.sh
@@ -9,15 +9,17 @@
SCRIPT_DIR=${0%/*}
SCRIPT_FILE=${0##*/}
-RESET="\033[0m"
-RED="\033[0;31m"
-GREEN="\033[0;32m"
-BROWN="\033[0;33m"
-PURPLE="\033[0;35m"
+# colors
+RESET=""
+RED=""
+GREEN=""
+BROWN=""
+PURPLE=""
# arguments
ABORT=0
QUIET=0
+COLOR=0
TESTS=""
SRC_D="src"
BUILD_D="build"
@@ -82,6 +84,10 @@ while [ $# -ge 1 ]; do
shift
ABORT=1
;;
+ -c|--color)
+ shift
+ COLOR=1
+ ;;
-q|--quiet)
shift
QUIET=1
@@ -92,6 +98,7 @@ while [ $# -ge 1 ]; do
echo "Options:"
echo " -b, --abort Abort on test failure"
echo " -q, --quiet Only output failed tests"
+ echo " -c, --color Pretty pretty"
echo " -s, --src directory Directory to search for tests into"
echo " -b, --build directory Directory to search for built files into"
echo " -h, --help This message."
@@ -104,6 +111,15 @@ while [ $# -ge 1 ]; do
esac
done
+if [ $COLOR -eq 1 ]
+then
+ RESET="\033[0m"
+ RED="\033[0;31m"
+ GREEN="\033[0;32m"
+ BROWN="\033[0;33m"
+ PURPLE="\033[0;35m"
+fi
+
[ -d "$SRC_D" -a -r "$SRC_D" ] || fatal "$SRC_D is not a valid directory"
[ -d "$BUILD_D" -a -r "$BUILD_D" ] || fatal "$BUILD_D is not a valid directory"
mkdir -p $TEST_D || fatal "cannot create $TEST_D directory"