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