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