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