]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/query-test
43b450bc6e113c49e1bd8553b39f1b73076b1fe4
[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 Differental then a bunch of query commands
5 #   and finally restore the two files.
6 #
7 TestName="query-test"
8 JobName=query
9 . scripts/functions
10 set_debug 0
11
12 scripts/cleanup
13 scripts/copy-test-confs
14 echo "${cwd}/tmp/build" >/tmp/file-list
15 mkdir ${cwd}/tmp/build
16 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
17 cd ${cwd}/tmp
18 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
19 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
20 cd ${cwd}
21
22 change_jobname CompressedTest $JobName
23 start_test
24
25 cat <<END_OF_DATA >tmp/bconcmds
26 @output /dev/null
27 messages
28 @$out tmp/log1.out
29 label storage=File volume=TestVolume001
30 label storage=File volume=TestVolume002
31 run job=$JobName yes
32 wait
33 messages
34 quit
35 END_OF_DATA
36
37 run_bacula
38 check_for_zombie_jobs storage=File
39
40 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
41 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
42
43 cat <<END_OF_DATA >tmp/bconcmds
44 @output /dev/null
45 messages
46 @$out tmp/log1.out
47 @# Force differental on the second Volume
48 update volume=TestVolume001 VolStatus=Used
49 run level=differental job=$JobName yes
50 wait
51 messages
52 @output
53 END_OF_DATA
54
55 run_bacula
56 check_for_zombie_jobs storage=File
57
58 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
59 cat <<END_OF_DATA >tmp/bconcmds
60 @output /dev/null
61 messages
62 @$out tmp/log1.out
63 run level=incremental job=$JobName yes
64 wait
65 messages
66 @#
67 @# Now do the queries
68 @#
69 query
70 1
71 ficheriro1.txt
72 query
73 2
74 ${cwd}/tmp/build/
75 ficheriro1.txt
76 localhost-fd
77 query
78 6
79 TestVolume001
80 query
81 7
82 1
83 query
84 8
85 localhost-fd
86 query
87 9
88 Default
89 query
90 10
91 query
92 11
93 query
94 12
95 1
96 @# 
97 @# now do a restore
98 @#
99 @$out tmp/log2.out
100 restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore-list
101 yes
102 wait
103 messages
104 @output
105 quit
106 END_OF_DATA
107
108 run_bacula
109 check_for_zombie_jobs storage=File
110 stop_bacula
111
112 #
113 # Delete .c files because we will only restored the txt files
114 #
115 rm -f tmp/build/*.c
116
117 check_two_logs
118 check_restore_tmp_build_diff
119 end_test