]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/test-plugin-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / test-plugin-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run test-plugin-fd.  Note, this plugin is for testing
9 #   new features and probably should not be run in normal
10 #   testing
11 #
12 TestName="test-plugin-test"
13 JobName=TestPluginTest
14 . scripts/functions
15
16 scripts/cleanup
17 scripts/copy-plugin-confs
18 file=encrypt-bug.jpg
19 rm -rf ${cwd}/tmp/*
20 echo "${cwd}/build/src" >${cwd}/tmp/file-list
21
22 # Build and install the test plugin
23 cd ${cwd}/build/src/plugins/fd
24 make
25 make install-test-plugin
26 cd ${cwd}
27
28 start_test
29
30 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
31 @output /dev/null
32 messages
33 @$out ${cwd}/tmp/log1.out
34 label storage=File1 volume=TestVolume001
35 setdebug level=100 client=$CLIENT
36 estimate job=$JobName level=Full
37 @#setdebug level=150 client=$CLIENT
38 @#setdebug level=150 storage=File1
39 run job=$JobName storage=File1 yes
40 wait
41 status client=$CLIENT
42 messages
43 quit
44 END_OF_DATA
45
46
47 run_bacula
48
49 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
50 messages
51 @# 
52 @# now do a restore
53 @#
54 @$out ${cwd}/tmp/log2.out
55 setdebug level=50 client=$CLIENT
56 restore where=${cwd}/tmp  select all storage=File1 done
57 yes
58 wait
59 setdebug level=0 client=$CLIENT
60 messages
61 quit
62 END_OF_DATA
63
64 run_bconsole
65
66 stop_bacula
67
68 exit 0
69
70 # ****FIXME**** test if the restore of the two files is OK
71
72 #
73 # Remove plugin so we can try the restore without the plugin
74 #
75 mv -f ${cwd}/bin/plugins/test-plugin-fd.so ${cwd}/bin/plugins/test-plugin-fd.sox
76
77 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
78 @$out ${cwd}/tmp/log2.out
79 @# remove plugin
80 @exec "sh -c 'rm -f ${cwd}/bin/plugins/test-plugin-fd.so'"
81 @# 
82 @# now do a restore without the plugin
83 @#
84 @$out ${cwd}/tmp/log2.out
85 @#setdebug level=50 client=$CLIENT
86 restore where=${cwd}/tmp  select all storage=File1 done
87 yes
88 wait
89 messages
90 quit
91 END_OF_DATA
92
93 run_bacula -d50
94 run_bconsole
95
96 check_for_zombie_jobs storage=File1
97 stop_bacula
98 #
99 # Restore plugin
100 #
101 mv -f ${cwd}/bin/plugins/test-plugin-fd.sox ${cwd}/bin/plugins/test-plugin-fd.so
102
103 check_two_logs
104 #
105 # ****FIXME**** test that all three files are restored correctly
106 #
107 diff ${cwd}/${file} ${cwd}/tmp/${file}
108 dstat=$?
109 end_test