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