]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/weird-files2-test
Backport from Bacula Enterprise
[bacula/bacula] / regress / tests / weird-files2-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the Bacula build directory
9 #   then restore it.
10 #
11 TestName="weird-files2-test"
12 JobName=weird-files2
13 . scripts/functions
14
15 if test ! -d weird-files ; then
16    echo " "
17    echo "weird files not configured. Test not run."
18    exit 0
19 fi
20 cwd=`pwd`
21 scripts/cleanup
22 scripts/copy-test-confs
23 rm -rf weird-files2
24 cp -Rp weird-files weird-files2
25 echo "${cwd}/weird-files2" >${cwd}/tmp/file-list
26 cd weird-files2
27 #perl socket.pl     # we no longer restore sockets
28 cd ..
29
30 change_jobname NightlySave $JobName
31 start_test
32
33 #bin/testls weird-files2 | grep -v sock-file >${cwd}/tmp/original
34 bin/testls weird-files2 >${cwd}/tmp/original
35
36 cat <<END_OF_DATA >tmp/bconcmds
37 @output /dev/null
38 messages
39 @$out tmp/log1.out
40 label storage=File volume=TestVolume001
41 run job=$JobName yes
42 wait
43 messages
44 @output
45 quit
46 END_OF_DATA
47
48 run_bacula
49 check_for_zombie_jobs storage=File 
50 #
51 # Now mess up the a hard link, and a soft link
52 #
53 cd weird-files2
54 rm -f hard-file2
55 ln hard-file3 hard-file2
56 rm -f soft-file2
57 ln -s soft-file3 soft-file2
58 cd ${cwd}
59 cat <<END_OF_DATA >tmp/bconcmds
60 @output /dev/null
61 messages
62 @# 
63 @# now do a restore
64 @#
65 @$out tmp/log2.out
66 restore where= storage=File
67 5
68 unmark *
69 mark *
70 done
71 yes
72 wait
73 messages
74 quit
75 END_OF_DATA
76
77 run_bconsole
78 check_for_zombie_jobs storage=File 
79 stop_bacula
80
81 bin/testls weird-files2 >${cwd}/tmp/restored
82
83 check_two_logs
84 diff -u ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null
85 #diff -u ${cwd}/tmp/original ${cwd}/tmp/restored
86 dstat=$?
87 if test $dstat -ne 0; then
88    diff -u ${cwd}/tmp/original ${cwd}/tmp/restored
89 fi
90
91 end_test