]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/truncate-bug-tape
d5df7a720b06f17051ece6e9d2ae68bad555bfdf
[bacula/bacula] / regress / tests / truncate-bug-tape
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 for a tape truncation bug.
9 #
10 TestName="truncate-bug-tape" 
11 JobName=truncatebug
12 . scripts/functions
13
14 require_tape_drive
15
16 scripts/copy-tape-confs
17 scripts/cleanup-tape
18
19 echo "${cwd}/build" >${cwd}/tmp/file-list
20
21 change_jobname NightlySave $JobName
22 start_test
23
24 cat <<END_OF_DATA >tmp/bconcmds
25 @$out /dev/null
26 messages
27 @$out   tmp/log1.out
28 label storage=tape volume=TestVolume001 slot=0 pool=Default
29 @# do a bunch of saves so we have 12 files on the tape
30 @#setdebug level=100 dir
31 setdebug level=100 storage=tape
32 run job=$JobName yes
33 run level=Full job=$JobName yes
34 run level=Full job=$JobName yes
35 run level=Full job=$JobName yes
36 run level=Full job=$JobName yes
37 run level=Full job=$JobName yes
38 run level=Full job=$JobName yes
39 run level=Full job=$JobName yes
40 run level=Full job=$JobName yes
41 run level=Full job=$JobName yes
42 run level=Full job=$JobName yes
43 run level=Full job=$JobName yes
44 wait
45 messages
46 quit
47 END_OF_DATA
48
49 run_bacula
50 scripts/check_for_zombie_jobs storage=tape
51
52 cat <<END_OF_DATA >tmp/bconcmds
53 @$out /dev/null
54 messages
55 @$out tmp/log2.out
56 @# 
57 @# now do a restore
58 @#
59 restore where=${cwd}/tmp/bacula-restores storage=tape
60 3
61 @# select JobId=4 (i.e. file five on the tape)
62 4
63 cd ${cwd}/build
64 @# mark a single file
65 mark configure
66 done
67 yes
68 wait
69 messages
70 quit
71 END_OF_DATA
72
73 run_bconsole
74 scripts/check_for_zombie_jobs storage=tape
75
76 # Now write to tape one more time
77 cat <<END_OF_DATA >tmp/bconcmds
78 @$out /dev/null
79 messages
80 @$out tmp/log3.out
81 run level=Full job=$JobName yes
82 wait
83 messages
84 quit
85 END_OF_DATA
86
87 run_bconsole
88 check_for_zombie_jobs storage=tape
89 stop_bacula
90
91 check_two_logs
92 grep "^  Termination: *Backup OK" tmp/log3.out 2>&1 >/dev/null
93 dstat=$?
94 end_test