• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# Test script for e2fsck
4#
5
6LC_ALL=C
7export LC_ALL
8
9case "$1" in
10    --valgrind)
11    	export USE_VALGRIND="valgrind -q --weird-hacks=lax-ioctls"
12	shift;
13esac
14
15if test "$1"x = x ; then
16  TESTS=`ls -d $SRCDIR/[a-zA-Z]_* | $EGREP -v "\.failed|\.new"`
17else
18  TESTS=
19  for i
20  do
21    case $i in
22	*.failed|*.new)	continue ;;
23	[a-zA-Z])	TESTS="$TESTS $SRCDIR/${i}_*" ;;
24	*)		TESTS="$TESTS $SRCDIR/$i" ;;
25    esac
26  done
27fi
28
29cmd_dir=$SRCDIR
30
31if test "$TEST_CONFIG"x = x; then
32	TEST_CONFIG=$SRCDIR/test_config
33fi
34
35. $TEST_CONFIG
36
37for test_dir in $TESTS
38do
39	test_name=`echo $test_dir | sed -e 's;.*/;;'`
40	if [ -f $test_dir ] ; then
41	    continue;
42	fi
43	if [ ! -d $test_dir ] ; then
44		echo "The test '$test_name' does not exist."
45		continue;
46	fi
47	if [ -z "`ls $test_dir`" ]; then
48		continue
49	fi
50	if [ -f $test_dir/name ]; then
51		test_description=`cat $test_dir/name`
52		printf "%s: %s: " "$test_name" "$test_description"
53	else
54		printf "%s: " "$test_name"
55	fi
56	if [ -f $test_dir/script ]; then
57		. $test_dir/script
58	else
59		test_base=`echo $test_name | sed -e 's/_.*//'`
60		default_script=$SRCDIR/defaults/${test_base}_script
61		if [ -f $default_script ]; then
62			. $SRCDIR/defaults/${test_base}_script
63		else
64			echo "Missing test script!"
65		fi
66	fi
67done
68
69num_ok=`ls *.ok 2>/dev/null | wc -l`
70num_failed=`ls *.failed 2>/dev/null | wc -l`
71
72echo "$num_ok tests succeeded	$num_failed tests failed"
73
74test "$num_failed" -eq 0 || exit 1
75