Tomb/extras/test/testall.sh
Jaromil 3eb93acc18 Directory reorganization
This commit re-organizes all the source distribution contents to
present users with the simple script, while moving the rest in extras.
Also autoconf/automake scripts were removed, back to minimalism.

The rationale of this change is that Tomb really only consists of a
script and users with no extra needs should just be presented with
it with no need for anything else. Any other thing on top of the Tomb
script is an extra and can be even distributed separately or integrated
in distributions.
2013-05-18 17:29:37 +02:00

49 lines
924 B
Bash
Executable File

#!/usr/bin/env zsh
test_file() {
t=$1
echo -n "$fg[yellow]$t start test... $fg[default]"
sudo_pwd=$sudo_pwd source $t 3> /tmp/tomb_test_errorlog 4> /tmp/tomb_test_fulllog
ret=$?
if [[ `stat -c '%s' /tmp/tomb_test_errorlog` == 0 ]]; then
echo "$fg[green] OK$fg[default]"
else
echo "$fg[red] ERRORS$fg[default]"
< /tmp/tomb_test_errorlog
rm /tmp/tomb_test_errorlog
#TODO: make it optional!
echo "\n--- Full log (for $t) ---\n"
< /tmp/tomb_test_fulllog
rm /tmp/tomb_test_fulllog
return 1
fi
return 0
}
source utils.sh
if [[ -z $sudo_pwd ]]; then
echo "WARNING: sudo_pwd is probably needed by some test"
fi
rm /tmp/tomb_test_errorlog -f &> /dev/null
has_err=0
autoload colors
colors
if [[ $# == 0 ]]; then
for t in *.test.sh; do
test_file $t
if [[ $? != 0 ]]; then
has_err=$?
fi
done
else
for t in "$@"; do
test_file $t
if [[ $? != 0 ]]; then
has_err=$?
fi
done
fi
exit $has_err