]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/query-test
Updates
[bacula/bacula] / regress / tests / query-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory then create some           
4 #   new files, do a Decremental then a bunch of query commands
5 #   and finally restore the two files.
6 #
7 cwd=`pwd`
8 scripts/copy-test-confs
9 scripts/cleanup
10 echo "${cwd}/tmp/build" >/tmp/file-list
11 mkdir ${cwd}/tmp/build
12 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
13 cd ${cwd}/tmp
14 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
15 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
16 cd ${cwd}
17
18 echo " "
19 echo " "
20 echo " === Starting query-test at `date +%R:%S` ==="
21 echo " === Starting query-test at `date +%R:%S` ===" >>working/log
22 echo " "
23
24 bin/bacula start 2>&1 >/dev/null
25 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
26 @output /dev/null
27 messages
28 @output tmp/log1.out
29 label storage=File volume=TestVolume001
30 label storage=File volume=TestVolume002
31 run job=CompressedTest yes
32 wait
33 messages
34 quit
35 END_OF_DATA
36 scripts/check_for_zombie_jobs storage=File
37 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
38 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
39 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
40 @output /dev/null
41 messages
42 @output tmp/log1.out
43 @# Force decremental on the second Volume
44 update volume=TestVolume001 VolStatus=Used
45 run level=decremental job=CompressedTest yes
46 wait
47 messages
48 @output
49 END_OF_DATA
50 scripts/check_for_zombie_jobs storage=File
51 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
52 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
53 @output /dev/null
54 messages
55 @output tmp/log1.out
56 run level=incremental job=CompressedTest yes
57 wait
58 messages
59 @#
60 @# Now do the queries
61 @#
62 query
63 1
64 query
65 2
66 ficheriro1.txt
67 query
68 3
69 ${cwd}/tmp/build/
70 ficheriro1.txt
71 Client1
72 query
73 7
74 TestVolume001
75 query
76 8
77 1
78 query
79 9
80 Client1
81 query
82 10
83 Default
84 query
85 11
86 query
87 12
88 query
89 13
90 1
91 @# 
92 @# now do a restore
93 @#
94 @output tmp/log2.out
95 restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore-list
96 yes
97 wait
98 messages
99 @output
100 quit
101 END_OF_DATA
102 scripts/check_for_zombie_jobs storage=File
103 bin/bacula stop 2>&1 >/dev/null
104 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
105 bstat=$?
106 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
107 rstat=$?
108 #
109 # Delete .c files because we will only restored the txt files
110 #
111 rm -f tmp/build/*.c
112 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
113 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
114    echo " "
115    echo " "
116    echo "  !!!!! query-test Bacula source failed!!! !!!!! "
117    echo "  !!!!! query-test failed!!! !!!!! " >>test.out
118    if [ $bstat != 0 -o $rstat != 0 ] ; then
119       echo "  !!!!! Bad Job termination status     !!!!! "
120       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
121    else
122       echo "  !!!!! Restored files differ          !!!!! "
123       echo "  !!!!! Restored files differ          !!!!! " >>test.out
124    fi
125    echo " "
126 else
127    echo "  ===== query-test Bacula source OK ===== "
128    echo "  ===== query-test OK ===== " >>test.out
129    scripts/cleanup
130 fi