3 # Author: Kern Sibbald, 2006
6 # Run a simple backup of the Bacula build directory
9 TestName="hardlink-test"
13 if test ! -d weird-files ; then
15 echo "Weird files not configured. Test not run."
21 scripts/copy-test-confs
22 change_jobname NightlySave $JobName
24 # Note, we save the weird-files directory twice on purpose
25 # because this causes problems with hard linked files
26 # that are only saved once. In 1.33, Bacula now deals
27 # with this situation.
29 echo "${cwd}/weird-files" >${cwd}/tmp/file-list
30 echo "${cwd}/weird-files" >>${cwd}/tmp/file-list
34 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
37 @$out ${cwd}/tmp/log1.out
40 setdebug level=500 client=localhost-fd trace=1
48 @$out ${cwd}/tmp/log2.out
49 setdebug level=200 client=localhost-fd trace=0
50 restore where=${cwd}/tmp/bacula-restores storage=File
52 cd ${cwd}/weird-files/subdir
58 @$out ${cwd}/tmp/log3.out
59 @# They should all have a MD5
62 FROM File JOIN Filename USING (FilenameId)
63 WHERE Name LIKE 'hard%' OR Name = 'normalfile';
65 @$out ${cwd}/tmp/log4.out
68 FROM File JOIN Filename USING (FilenameId)
69 WHERE Name = 'hardlink-to-normalfile'
70 OR Name = 'normalfile'
71 OR Name = 'another-hardlink-to-normalfile'
78 check_for_zombie_jobs storage=File
82 diff ${cwd}/weird-files/subdir/another-hardlink \
83 ${cwd}/tmp/bacula-restores/${cwd}/weird-files/subdir/another-hardlink 2>&1 >/dev/null
86 grep ' 0 ' $tmp/log3.out > /dev/null
88 print_debug "ERROR: All hardlinks should have checksums"
92 nb=`awk '/\| +[1-9]/ { print $0 } ' $tmp/log4.out | wc -l | sed -e 's/^ *//'`
93 if [ "$nb" != 1 ]; then
94 print_debug "ERROR: All selected hardlinks should have the same checksum"