3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Author: Kern Sibbald, 2006
11 # Run a simple backup of the Bacula build directory
14 TestName="hardlink-test"
18 if test ! -d weird-files ; then
20 echo "Weird files not configured. Test not run."
26 scripts/copy-test-confs
27 change_jobname NightlySave $JobName
29 # Note, we save the weird-files directory twice on purpose
30 # because this causes problems with hard linked files
31 # that are only saved once. In 1.33, Bacula now deals
32 # with this situation.
34 echo "${cwd}/weird-files" >${cwd}/tmp/file-list
35 echo "${cwd}/weird-files" >>${cwd}/tmp/file-list
39 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
42 @$out ${cwd}/tmp/log1.out
45 setdebug level=500 client=localhost-fd trace=1
53 @$out ${cwd}/tmp/log2.out
54 setdebug level=200 client=localhost-fd trace=0
55 restore where=${cwd}/tmp/bacula-restores storage=File
57 cd ${cwd}/weird-files/subdir
63 @$out ${cwd}/tmp/log3.out
64 @# They should all have a MD5
67 FROM File JOIN Filename USING (FilenameId)
68 WHERE Name LIKE 'hard%' OR Name = 'normalfile';
70 @$out ${cwd}/tmp/log4.out
73 FROM File JOIN Filename USING (FilenameId)
74 WHERE Name = 'hardlink-to-normalfile'
75 OR Name = 'normalfile'
76 OR Name = 'another-hardlink-to-normalfile'
83 check_for_zombie_jobs storage=File
87 diff ${cwd}/weird-files/subdir/another-hardlink \
88 ${cwd}/tmp/bacula-restores/${cwd}/weird-files/subdir/another-hardlink 2>&1 >/dev/null
91 grep ' 0 ' $tmp/log3.out > /dev/null
93 print_debug "ERROR: All hardlinks should have checksums"
97 nb=`awk '/\| +[1-9]/ { print $0 } ' $tmp/log4.out | wc -l | sed -e 's/^ *//'`
98 if [ "$nb" != 1 ]; then
99 print_debug "ERROR: All selected hardlinks should have the same checksum"