3 # Run a simple backup of the Bacula build directory
6 TestName="hardlink-test"
10 if test ! -d weird-files ; then
12 echo "Weird files not configured. Test not run."
18 scripts/copy-test-confs
19 change_jobname NightlySave $JobName
21 # Note, we save the weird-files directory twice on purpose
22 # because this causes problems with hard linked files
23 # that are only saved once. In 1.33, Bacula now deals
24 # with this situation.
26 echo "${cwd}/weird-files" >${cwd}/tmp/file-list
27 echo "${cwd}/weird-files" >>${cwd}/tmp/file-list
31 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
34 @$out ${cwd}/tmp/log1.out
37 setdebug level=500 client=localhost-fd trace=1
45 @$out ${cwd}/tmp/log2.out
46 setdebug level=200 client=localhost-fd trace=0
47 restore where=${cwd}/tmp/bacula-restores storage=File
49 cd ${cwd}/weird-files/subdir
55 @$out ${cwd}/tmp/log3.out
56 @# They should all have a MD5
59 FROM File JOIN Filename USING (FilenameId)
60 WHERE Name LIKE 'hard%' OR Name = 'normalfile';
62 @$out ${cwd}/tmp/log4.out
65 FROM File JOIN Filename USING (FilenameId)
66 WHERE Name = 'hardlink-to-normalfile'
67 OR Name = 'normalfile'
68 OR Name = 'another-hardlink-to-normalfile'
75 check_for_zombie_jobs storage=File
79 diff ${cwd}/weird-files/subdir/another-hardlink \
80 ${cwd}/tmp/bacula-restores/${cwd}/weird-files/subdir/another-hardlink 2>&1 >/dev/null
83 grep ' 0 ' $tmp/log3.out > /dev/null
85 print_debug "ERROR: All hardlinks should have checksums"
89 nb=`awk '/\| +[1-9]/ { print $0 } ' $tmp/log4.out | wc -l | sed -e 's/^ *//'`
90 if [ "$nb" != 1 ]; then
91 print_debug "ERROR: All selected hardlinks should have the same checksum"