]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/weird-files2-test
Flush changes
[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 bin/bacula stop 2>&1 >/dev/null
18 cd bin
19 ./drop_bacula_tables >/dev/null 2>&1
20 ./make_bacula_tables >/dev/null 2>&1
21 ./grant_bacula_privileges 2>&1 >/dev/null
22 cd ..
23
24 echo " "
25 echo " "
26 echo " === Starting weird filenames2 test ==="
27 echo " === Starting weird filenames2 test ===" >>working/log
28 echo " "
29
30 bin/testls weird-files2 >${cwd}/tmp/original
31 bin/bacula start 2>&1 >/dev/null
32 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
33 @output /dev/null
34 messages
35 @output tmp/log1.out
36 label storage=File volume=TestVolume001
37 run job=NightlySave yes
38 wait
39 messages
40 @output
41 quit
42 END_OF_DATA
43 scripts/check_for_zombie_jobs storage=File 
44 #
45 # Now mess up the a hard link, and a soft link
46 #
47 cd weird-files2
48 rm -f hard-file2
49 ln hard-file3 hard-file2
50 rm -f soft-file2
51 ln -s soft-file3 soft-file2
52 cd ${cwd}
53 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
54 @output /dev/null
55 messages
56 @# 
57 @# now do a restore
58 @#
59 @output tmp/log2.out
60 restore where= storage=File
61 5
62 unmark *
63 mark *
64 done
65 yes
66 wait
67 messages
68 @output
69 quit
70 END_OF_DATA
71 scripts/check_for_zombie_jobs storage=File 
72 bin/bacula stop 2>&1 >/dev/null
73 bin/testls weird-files2 >${cwd}/tmp/restored
74 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
75 bstat=$?
76 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
77 rstat=$?
78 diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null
79 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
80    echo " "
81    echo " "
82    echo "  !!!!! Weird files2 test failed!!! !!!!! "
83    echo "  !!!!! Weird files2 test failed!!! !!!!! " >>test.out
84    echo " "
85 else
86    echo "  ===== Weird files2 test OK ===== "
87    echo "  ===== Weird files2 test OK ===== " >>test.out
88    cd ${cwd}
89    scripts/cleanup
90    rm -rf weird-files2
91 fi