]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/concurrent-jobs-test
Updates
[bacula/bacula] / regress / tests / concurrent-jobs-test
1 #!/bin/sh
2 #
3 # Run two jobs at the same time
4 #
5 cwd=`pwd`
6 scripts/copy-test-confs
7 scripts/cleanup
8 echo "${cwd}/tmp/largefile" >/tmp/file-list
9 if test -c /dev/urandom ; then
10 # Create 56MB file with random data
11    echo "Creating a 56MB file with random data ..."
12    dd if=/dev/urandom of=${cwd}/tmp/largefile bs=1024 count=55000
13 else
14    echo "Creating a 56MB file with bacula-dir data ..."
15    dd if=bin/bacula-dir of=${cwd}/tmp/1 bs=1024 count=1000
16    cat ${cwd}/tmp/1 ${cwd}/tmp/1 ${cwd}/tmp/1 ${cwd}/tmp/1 ${cwd}/tmp/1 >${cwd}/tmp/2
17    rm -f ${cwd}/tmp/1
18    cat ${cwd}/tmp/2 ${cwd}/tmp/2 ${cwd}/tmp/2 ${cwd}/tmp/2 ${cwd}/tmp/2 >>${cwd}/tmp/3
19    rm -f ${cwd}/tmp/2
20    cat ${cwd}/tmp/3 ${cwd}/tmp/3 ${cwd}/tmp/3 ${cwd}/tmp/3 ${cwd}/tmp/3 >${cwd}/tmp/largefile
21    rm -f ${cwd}/tmp/3
22 fi 
23
24 echo "largefile created"
25
26 echo " "
27 echo " "
28 echo " === Starting concurrent-jobs-test at `date +%R:%S` ==="
29 echo " "
30
31 bin/bacula start 2>&1 >/dev/null
32 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null 2>&1 >/dev/null
33 @output /dev/null
34 messages
35 @output tmp/log1.out
36 label storage=File volume=TestVolume001
37 run job=CompressedTest level=Full yes
38 run job=CompressedTest level=Full yes
39 run job=CompressedTest level=Full yes
40 run job=CompressedTest level=Full yes
41 wait
42 messages
43 @# 
44 @# now do a restore
45 @#
46 @output tmp/log2.out
47 restore where=${cwd}/tmp/bacula-restores select storage=File
48 unmark *
49 mark *
50 done
51 yes
52 wait
53 messages
54 @output
55 quit
56 END_OF_DATA
57 scripts/check_for_zombie_jobs storage=File
58
59 bin/bacula stop 2>&1 >/dev/null
60 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
61 bstat=$?
62 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
63 rstat=$?
64 diff tmp/largefile  tmp/bacula-restores${cwd}/tmp/largefile 2>&1 >/dev/null
65 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
66    echo " "
67    echo " "
68    echo "  !!!!! concurrent-jobs-test Bacula source failed!!! !!!!! "
69    echo "  !!!!! concurrent-jobs-test failed!!! !!!!! " >>test.out
70    if [ $bstat != 0 -o $rstat != 0 ] ; then
71       echo "  !!!!! Bad Job termination status     !!!!! "
72       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
73    else
74       echo "  !!!!! Restored files differ          !!!!! "
75       echo "  !!!!! Restored files differ          !!!!! " >>test.out
76    fi
77    echo " "
78 else
79    echo "  ===== concurrent-jobs-test Bacula source OK `date +%R:%S` ===== "
80    echo "  ===== concurrent-jobs-test OK `date +%R:%S` ===== " >>test.out
81    scripts/cleanup
82 fi