3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
7 # Attempt to backup and restore a file with the bpipe plugin
14 scripts/copy-plugin-confs
18 echo "${cwd}/README" >${cwd}/tmp/file-list
22 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
25 @$out ${cwd}/tmp/log1.out
26 label storage=File1 volume=TestVolume001
27 estimate job=$JobName level=Full
28 @#setdebug level=50 traclient=$CLIENT
29 run job=$JobName storage=File1 yes
31 @#setdebug level=50 client=$CLIENT
32 run job=$JobName storage=File1 yes
42 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
47 llist pluginrestoreconf jobid=1
48 llist pluginrestoreconf jobid=2
50 llist pluginrestoreconf jobid=1 id=1
51 llist pluginrestoreconf jobid=1 id=2
56 nb=`grep Makefile $tmp/files | wc -l`
57 if [ $nb -ne 2 ]; then
58 print_debug "ERROR: Should have two times Makefile in job files $tmp/files"
62 nb=`grep $file $tmp/files | wc -l`
63 if [ $nb -ne 2 ]; then
64 print_debug "ERROR: Should have two times $file in job files $tmp/files"
68 nb=`grep README $tmp/files | wc -l`
69 if [ $nb -ne 1 ]; then
70 print_debug "ERROR: Should have one time README in job files $tmp/files"
74 nb=`grep $file $tmp/list | wc -l`
75 if [ $nb -ne 1 ]; then
76 print_debug "ERROR: Should find the RestoreObject for $file in $tmp/list"
80 nb=`grep Makefile $tmp/list | wc -l`
81 if [ $nb -ne 1 ]; then
82 print_debug "ERROR: Should find the RestoreObject for Makefile in $tmp/list"
86 nb=`grep restore_command $tmp/conf | wc -l`
87 if [ $nb -ne 2 ]; then
88 print_debug "ERROR: Should find the RestoreObject for Makefile and $file in $tmp/conf"
93 restore_command="cat >$tmp/Makefile.bak"
96 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
101 @$out ${cwd}/tmp/log3.out
102 setdebug level=50 client=$CLIENT trace=1
103 @putfile obj1 $tmp/obj
104 restore pluginrestoreconf="2:obj1" where=${cwd}/tmp select all storage=File1 done
107 setdebug level=0 client=$CLIENT trace=0
115 # Remove plugin so we can try the restore without the plugin
117 mv -f ${cwd}/bin/plugins/bpipe-fd.so ${cwd}/bin/plugins/bpipe-fd.sox
119 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
120 @$out ${cwd}/tmp/log2.out
122 @# now do a restore without the plugin
124 @$out ${cwd}/tmp/log2.out
125 @#setdebug level=50 client=$CLIENT
126 restore where=${cwd}/tmp select all storage=File1 done
137 check_for_zombie_jobs storage=File1
142 mv -f ${cwd}/bin/plugins/bpipe-fd.sox ${cwd}/bin/plugins/bpipe-fd.so
146 # ****FIXME**** test that all three files are restored correctly
148 diff ${cwd}/Makefile ${cwd}/tmp/Makefile.bak
151 diff ${cwd}/${file} ${cwd}/tmp/${file}
152 dstat=$(($dstat + $?))
154 diff ${cwd}/tmp/@bpipe@/${file} ${cwd}/${file}
155 dstat=$(($dstat + $?))
157 diff ${cwd}/tmp/@bpipe@/Makefile ${cwd}/Makefile
158 dstat=$(($dstat + $?))