Commit | Line | Data |
---|---|---|
805e021f CE |
1 | #!/bin/sh |
2 | # | |
3 | # $Id$ | |
4 | # | |
5 | ||
6 | # Directory paths configured during the build. | |
7 | if test -f ./OpenAFS/Dirpath.sh; then | |
8 | . ./OpenAFS/Dirpath.sh | |
9 | else | |
10 | echo "error: Missing file OpenAFS/Dirpath.sh. Run 'make all' first." | |
11 | exit 1 | |
12 | fi | |
13 | ||
14 | if ! test -f ./run-tests.conf; then | |
15 | echo "warning: Creating run-tests.conf with default values." | |
16 | echo " Please edit run-tests.conf to match your test cell configuration." | |
17 | echo "CELLNAME=testcell" > ./run-tests.conf | |
18 | echo "PARTITION=a" >>./run-tests.conf | |
19 | echo "ADMIN=admin" >>./run-tests.conf | |
20 | echo "KERBEROS_TYPE=kaserver" >>./run-tests.conf | |
21 | echo "KERBEROS_REALM=TESTCELL" >>./run-tests.conf | |
22 | echo "KERBEROS_KEYTAB=${AFSCONFDIR}/krb5.keytab" >>./run-tests.conf | |
23 | fi | |
24 | . ./run-tests.conf | |
25 | ||
26 | ||
27 | srcdir=@srcdir@ | |
28 | objdir=`pwd` | |
29 | SHELL=/bin/sh | |
30 | SHELLVERBOSE= | |
31 | VERSION=@PACKAGE_VERSION@ | |
32 | PACKAGE=@PACKAGE_TARNAME@ | |
33 | host=@host@ | |
34 | RUNAS= | |
35 | FS=${AFSSRVBINDIR}/fs | |
36 | CELLNAME=${CELLNAME-testcell} | |
37 | export FS | |
38 | export SHELL | |
39 | ||
40 | ||
41 | PERL5LIB=${PERL5LIB-`pwd`} | |
42 | AFSROOT=${AFSROOT-/afs} | |
43 | TESTDIR=${TESTDIR-unreplicated} | |
44 | WORKDIR=$AFSROOT/$CELLNAME/$TESTDIR | |
45 | export AFSROOT | |
46 | export TESTDIR | |
47 | export WORKDIR | |
48 | export PERL5LIB | |
49 | ||
50 | ||
51 | BASIC_TESTS="creat1 \ | |
52 | mkdir1 \ | |
53 | mkdir2 \ | |
54 | symlink \ | |
55 | hardlink1 \ | |
56 | hardlink4 \ | |
57 | hardlink2 \ | |
58 | hardlink5 \ | |
59 | touch1 \ | |
60 | write1 \ | |
61 | write3 \ | |
62 | rename1 \ | |
63 | hardlink3 \ | |
64 | write2 \ | |
65 | append1 \ | |
66 | rename2 \ | |
67 | rename4 \ | |
68 | rename6 \ | |
69 | rename-under-feet \ | |
70 | large-filename \ | |
71 | fchmod \ | |
72 | utime-file \ | |
73 | utime-dir \ | |
74 | mkdir3" | |
75 | ||
76 | MTPT_TESTS="mkm-rmm \ | |
77 | mountpoint" | |
78 | ||
79 | ACL_TESTS="acladduser.pl \ | |
80 | acladdgroup.pl \ | |
81 | acladdrights.pl \ | |
82 | acladdnegrights.pl \ | |
83 | aclclearnegrights.pl \ | |
84 | aclremoveuser.pl \ | |
85 | aclremovegroup.pl \ | |
86 | aclcopy.pl" | |
87 | ||
88 | EXEC_TESTS="exec \ | |
89 | hello-world" | |
90 | ||
91 | MMAP_TESTS="append-over-page \ | |
92 | mmap-shared-write \ | |
93 | mmap-vs-read2 \ | |
94 | mmap-vs-read \ | |
95 | read-vs-mmap2 \ | |
96 | read-vs-mmap" | |
97 | ||
98 | FS_TESTS="strange-characters \ | |
99 | pine \ | |
100 | parallel1 \ | |
101 | write-large" | |
102 | ||
103 | AFS_TESTS="write-ro \ | |
104 | too-many-files \ | |
105 | setpag \ | |
106 | setgroups" | |
107 | ||
108 | RMT_TESTS="extcopyin \ | |
109 | extcopyout" | |
110 | ||
111 | ABUSE_TESTS="read-write \ | |
112 | create-remove-files \ | |
113 | run-fsx" | |
114 | ||
115 | PTS_TESTS="ptscreateuser.pl \ | |
116 | ptscreategroup.pl \ | |
117 | ptsadduser.pl \ | |
118 | ptschown.pl \ | |
119 | ptsmembersuser.pl \ | |
120 | ptsmembersgroup.pl \ | |
121 | ptsexamineuser.pl \ | |
122 | ptsexaminegroup.pl \ | |
123 | ptsremove.pl \ | |
124 | ptslistown.pl \ | |
125 | ptssetmax.pl \ | |
126 | ptslistmax.pl \ | |
127 | ptssetf.pl \ | |
128 | ptsdeletegroup.pl \ | |
129 | ptsdeleteuser.pl" | |
130 | ||
131 | VOS_TESTS="voscreate.pl \ | |
132 | vosmove.pl \ | |
133 | vosaddsite.pl \ | |
134 | vosrelease.pl \ | |
135 | vosremsite.pl \ | |
136 | vosremove.pl \ | |
137 | vosdelentry.pl \ | |
138 | vossyncvldb.pl \ | |
139 | voszap.pl \ | |
140 | vossyncserv.pl \ | |
141 | voslock.pl \ | |
142 | vosunlock.pl \ | |
143 | vosunlockall.pl \ | |
144 | vosrename.pl \ | |
145 | voslistvol.pl \ | |
146 | voslistvldb.pl \ | |
147 | vospartinfo.pl \ | |
148 | voslistpart.pl \ | |
149 | vosbackup.pl \ | |
150 | vosexamine.pl \ | |
151 | vosdump.pl \ | |
152 | vosrestore.pl" | |
153 | ||
154 | BOS_TESTS="bosaddhost.pl \ | |
155 | boslisthosts.pl \ | |
156 | bosremovehost.pl \ | |
157 | bosadduser.pl \ | |
158 | boslistusers.pl \ | |
159 | bosremoveuser.pl \ | |
160 | bosinstall.pl \ | |
161 | bosexec.pl \ | |
162 | boscreate.pl \ | |
163 | bosdeleterunning.pl \ | |
164 | bosstatus.pl \ | |
165 | bosstop.pl \ | |
166 | bosrestartstopped.pl \ | |
167 | bosstart.pl \ | |
168 | bosshutdown.pl \ | |
169 | bosdelete.pl \ | |
170 | bosaddkey.pl \ | |
171 | boslistkeys.pl \ | |
172 | bosremovekey.pl \ | |
173 | bossalvagevolume.pl \ | |
174 | bossalvagepart.pl \ | |
175 | bossalvageserver.pl" | |
176 | ||
177 | REG_TESTS="fcachesize-write-file \ | |
178 | fcachesize-read-file \ | |
179 | baduniq.pl" | |
180 | ||
181 | ALL_TESTS="creat1 \ | |
182 | mkdir1 \ | |
183 | mkdir2 \ | |
184 | symlink \ | |
185 | hardlink1 \ | |
186 | hardlink4 \ | |
187 | hardlink2 \ | |
188 | hardlink5 \ | |
189 | touch1 \ | |
190 | write1 \ | |
191 | write3 \ | |
192 | rename1 \ | |
193 | hardlink3 \ | |
194 | write2 \ | |
195 | append1 \ | |
196 | rename2 \ | |
197 | rename4 \ | |
198 | rename6 \ | |
199 | rename-under-feet \ | |
200 | large-filename \ | |
201 | fchmod \ | |
202 | utime-file \ | |
203 | utime-dir \ | |
204 | mkdir3 \ | |
205 | mkm-rmm \ | |
206 | mountpoint \ | |
207 | acladduser.pl \ | |
208 | acladdgroup.pl \ | |
209 | acladdrights.pl \ | |
210 | acladdnegrights.pl \ | |
211 | aclclearnegrights.pl \ | |
212 | aclremoveuser.pl \ | |
213 | aclremovegroup.pl \ | |
214 | aclcopy.pl \ | |
215 | exec \ | |
216 | hello-world \ | |
217 | append-over-page \ | |
218 | mmap-shared-write \ | |
219 | mmap-vs-read2 \ | |
220 | mmap-vs-read \ | |
221 | read-vs-mmap2 \ | |
222 | read-vs-mmap \ | |
223 | strange-characters \ | |
224 | pine \ | |
225 | parallel1 \ | |
226 | write-large \ | |
227 | write-ro \ | |
228 | too-many-files \ | |
229 | setpag \ | |
230 | setgroups \ | |
231 | extcopyin \ | |
232 | extcopyout \ | |
233 | read-write \ | |
234 | create-remove-files \ | |
235 | run-fsx \ | |
236 | ptscreateuser.pl \ | |
237 | ptscreategroup.pl \ | |
238 | ptsadduser.pl \ | |
239 | ptschown.pl \ | |
240 | ptsmembersuser.pl \ | |
241 | ptsmembersgroup.pl \ | |
242 | ptsexamineuser.pl \ | |
243 | ptsexaminegroup.pl \ | |
244 | ptsremove.pl \ | |
245 | ptslistown.pl \ | |
246 | ptssetmax.pl \ | |
247 | ptslistmax.pl \ | |
248 | ptssetf.pl \ | |
249 | ptsdeletegroup.pl \ | |
250 | ptsdeleteuser.pl \ | |
251 | voscreate.pl \ | |
252 | vosmove.pl \ | |
253 | vosaddsite.pl \ | |
254 | vosrelease.pl \ | |
255 | vosremsite.pl \ | |
256 | vosremove.pl \ | |
257 | vosdelentry.pl \ | |
258 | vossyncvldb.pl \ | |
259 | voszap.pl \ | |
260 | vossyncserv.pl \ | |
261 | voslock.pl \ | |
262 | vosunlock.pl \ | |
263 | vosunlockall.pl \ | |
264 | vosrename.pl \ | |
265 | voslistvol.pl \ | |
266 | voslistvldb.pl \ | |
267 | vospartinfo.pl \ | |
268 | voslistpart.pl \ | |
269 | vosbackup.pl \ | |
270 | vosexamine.pl \ | |
271 | vosdump.pl \ | |
272 | vosrestore.pl \ | |
273 | bosaddhost.pl \ | |
274 | boslisthosts.pl \ | |
275 | bosremovehost.pl \ | |
276 | bosadduser.pl \ | |
277 | boslistusers.pl \ | |
278 | bosremoveuser.pl \ | |
279 | bosinstall.pl \ | |
280 | bosexec.pl \ | |
281 | boscreate.pl \ | |
282 | bosdeleterunning.pl \ | |
283 | bosstatus.pl \ | |
284 | bosstop.pl \ | |
285 | bosrestartstopped.pl \ | |
286 | bosstart.pl \ | |
287 | bosshutdown.pl \ | |
288 | bosdelete.pl \ | |
289 | bosaddkey.pl \ | |
290 | boslistkeys.pl \ | |
291 | bosremovekey.pl \ | |
292 | bossalvagevolume.pl \ | |
293 | bossalvagepart.pl \ | |
294 | bossalvageserver.pl \ | |
295 | fcachesize-write-file \ | |
296 | fcachesize-read-file \ | |
297 | baduniq.pl" | |
298 | ||
299 | TESTS="$ALL_TESTS" | |
300 | TEST_MODE="all" | |
301 | ||
302 | linebreak=":-------------------------------;" | |
303 | ||
304 | PARALLELL= | |
305 | FAST= | |
306 | LARGE= | |
307 | PRINT_CACHESIZE= | |
308 | usage="Usage: $0 [-user user] [-all] [-fast] [-large] [-j] [-verbose] [-x] tests ..." | |
309 | while true | |
310 | do | |
311 | case $1 in | |
312 | -all) ALL=yes;; | |
313 | -fast) FAST=yes;; | |
314 | -large) LARGE=yes;; | |
315 | -j) PARALLELL="&";; | |
316 | -verbose) VERBOSE=yes;; | |
317 | -user) RUNAS=$2; shift;; | |
318 | -x) SHELLVERBOSE="-x";; | |
319 | -p) PRINT_CACHESIZE="yes";; | |
320 | -basic) TESTS="$BASIC_TESTS";TEST_MODE="basic";; | |
321 | -mtpt) TESTS="$MTPT_TESTS";TEST_MODE="mtpt";; | |
322 | -acl) TESTS="$ACL_TESTS";TEST_MODE="acl";; | |
323 | -exec) TESTS="$EXEC_TESTS";TEST_MODE="exec";; | |
324 | -mmap) TESTS="$MMAP_TESTS";TEST_MODE="mmap";; | |
325 | -fs) TESTS="$FS_TESTS";TEST_MODE="fs";; | |
326 | -afs) TESTS="$AFS_TESTS";TEST_MODE="afs";; | |
327 | -rmt) TESTS="$RMT_TESTS";TEST_MODE="rmt";; | |
328 | -abuse) TESTS="$ABUSE_TESTS";TEST_MODE="abuse";; | |
329 | -pts) TESTS="$PTS_TESTS";TEST_MODE="pts";; | |
330 | -vos) TESTS="$VOS_TESTS";TEST_MODE="vos";; | |
331 | -bos) TESTS="$BOS_TESTS";TEST_MODE="bos";; | |
332 | -reg) TESTS="$REG_TESTS";TEST_MODE="reg";; | |
333 | -help|--help) echo $usage; | |
334 | echo "tests available: $linebreak"; for a in "$ALL_TESTS"; do echo $a ; done; | |
335 | exit 0;; | |
336 | -version|--version) echo "$0 $Id$"; exit 0;; | |
337 | -*) echo "$0: Bad option $1"; echo $usage; exit 1;; | |
338 | *) break;; | |
339 | esac | |
340 | shift | |
341 | done | |
342 | ||
343 | if test "X$WORKDIR" = "X";then | |
344 | echo "WORKDIR=workdir $0 $* or env WORKDIR=workdir $0 $*"; exit 1; | |
345 | fi | |
346 | ||
347 | RUNTESTS= | |
348 | if test "X$ALL" != "X" ; then | |
349 | RUNTESTS="$TESTS" | |
350 | elif test $# -lt 1; then | |
351 | echo $usage; exit | |
352 | else | |
353 | RUNTESTS=$* | |
354 | fi | |
355 | ||
356 | # these are variables exported to the scripts | |
357 | ||
358 | export FAST | |
359 | export LARGE | |
360 | export VERBOSE | |
361 | export SHELLVERBOSE | |
362 | ||
363 | # and file descriptors | |
364 | ||
365 | # 3 - progress | |
366 | # 4 - details | |
367 | ||
368 | if test "$VERBOSE" = "yes"; then | |
369 | exec 3>/dev/null | |
370 | exec 4>&1 | |
371 | else | |
372 | exec 3>&1 | |
373 | exec 4>/dev/null | |
374 | fi | |
375 | ||
376 | # Find out where we really are | |
377 | ||
378 | srcdir=`cd $srcdir; pwd` | |
379 | objdir=`cd $objdir; pwd` | |
380 | ||
381 | export srcdir | |
382 | export objdir | |
383 | ||
384 | # login | |
385 | if [ "$KERBEROS_TYPE" != "kaserver" ] ; then | |
386 | kinit -k -t $KERBEROS_KEYTAB $ADMIN || exit 1; | |
387 | ${AFSWSBINDIR}/aklog -d -c $CELLNAME || exit 1; | |
388 | fi | |
389 | ||
390 | echo "-------------------------------------------------" | |
391 | echo "$PACKAGE-$VERSION" | |
392 | echo "hosttype $host" | |
393 | echo "${SHELL},${SHELLVERBOSE},${VERBOSE},${PARALLELL},${FAST}" | |
394 | echo "testmode ${TEST_MODE}" | |
395 | echo "runas ${RUNAS}" | |
396 | echo "${srcdir}" | |
397 | echo "${objdir}" | |
398 | echo "${WORKDIR}" | |
399 | date | |
400 | echo "-------------------------------------------------" | |
401 | ||
402 | test "X$VERBOSE" != "X" && echo "Running tests" | |
403 | ||
404 | FAILEDTESTS= | |
405 | exitval=0 | |
406 | ||
407 | for a in $RUNTESTS; do | |
408 | # | |
409 | # XXX Test if binary in $srcdir, shellscript in $srcdir else | |
410 | # its a binary in objdir | |
411 | # | |
412 | if test -x ${srcdir}/$a ; then | |
413 | b="${srcdir}/$a" | |
414 | elif test -f ${srcdir}/$a ; then | |
415 | b="${SHELL} ${SHELLVERBOSE} ${srcdir}/$a" | |
416 | else | |
417 | b="${objdir}/$a" | |
418 | fi | |
419 | if test "`echo $a | cut -c1`" = "#" ; then # tests to skip | |
420 | echo "Skipping $a" | |
421 | continue | |
422 | fi | |
423 | echo "Running $a" | |
424 | test "X$VERBOSE" != "X" && echo "Running test $a ($b)." | |
425 | if test "$a" = "setgroups" ; then | |
426 | b="${objdir}/asu root $b" | |
427 | else | |
428 | if test "X$RUNAS" != "X" ; then | |
429 | b="${objdir}/asu $RUNAS $b" | |
430 | fi | |
431 | fi | |
432 | tmpdir="`hostname`-$a-`date +%Y-%m-%d-%H-%M-%S`-$$" | |
433 | cd $WORKDIR && mkdir $tmpdir && (cd $tmpdir && $b ${PARALLELL}) | |
434 | saved_res=$? | |
435 | test "X$VERBOSE" != "X" && echo "Saved res = $saved_res" | |
436 | if test "X${PARALLELL}" = "X" ;then | |
437 | if test $saved_res != 0 ; then | |
438 | echo "Test $a FAILED" | |
439 | FAILEDTESTS="${FAILEDTESTS} $a"; | |
440 | exitval=$savedres | |
441 | else | |
442 | test "X$VERBOSE" != "X" && echo "Test $a succeeded, tmpdir is removed" | |
443 | ${objdir}/rm-rf $tmpdir | |
444 | fi | |
445 | test "X$VERBOSE" != "X" && echo "Done test $a." | |
446 | fi | |
447 | test "X${PRINT_CACHESIZE}" = Xyes && $objdir/../appl/fs/fs calculate | |
448 | done | |
449 | ||
450 | wait | |
451 | date | |
452 | ||
453 | if test "$FAILEDTESTS"; then | |
454 | echo "-----------------------------------------------------------" | |
455 | echo "Failed test(s) were: $FAILEDTESTS" | |
456 | exitval=1 | |
457 | else | |
458 | echo "All test(s) were succesful!" | |
459 | exitval=0 | |
460 | fi | |
461 | ||
462 | exit $exitval |