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