-
-[ "$ERROR" ] && fail "old and new files are different on second diff" $ERROR
-
-sh llcleanup.sh $@
-echo | sh llrsetup.sh $@ || exit 31
-
-#echo "renaming $HOSTS.ren to $HOSTS"
-#mv $HOSTS.ren $HOSTS || fail "can't rename $HOSTS.ren to $HOSTS" 32
-echo "truncating $HOSTS"
-> $HOSTS || fail "can't truncate $HOSTS" 34
-echo "removing $HOSTS"
-rm $HOSTS || fail "can't remove $HOSTS again" 36
-echo "removing $DST"
-rm -r $DST || fail "can't remove $DST" 37
-
-sh llcleanup.sh $@
+[ "$rc" = 0 ] || error_exit "old and new files are different: rc=$rc" )
+
+stopall || exit 21
+setupall || exit 22
+
+log "removing $DST"
+rm -r $V $DST || error "can't remove $DST" 37
+
+if [ $COUNT -gt 10 -o $COUNT -eq 0 ]; then
+ log "renaming $HOSTS.ren to $HOSTS"
+ mv $HOSTS.ren $HOSTS || error "can't rename $HOSTS.ren to $HOSTS" 32
+ log "truncating $HOSTS"
+ > $HOSTS || error "can't truncate $HOSTS" 34
+ log "removing $HOSTS"
+ rm $HOSTS || error "can't remove $HOSTS again" 36
+ log "verifying $HOSTS.2 is $TRUNCSIZE bytes"
+ checkstat -s $TRUNCSIZE $HOSTS.2 || \
+ error "$HOSTS.2 isn't $TRUNCSIZE bytes" 37
+ rm $HOSTS.2 || error "can't remove $HOSTS.2" 38
+fi
+
+# mkdirmany test (bug 589)
+test_mkdir -p $DST
+log "running $MKDIRMANY $DST/d 100"
+$MKDIRMANY $DST/d 100 || error "$MKDIRMANY failed"
+log "running $RMDIRMANY $DST/d 100"
+$RMDIRMANY $DST/d 100 || error "$RMDIRMANY cleanup failed"
+
+log "done"
+
+wait_delete_completed
+NOWUSED=$(($(df -P $DIR | awk '{ print $3 }' | tail -n 1)))
+if [ $(expr $NOWUSED - $USED) -gt 1024 ]; then
+ error "Space not all freed: now ${NOWUSED}kB, was ${USED}kB."
+else
+ log "Space was freed: now ${NOWUSED}kB, was ${USED}kB."
+fi
+}
+run_test 1 "All Runtests"
+
+complete $SECONDS
+rm -f $FILES
+check_and_cleanup_lustre
+exit_status