# Test script for e2fsck
#
+LC_ALL=C
+export LC_ALL
+
+case "$1" in
+ --valgrind)
+ export USE_VALGRIND="valgrind -q --sim-hints=lax-ioctls"
+ shift;
+ ;;
+ --valgrind-leakcheck)
+ export USE_VALGRIND="valgrind --sim-hints=lax-ioctls --leak-check=full --show-reachable=yes --log-file=/tmp/valgrind-%p.log"
+ shift;
+ ;;
+esac
+
if test "$1"x = x ; then
- TESTS=$SRCDIR/[a-zA-Z]_*
+ TESTS=`ls -d $SRCDIR/[a-zA-Z]_* | $EGREP -v "\.failed|\.new"`
else
TESTS=
for i
do
- TESTS="$TESTS $SRCDIR/$i"
+ case $i in
+ *.failed|*.new) continue ;;
+ [a-zA-Z]) TESTS="$TESTS $SRCDIR/${i}_*" ;;
+ *) TESTS="$TESTS $SRCDIR/$i" ;;
+ esac
done
fi
. $TEST_CONFIG
+TMPFILE=$(mktemp)
+
for test_dir in $TESTS
do
test_name=`echo $test_dir | sed -e 's;.*/;;'`
+ if [ -f $test_dir ] ; then
+ continue;
+ fi
+ if [ ! -d $test_dir ] ; then
+ echo "The test '$test_name' does not exist."
+ continue;
+ fi
+ if [ -z "`ls $test_dir`" ]; then
+ continue
+ fi
if [ -f $test_dir/name ]; then
test_description=`cat $test_dir/name`
- echo -n "$test_name: $test_description: "
+ printf "%s: %s: " "$test_name" "$test_description"
else
- echo -n "$test_name: "
+ printf "%s: " "$test_name"
fi
if [ -f $test_dir/script ]; then
. $test_dir/script
echo "$num_ok tests succeeded $num_failed tests failed"
+test "$num_failed" -eq 0 && exit 0
+
+echo -n "Tests failed: "
+for fname in $(ls *.failed); do
+ echo -n "${fname%%.failed} "
+done
+echo ""
+
+exit 1