3 # Attempt to backup and restore a file with the bpipe plugin
10 scripts/copy-plugin-confs
11 make -C $src/src/plugins/fd install-test-plugin
15 echo "${cwd}/README" >${cwd}/tmp/file-list
19 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
22 @$out ${cwd}/tmp/log1.out
23 label storage=File1 volume=TestVolume001
24 setdebug level=150 client=$CLIENT
25 estimate job=$JobName level=Full
26 setdebug level=50 client=$CLIENT
27 run job=$JobName storage=File1 yes
31 setdebug level=50 trace=1 client=$CLIENT
32 run job=TestPluginTest storage=File1 yes
36 setdebug level=50 trace=0 client=$CLIENT
43 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
48 @$out ${cwd}/tmp/log2.out
49 setdebug level=50 client=$CLIENT
50 restore fileset=pluginSet where=${cwd}/tmp select all storage=File1 done
53 setdebug level=0 client=$CLIENT
62 # ****FIXME**** test if the restore of the two files is OK
65 # Remove plugin so we can try the restore without the plugin
67 mv -f ${cwd}/bin/plugins/bpipe-fd.so ${cwd}/bin/plugins/bpipe-fd.sox
69 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
70 @$out ${cwd}/tmp/log2.out
72 @exec "sh -c 'rm -f ${cwd}/bin/plugins/bpipe-fd.so'"
74 @# now do a restore without the plugin
76 @$out ${cwd}/tmp/log2.out
77 @#setdebug level=50 client=$CLIENT
78 restore fileset=pluginSet where=${cwd}/tmp select all storage=File1 done
88 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
93 @$out ${cwd}/tmp/log3.out
94 setdebug level=50 client=$CLIENT trace=1
95 restore fileset=TestPluginSet where=${cwd}/tmp select all storage=File1 done
98 setdebug level=0 client=$CLIENT trace=0
105 check_for_zombie_jobs storage=File1
110 mv -f ${cwd}/bin/plugins/bpipe-fd.sox ${cwd}/bin/plugins/bpipe-fd.so
114 # ****FIXME**** test that all three files are restored correctly
116 diff ${cwd}/${file} ${cwd}/tmp/${file}
119 # the test-plugin should create a RestoreObject, just check
120 # compare restore object before/after
123 if (/Creating RestoreObject/) {
124 @elt = split(/\s/, $_, 7);
125 $ro{$elt[5]}{clen} = $elt[4];
126 $ro{$elt[5]}{cdata} = $elt[6];
127 } elsif (/Get RestoreObject/) {
128 @elt = split(/\s/, $_, 9);
129 $ro{$elt[6]}{glen} = $elt[4];
130 $ro{$elt[6]}{gdata} = $elt[8];
134 delete $ro{"oname=RestoreOptions"};
135 if (scalar(keys %ro) == 0) {
137 print "ERROR: No restore object found\n";
139 foreach my $k (keys %ro) {
140 if ($ro{$k}{clen} ne $ro{$k}{glen}) {
141 print "ERROR: $k $ro{$k}{clen} != $ro{$k}{glen}\n";
144 print "OK: $k $ro{$k}{clen} == $ro{$k}{glen}\n";
146 if ($ro{$k}{cdata} ne $ro{$k}{gdata}) {
147 print "ERROR: $k <$ro{$k}{cdata}> != <$ro{$k}{gdata}>\n";
150 print "OK: $k $ro{$k}{gdata} == $ro{$k}{gdata}\n";