3 # This script will run tests with the update script to ensure
6 SCRIPT=/home/mish/active/indymedia/mirror-scripts/update.pl
8 TESTDIR=/tmp/test_updatemirror
9 CHANGEDIR=$TESTDIR/changes
10 STATEDIR=$TESTDIR/state
12 LASTUPDATEFILE=$STATEDIR/lastupdate.txt
13 OUTPUTFILE=$TESTDIR/out.txt
14 CORRECTFILE=$TESTDIR/correct.txt
16 # set up - set up the directories and files required
19 # first remove anything left
22 # create the directory and copy the files we need to it
25 cp change*.txt $TESTDIR/
29 # teardown - remove all stuff so that next time is clean
32 # do we want to wait before tear down
33 if [ "$INTERACTIVE" == "i" ]; then
34 echo "Press any key to continue to next test"
42 # setlastupdate - set the last update date/time
43 # pass the date/time as YYYY MM DD hh mm ss
46 # set the format as for `date -s %Y/%m/%d %H:%M:%S`
47 # or use that if no argument is set
48 if [ "$#" -eq "0" ]; then
49 date +"%Y:%m:%dT%H:%M:%S" > $LASTUPDATEFILE
51 echo "$1:$2:$3T$4:$5:$6" > $LASTUPDATEFILE
56 # get the list of change files - one day only
57 testChangeFileListOneDay ()
60 setlastupdate 2006 06 22 16 13 11
62 --workingdir=$TESTDIR \
64 --now="2006:06:22T16:31:11.01" \
67 echo "/changes/changes20060622.txt" > $CORRECTFILE
68 diff $OUTPUTFILE $CORRECTFILE
69 if [ "$?" -ne "0" ]; then
70 echo "*** FAILED testChangeFileListOneDay ***"
72 echo "Passed testChangeFileListOneDay"
86 # do we want to do tests interactively
96 testChangeFileListOneDay