]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-jobs-test
Update tests
[bacula/bacula] / regress / tests / two-jobs-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory using the compressed option
4 #   then backup a second time and finally restore it
5 #
6 cwd=`pwd`
7 scripts/copy-test-confs
8 scripts/cleanup
9 echo "${cwd}/build" >/tmp/file-list
10
11 echo " "
12 echo " "
13 echo " === Starting two-jobs-test at `date +%R:%S` ==="
14 echo " === Starting two-jobs-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 setdebug level=15  storage=File
20 @output /dev/null
21 messages
22 @output /dev/null
23 estimate job=CompressedTest listing
24 estimate job=CompressedTest listing
25 estimate job=CompressedTest listing
26 messages
27 @output tmp/log1.out
28 label storage=File volume=TestVolume001
29 run job=CompressedTest yes
30 wait
31 messages
32 quit
33 END_OF_DATA
34 scripts/check_for_zombie_jobs storage=File 
35 echo "Backup 1 done"
36 touch ${cwd}/build/src/dird/*.c
37 #
38 # run a second job
39 #
40 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
41 @output /dev/null
42 messages
43 @output tmp/log1.out
44 run job=CompressedTest
45 yes
46 wait
47 messages
48 @# 
49 @# now do several restores to ensure we cleanup between jobs
50 @#
51 @output /dev/null
52 restore where=${cwd}/tmp/bacula-restores select all storage=File done
53 yes
54 wait
55 restore where=${cwd}/tmp/bacula-restores select all storage=File done
56 yes
57 wait
58 @output tmp/log2.out
59 restore where=${cwd}/tmp/bacula-restores select storage=File
60 unmark *
61 mark *
62 done
63 yes
64 wait
65 messages
66 @output
67 quit
68 END_OF_DATA
69 scripts/check_for_zombie_jobs storage=File
70 bin/bacula stop 2>&1 >/dev/null
71 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
72 bstat=$?
73 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
74 rstat=$?
75 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
76 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
77    echo " "
78    echo " "
79    echo "  !!!!! two-jobs-test Bacula source failed!!! !!!!! "
80    echo "  !!!!! two-jobs-test failed!!! !!!!! " >>test.out
81    if [ $bstat != 0 -o $rstat != 0 ] ; then
82       echo "  !!!!! Bad Job termination status     !!!!! "
83       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
84    else
85       echo "  !!!!! Restored files differ          !!!!! "
86       echo "  !!!!! Restored files differ          !!!!! " >>test.out
87    fi
88    echo " "
89 else
90    echo "  ===== two-jobs-test Bacula source OK ===== "
91    echo "  ===== two-jobs-test OK ===== " >>test.out
92    scripts/cleanup
93 fi