]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bscan-test
regress: fix delete-test
[bacula/bacula] / regress / tests / bscan-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory but 
4 #   split the archive into two volumes then bscan it
5 #   into the catalog after the backup. It also to a limited
6 #   extent tests the purge volume and delete volume commands.
7 #
8
9 TestName="bscan-test"
10 JobName=bscan
11 . scripts/functions
12
13 scripts/cleanup
14 scripts/copy-test-confs
15 echo "${cwd}/build" >tmp/file-list
16
17 change_jobname NightlySave $JobName
18 start_test
19
20 cat <<END_OF_DATA >tmp/bconcmds
21 @$out /dev/null
22 messages
23 @$out tmp/log1.out
24 label storage=File1
25 TestVolume001
26 label storage=File1
27 TestVolume002
28 update Volume=TestVolume001 MaxVolBytes=3000000
29 run job=$JobName storage=File1
30 yes
31 wait
32 list volumes
33 list files jobid=1
34 sql
35 select * from JobMedia;
36
37
38 messages
39 @$out /dev/null
40 @#
41 @# now purge the Volume
42 @#
43 purge volume=TestVolume001
44 purge volume=TestVolume002
45 delete volume=TestVolume001
46 yes
47 delete volume=TestVolume002
48 yes
49 messages
50 quit
51 END_OF_DATA
52
53 run_bacula
54 check_for_zombie_jobs storage=File1
55 stop_bacula
56
57 echo "volume=TestVolume001" >tmp/bscan.bsr
58 echo "volume=TestVolume002" >>tmp/bscan.bsr
59
60 bscan_libdbi
61
62 # If the database has a password pass it to bscan
63 if test "x${db_password}" = "x"; then
64   PASSWD=
65 else
66   PASSWD="-P ${db_password}"
67 fi
68
69 if test "$debug" -eq 1 ; then
70   $bin/bscan -w working $BSCANLIBDBI -u ${db_user} -n ${db_name} $PASSWD -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf ${cwd}/tmp                   
71 else
72   $bin/bscan -w working $BSCANLIBDBI -u ${db_user} -n ${db_name} $PASSWD -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf ${cwd}/tmp >tmp/log3.out 2>&1
73 fi
74
75 cat <<END_OF_DATA >tmp/bconcmds
76 @$out /dev/null
77 messages
78 @$out tmp/log2.out
79 @# 
80 @# now do a restore
81 @#
82 @#setdebug level=400 storage=File1
83 restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bacula-restores select all storage=File1 done
84 yes
85 wait
86 messages
87 quit
88 END_OF_DATA
89
90 # now run restore
91 run_bacula
92 check_for_zombie_jobs storage=File1
93 stop_bacula
94
95 check_two_logs
96 check_restore_diff
97 end_test