]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-jobs-test
Use tmp instead of /tmp
[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 bin/bacula stop 2>&1 >/dev/null
11 bin/drop_sqlite_tables
12 bin/make_sqlite_tables
13
14 echo " "
15 echo " "
16 echo " === Starting two-jobs-test  ==="
17 echo " === Starting two-jobs-test  ===" >>working/log
18 echo " "
19
20 bin/bacula start 2>&1 >/dev/null
21 bin/console -c bin/console.conf <<END_OF_DATA
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 echo "Backup 1 done"
35 touch ${cwd}/build/src/dird/*.c
36 #
37 # run a second job
38 #
39 bin/console -c bin/console.conf <<END_OF_DATA
40 @output /dev/null
41 messages
42 @output tmp/log1.out
43 run job=CompressedTest
44 yes
45 wait
46 messages
47 @# 
48 @# now do several restores to ensure we cleanup between jobs
49 @#
50 @output /dev/null
51 restore where=${cwd}/tmp/bacula-restores current all
52 yes
53 wait
54 restore where=${cwd}/tmp/bacula-restores current all
55 yes
56 wait
57 @output tmp/log2.out
58 restore where=${cwd}/tmp/bacula-restores current all
59 yes
60 wait
61 messages
62 @output
63 quit
64 END_OF_DATA
65 bin/bacula stop 2>&1 >/dev/null
66 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
67 bstat=$?
68 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
69 rstat=$?
70 diff -r build tmp/bacula-restores${cwd}/build
71 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
72    echo " "
73    echo " "
74    echo "  !!!!! two-jobs-test Bacula source failed!!! !!!!! "
75    echo "  !!!!! two-jobs-test failed!!! !!!!! " >>test.out
76    echo " "
77 else
78    echo "  ===== two-jobs-test Bacula source OK ===== "
79    echo "  ===== two-jobs-test OK ===== " >>test.out
80    scripts/cleanup
81 fi