]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/truncate-bug-tape
9e581388d7fb860737bea5abc83e0c4a8ea6942b
[bacula/bacula] / regress / tests / truncate-bug-tape
1 #!/bin/sh
2 #
3 # Test for a tape truncation bug.
4 #
5 cwd=`pwd`
6
7 scripts/copy-tape-confs
8 scripts/cleanup-tape
9 echo "${cwd}/build" >/tmp/file-list
10
11 echo " "
12 echo " "
13 echo " === Starting truncate-bug-tape test at `date +%R:%S` ==="
14 echo " === Starting truncate-bug-tape test at `date +%R:%S` ===" >>working/log
15 echo " "
16
17 bin/bacula start 2>&1 >/dev/null
18 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
19 @output /dev/null
20 messages
21 @output tmp/log1.out
22 label storage=DDS-4 volume=TestVolume001 slot=0
23 @# do a bunch of saves so we have 12 files on the tape
24 run job=NightlySave yes
25 run level=Full job=NightlySave yes
26 run level=Full job=NightlySave yes
27 run level=Full job=NightlySave yes
28 run level=Full job=NightlySave yes
29 run level=Full job=NightlySave yes
30 run level=Full job=NightlySave yes
31 run level=Full job=NightlySave yes
32 run level=Full job=NightlySave yes
33 run level=Full job=NightlySave yes
34 run level=Full job=NightlySave yes
35 run level=Full job=NightlySave yes
36 wait
37 messages
38 quit
39 END_OF_DATA
40 scripts/check_for_zombie_jobs storage=DDS-4
41 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
42 @output /dev/null
43 messages
44 @output tmp/log1.out
45 @# 
46 @# now do a restore
47 @#
48 restore where=${cwd}/tmp/bacula-restores storage=DDS-4
49 3
50 @# select JobId=4 (i.e. file five on the tape)
51 4
52 cd ${cwd}/build
53 @# mark a single file
54 mark configure
55 done
56 yes
57 wait
58 messages
59 @output
60 quit
61 END_OF_DATA
62 scripts/check_for_zombie_jobs storage=DDS-4
63 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
64 @output /dev/null
65 messages
66 @output tmp/log2.out
67 run level=Full job=NightlySave yes
68 wait
69 messages
70 quit
71 END_OF_DATA
72 bin/bacula stop 2>&1 >/dev/null
73 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
74 bstat=$?
75 grep "^  Termination: *Backup OK" tmp/log2.out 2>&1 >/dev/null
76 rstat=$?
77 if [ $bstat != 0 -o $rstat != 0 ] ; then
78    echo " "
79    echo " "
80    echo "  !!!!! truncate-bug-tape test Bacula source failed!!! !!!!! "
81    echo "  !!!!! truncate-bug-tape test failed!!! !!!!! " >>test.out
82    echo " "
83 else
84    echo "  ===== truncate-bug-tape test Bacula source OK ===== "
85    echo "  ===== truncate-bug-tape test OK ===== " >>test.out
86    scripts/cleanup
87 fi