]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/comment-test
regress: Tweak vtape-test-changer for more data
[bacula/bacula] / regress / tests / comment-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory then create some           
4 #   new files, do an Incremental and restore those two files.
5 #
6 TestName="incremental-test"
7 JobName=Incremental 
8 . scripts/functions
9
10 ${rscripts}/cleanup
11 ${rscripts}/copy-test-confs
12 echo "${tmpsrc}" >${tmp}/file-list
13 mkdir -p ${tmpsrc}
14 cp -p ${src}/src/dird/*.c ${tmpsrc}
15 cd ${tmp}
16 echo "${tmpsrc}/ficheriro1.txt" >restore-list
17 echo "${tmpsrc}/ficheriro2.txt" >>restore-list
18 cd ${cwd}
19
20 change_jobname CompressedTest $JobName
21 start_test
22
23 cat <<END_OF_DATA >${tmp}/bconcmds
24 @$out /dev/null
25 messages
26 @$out ${tmp}/log1.out
27 run comment="This is a comment for $JobName" job=$JobName yes
28 status client
29 @sleep 5
30 status dir
31 label storage=File volume=TestVolume001
32 mount storage=File
33 wait
34 messages
35 @$out $tmp/log3.out
36 sql
37 SELECT Comment FROM Job WHERE JobId=1;
38
39 quit
40 END_OF_DATA
41
42 run_bacula
43 check_for_zombie_jobs storage=File
44 #
45 # Now create two new files to be restored later
46 #
47 sleep 1
48 echo "ficheriro1.txt" >${tmpsrc}/ficheriro1.txt
49 cp -f ${tmpsrc}/dird.c ${tmpsrc}/ficheriro2.txt
50
51 cat <<END_OF_DATA >${tmp}/bconcmds
52 @$out /dev/null
53 messages
54 @$out ${tmp}/log1.out
55 @# Force Incremental on the second Volume
56 update volume=TestVolume001 VolStatus=Used
57 run comment="This is the incremental job" level=Differential job=$JobName yes
58 @sleep 5
59 status dir
60 label storage=File volume=TestVolume002
61 mount storage=File
62 wait
63 messages
64 @$out $tmp/log3.out
65 sql
66 SELECT Comment FROM Job WHERE JobId=2;
67
68 quit
69 END_OF_DATA
70
71 run_bconsole
72
73 cat <<END_OF_DATA >${tmp}/bconcmds
74 @$out /dev/null
75 messages
76 @$out ${tmp}/log2.out
77 @# 
78 @# now do a restore
79 @#
80 restore comment="Ticket #1220 requested by toto@bacula.org" where=${tmp}/bacula-restores storage=File file=<${tmp}/restore-list
81 yes
82 status dir
83 wait
84 messages
85 @$out $tmp/log3.out
86 sql
87 SELECT Comment FROM Job WHERE JobId=3;
88
89 quit
90 END_OF_DATA
91
92 run_bconsole
93 check_for_zombie_jobs storage=File
94 stop_bacula
95
96 check_two_logs
97 #
98 # Delete .c files because we will only restored the txt files
99 #
100 rm -f ${tmpsrc}/*.c
101 check_restore_tmp_build_diff
102
103 grep "This is a comment for $JobName" $tmp/log3.out >/dev/null
104 if [ $? != 0 ]; then
105     print_debug "ERR: Can't find comment"
106     estat=1
107 fi
108 grep "Ticket #1220 requested by toto@bacula.org" $tmp/log3.out >/dev/null
109 if [ $? != 0 ]; then
110     print_debug "ERR: Can't find comment"
111     estat=1
112 fi
113 grep "This is the incremental job" $tmp/log3.out >/dev/null
114 if [ $? != 0 ]; then
115     print_debug "ERR: Can't find comment"
116     estat=1
117 fi
118 end_test