#!/bin/sh # # Script which does some basic tests to ensure we haven't regressed. # Probably a good idea to run this before doing any checkins. # In the future this can become more fancy, but it's OK for now. SRCDIR="`dirname $0`" export PATH=/sbin:/usr/sbin:$SRCDIR:$PATH . $SRCDIR/common.sh ERROR= setup_opts $@ [ "`mount | grep $OSCMT`" ] || echo | sh llsetup.sh $@ || exit 1 # let's start slowly here... echo "touching $OSCMT" touch $OSCMT || fail "can't touch $OSCMT" 2 echo "copying /etc/hosts to $OSCMT/hosts" cp /etc/hosts $OSCMT || fail "can't cp /etc/hosts to $OSCMT/hosts" 3 echo "comparing /etc/hosts and $OSCMT/hosts" diff -u /etc/hosts $OSCMT/hosts || fail "$OSCMT/hosts different" 4 # ok, that hopefully worked, so let's do a little more FILES=`find /etc -type f` echo "copying files from /etc to $OSCMT/etc" tar cf - $FILES | tar xvf - -C $OSCMT || fail "copying /etc" 10 echo "comparing newly copied files" for f in $FILES; do diff -q $f $OSCMT/$f || ERROR=11 done [ "$ERROR" ] && fail "old and new files are different" 11 sh llcleanup.sh $@ echo | sh llrsetup.sh $@ || exit 20 echo "comparing previously copied files" diff -u /etc/hosts $OSCMT/hosts || fail "$OSCMT/hosts is now different" 21 for f in $FILES; do diff -q $f $OSCMT/$f || ERROR=22 done [ "$ERROR" ] && fail "old and new files are different on second diff" 23 sh llcleanup.sh $@ echo | sh llrsetup.sh $@ || exit 24 echo "truncating $OSCMT/hosts" > $OSCMT/hosts || fail "can't truncate $OSTMT/hosts" 25 echo "removing $OSCMT/hosts" rm $OSCMT/hosts || fail "can't remove $OSCMT/hosts" 26 echo "removing $OSCMT/etc" rm -r $OSCMT/etc || fail "can't remove $OSCMT/etc" 27 sh llcleanup.sh $@