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