]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/concurrent-jobs-test
Flush changes
[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 bin/bacula stop 2>&1 >/dev/null
26 cd bin
27 ./drop_bacula_tables >/dev/null 2>&1
28 ./make_bacula_tables >/dev/null 2>&1
29 ./grant_bacula_privileges 2>&1 >/dev/null
30 cd ..
31
32 echo " "
33 echo " "
34 echo " === Starting concurrent-jobs-test  ==="
35 echo " === Starting concurrent-jobs-test  ===" >>working/log
36 echo " "
37
38 bin/bacula start 2>&1 >/dev/null
39 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
40 @output /dev/null
41 messages
42 @output tmp/log1.out
43 label storage=File volume=TestVolume001
44 run job=CompressedTest level=Full yes
45 run job=CompressedTest level=Full yes
46 run job=CompressedTest level=Full yes
47 run job=CompressedTest level=Full yes
48 wait
49 messages
50 @# 
51 @# now do a restore
52 @#
53 @output tmp/log2.out
54 restore where=${cwd}/tmp/bacula-restores select storage=File
55 unmark *
56 mark *
57 done
58 yes
59 wait
60 messages
61 @output
62 quit
63 END_OF_DATA
64 scripts/check_for_zombie_jobs storage=File
65
66 bin/bacula stop 2>&1 >/dev/null
67 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
68 bstat=$?
69 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
70 rstat=$?
71 diff tmp/largefile  tmp/bacula-restores${cwd}/tmp/largefile 2>&1 >/dev/null
72 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
73    echo " "
74    echo " "
75    echo "  !!!!! concurrent-jobs-test Bacula source failed!!! !!!!! "
76    echo "  !!!!! concurrent-jobs-test failed!!! !!!!! " >>test.out
77    echo " "
78 else
79    echo "  ===== concurrent-jobs-test Bacula source OK ===== "
80    echo "  ===== concurrent-jobs-test OK ===== " >>test.out
81    scripts/cleanup
82 fi