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