]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/weird-files-test
Updates
[bacula/bacula] / regress / tests / weird-files-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory
4 #   then restore it.
5 #
6 debug=0
7 if test "$debug" -eq 1 ; then
8   out="tee"
9 else
10   out="output"
11 fi
12 if test ! -d weird-files ; then
13    echo " "
14    echo "Weird files not configured. Test not run."
15    exit 0
16 fi
17 cwd=`pwd`
18 scripts/copy-test-confs
19 scripts/cleanup
20 #
21 # Note, we save the weird-files directory twice on purpose
22 #  because this causes problems with hard linked files 
23 #  that are only saved once.  In 1.33, Bacula now deals
24 #  with this situation.
25 #
26 echo "${cwd}/weird-files" >/tmp/file-list
27 echo "${cwd}/weird-files" >>/tmp/file-list
28
29 echo " "
30 echo " "
31 echo " === Starting weird filenames test at `date +%R:%S` ==="
32 echo " === Starting weird filenames test at `date +%R:%S` ===" >>working/log
33 echo " "
34
35 cat <<END_OF_DATA >tmp/bconcmds
36 @$out /dev/null
37 messages
38 @$out tmp/log1.out
39 label storage=File
40 TestVolume001
41 run job=NightlySave
42 yes
43 wait
44 messages
45 @# 
46 @# now do a restore
47 @#
48 @$out tmp/log2.out
49 restore where=${cwd}/tmp/bacula-restores select storage=File
50 unmark *
51 mark *
52 done
53 yes
54 wait
55 messages
56 @$out
57 quit
58 END_OF_DATA
59 if test "$debug" -eq 1 ; then
60   bin/bacula start
61   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
62 else
63   bin/bacula start 2>&1 >/dev/null
64   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
65 fi
66 scripts/check_for_zombie_jobs storage=File 
67 bin/bacula stop 2>&1 >/dev/null
68 ${cwd}/bin/testls weird-files | sort >${cwd}/tmp/original
69 cd tmp/bacula-restores${cwd}
70 ${cwd}/bin/testls weird-files | sort >${cwd}/tmp/restored
71 cd ${cwd}
72 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
73 bstat=$?
74 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
75 rstat=$?
76 diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null
77 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
78    echo " "
79    echo " "
80    echo "  !!!!! Weird files test failed!!! !!!!! "
81    echo "  !!!!! Weird files test failed!!! !!!!! " >>test.out
82    if [ $bstat != 0 -o $rstat != 0 ] ; then
83       echo "  !!!!! Bad Job termination status     !!!!! "
84       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
85    else
86       echo "  !!!!! Restored files differ          !!!!! "
87       echo "  !!!!! Restored files differ          !!!!! " >>test.out
88    fi
89    echo " "
90 else
91    echo "  ===== Weird files test OK ===== "
92    echo "  ===== Weird files test OK ===== " >>test.out
93    cd ${cwd}
94    scripts/cleanup
95 fi