*** empty log message ***
[arla.git] / tests / run-tests.in
blob3087e5028bff739d9b039288ac5c552aee8e1695
1 #!/bin/sh
3 # $Id$
5 srcdir=@srcdir@
6 objdir=`pwd`
7 SHELL=/bin/sh
8 VERSION=@VERSION@
9 PACKAGE=@PACKAGE@
10 host=@host@
11 RUNAS=nobody
13 AFSROOT=${AFSROOT-/afs}
14 export AFSROOT
16 ARLA_TESTS="creat1 \
17 mkdir1 \
18 mkdir2 \
19 symlink \
20 hardlink1 \
21 hardlink2 \
22 hardlink3 \
23 check-sysname \
24 touch1 \
25 write1 \
26 write2 \
27 write3 \
28 write4 \
29 append1 \
30 rename1 \
31 rename2 \
32 rename3 \
33 rename4 \
34 rename5 \
35 rename-under-feet \
36 unlink-under-feet \
37 large-filename \
38 fchmod \
39 truncate \
40 truncate-write \
41 mkdir-lnk \
42 mkm-rmm \
43 fs-sa-la \
44 copy-file \
45 copy-file2 \
46 copy-file-4G \
47 dd \
48 exec \
49 ga-test \
50 kotest \
51 readfile-wo-create \
52 mountpoint \
53 strange-characters \
54 strange-characters-c \
55 strange-other-characters \
56 pine \
57 write-ro-file \
58 write-error \
59 write-link \
60 hello-world \
61 write-ucc \
62 utime-dir \
63 append-over-page \
64 mmap-shared-write \
65 read-vs-mmap \
66 read-vs-mmap2 \
67 read-past-eof \
68 mmap-vs-read \
69 mmap-vs-read2 \
70 read-write \
71 mmap-and-read \
72 mmap-and-fork \
73 checkpwd \
74 exit-wo-close \
75 dir-size-mismatch \
76 parallel1 \
77 part-files \
78 intr-read1 \
79 intr-read2 \
80 intr-read3 \
81 kill-mh \
82 blocks-new-file \
83 getdents-and-unlink1 \
84 getdents-and-unlink2 \
85 getdents-and-unlink3 \
86 build-gdb \
87 large-dir-16384 \
88 large-dir-extra \
89 find-linux \
90 find-and-cat-openbsd \
91 test-gunzip-gnu-mirror \
92 build-emacs \
93 build-emacs-j \
94 untar-emacs \
95 copy-and-diff-gnu-mirror \
96 setpag \
97 create-remove-files \
98 create-remove-dirs \
99 macos-getattrlist-leak \
100 mtime-file \
101 volcache-lookup \
102 compare-inums"
104 # this should really be work, but it's hard and it doesn't work so
105 # leave it out not to scare users
107 # compare-inum-mp \
109 # visit-volumes \
112 # discon-create \
113 # discon-echo \
114 # discon-touch1 \
115 # discon-touch2 \
116 # discon-mkdir \
117 # discon-mkdir2 \
118 # discon-tar1 \
119 # discon-tar2 \
121 # you need to be root to run this: setgroups
123 MILKO_TESTS="mkdir \
124 many-dirs \
125 many-files \
126 many-symlinks \
127 many-files-with-content \
128 many-stores \
129 many-fetchs \
130 deep-tree \
131 deep-tree2 \
132 boot-strap-arla"
134 TESTS="$ARLA_TESTS"
135 TEST_MODE="arla"
137 linebreak=":-------------------------------;"
139 PARALLELL=
140 FAST=
141 LARGE=
142 FAIL=
143 PRINT_CACHESIZE=
144 usage="Usage: $0 [-user user] [-arla|-milko] [-all] [-fast] [-fail] [-large] [-j] [-verbose] [-x] tests ..."
145 while true
147 case $1 in
148 -all) ALL=yes;;
149 -fast) FAST=yes;;
150 -fail) FAIL=yes;;
151 -large) LARGE=yes;;
152 -j) PARALLELL="&";;
153 -verbose) VERBOSE=yes;;
154 -user) RUNAS=$2; shift;;
155 -x) SHELLVERBOSE="-x";;
156 -p) PRINT_CACHESIZE="yes";;
157 -arla) TESTS="$ARLA_TESTS";TEST_MODE="arla";;
158 -milko) TESTS="$MILKO_TESTS";TEST_MODE="milko";;
159 -help|--help) echo $usage;
160 echo "arla tests available: $linebreak"; for a in "$ARLA_TESTS"; do echo $a ; done;
161 echo "milko tests available: $linebreak"; for a in "$MILKO_TESTS"; do echo $a ; done;
162 exit 0;;
163 -version|--version) echo "$0 $Id$"; exit 0;;
164 -*) echo "$0: Bad option $1"; echo $usage; exit 1;;
165 *) break;;
166 esac
167 shift
168 done
170 if test "X$WORKDIR" = "X";then
171 echo "WORKDIR=workdir $0 $* or env WORKDIR=workdir $0 $*"; exit 1;
174 RUNTESTS=
175 if test "X$ALL" != "X" ; then
176 RUNTESTS="$TESTS"
177 elif test $# -lt 1; then
178 echo $usage; exit
179 else
180 RUNTESTS=$*
183 # these are variables exported to the scripts
185 export FAST
186 export LARGE
187 export VERBOSE
188 export SHELLVERBOSE
190 # and file descriptors
192 # 3 - progress
193 # 4 - details
195 if test "$VERBOSE" = "yes"; then
196 exec 3>/dev/null
197 exec 4>&1
198 else
199 exec 3>&1
200 exec 4>/dev/null
203 # Find out where we really are
205 srcdir=`cd $srcdir; pwd`
206 objdir=`cd $objdir; pwd`
208 export srcdir
209 export objdir
211 echo "-------------------------------------------------"
212 echo "$PACKAGE-$VERSION"
213 echo "hosttype $host"
214 echo "${SHELL},${SHELLVERBOSE},${VERBOSE},${PARALLELL},${FAST}"
215 echo "testmode ${TEST_MODE}"
216 echo "runas ${RUNAS}"
217 echo "${srcdir}"
218 echo "${objdir}"
219 echo "${WORKDIR}"
220 date
221 echo "-------------------------------------------------"
223 test "X$VERBOSE" != "X" && echo "Running tests"
225 FAILEDTESTS=
226 exitval=0
227 h=`hostname`
228 if [ X$h = X ] ; then
229 h=unknown-host
232 for a in $RUNTESTS; do
234 # XXX Test if binary in $srcdir, shellscript in $srcdir else
235 # its a binary in objdir
237 if test -x ${srcdir}/$a ; then
238 b="${srcdir}/$a"
239 elif test -f ${srcdir}/$a ; then
240 b="${SHELL} ${SHELLVERBOSE} ${srcdir}/$a"
241 else
242 b="${objdir}/$a"
244 echo "`date '+%Y-%m-%d %H:%M:%S'` - Running $a"
245 test "X$VERBOSE" != "X" && echo "Running test $a ($b)."
246 b="${objdir}/asu $RUNAS $b"
247 tmpdir="$h-$a-`date +%Y-%m-%d-%H-%M-%S`-$$"
248 cd $WORKDIR && mkdir $tmpdir && (cd $tmpdir && $b ${PARALLELL})
249 saved_res=$?
250 test "X$VERBOSE" != "X" && echo "Saved res = $saved_res"
251 if test "X${PARALLELL}" = "X" ;then
252 if test $saved_res != 0 ; then
253 echo "Test $a FAILED"
254 FAILEDTESTS="${FAILEDTESTS} $a";
255 exitval=$savedres
256 if test X$FAIL != X; then break; fi
257 else
258 test "X$VERBOSE" != "X" && echo "Test $a succeeded, tmpdir is removed"
259 ${objdir}/rm-rf $tmpdir
261 test "X$VERBOSE" != "X" && echo "Done test $a."
263 test "X${PRINT_CACHESIZE}" = Xyes && $objdir/../appl/fs/fs calculate
264 done
266 wait
267 date
269 if test "$FAILEDTESTS"; then
270 echo "-----------------------------------------------------------"
271 echo "Failed test(s) were: $FAILEDTESTS"
272 else
273 echo "All test(s) were succesful!"
276 exit $exitval