]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/truncate-bug-tape
7b7960446c0d0d4ffb44b9e373844ffa54a29d12
[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/bacula start
19 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
20 @tee /dev/null
21 messages
22 @tee tmp/log1.out
23 label storage=DDS-4 volume=TestVolume001 slot=0
24 @# do a bunch of saves so we have 12 files on the tape
25 run 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 run level=Full job=NightlySave yes
37 wait
38 messages
39 quit
40 END_OF_DATA
41 scripts/check_for_zombie_jobs storage=DDS-4
42 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
43 @tee /dev/null
44 messages
45 @tee tmp/log1.out
46 @# 
47 @# now do a restore
48 @#
49 restore where=${cwd}/tmp/bacula-restores storage=DDS-4
50 3
51 @# select JobId=4 (i.e. file five on the tape)
52 4
53 cd ${cwd}/build
54 @# mark a single file
55 mark configure
56 done
57 yes
58 wait
59 messages
60 @tee
61 quit
62 END_OF_DATA
63 scripts/check_for_zombie_jobs storage=DDS-4
64 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
65 @tee /dev/null
66 messages
67 @tee tmp/log2.out
68 run level=Full job=NightlySave yes
69 wait
70 messages
71 quit
72 END_OF_DATA
73 bin/bacula stop 2>&1 >/dev/null
74 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
75 bstat=$?
76 grep "^  Termination: *Backup OK" tmp/log2.out 2>&1 >/dev/null
77 rstat=$?
78 if [ $bstat != 0 -o $rstat != 0 ] ; then
79    echo " "
80    echo " "
81    echo "  !!!!! truncate-bug-tape test Bacula source failed!!! !!!!! "
82    echo "  !!!!! truncate-bug-tape test failed!!! !!!!! " >>test.out
83    echo " "
84 else
85    echo "  ===== truncate-bug-tape test Bacula source OK ===== "
86    echo "  ===== truncate-bug-tape test OK ===== " >>test.out
87    scripts/cleanup
88 fi