]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/query-test
Skip lzo-test if lzo not in Bacula
[bacula/bacula] / regress / tests / query-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the Bacula build directory then create some           
9 #   new files, do a Differental then a bunch of query commands
10 #   and finally restore the two files.
11 #
12
13
14 # Query test no longer works because the query file is empty
15 exit
16
17
18
19
20
21
22 TestName="query-test"
23 JobName=query
24 . scripts/functions
25
26 scripts/cleanup
27 scripts/copy-test-confs
28 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
29 mkdir -p ${cwd}/tmp/build
30 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
31 cd ${cwd}/tmp
32 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
33 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
34 cd ${cwd}
35
36 change_jobname CompressedTest $JobName
37 start_test
38
39 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
40 @output /dev/null
41 messages
42 @$out ${cwd}/tmp/log1.out
43 label storage=File volume=TestVolume001
44 label storage=File volume=TestVolume002
45 run job=$JobName yes
46 wait
47 messages
48 quit
49 END_OF_DATA
50
51 run_bacula
52 check_for_zombie_jobs storage=File
53 stop_bacula
54
55 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
56 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
57
58 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
59 @output /dev/null
60 messages
61 @$out ${cwd}/tmp/log1.out
62 @# Force differental on the second Volume
63 update volume=TestVolume001 VolStatus=Used
64 run level=differential job=$JobName yes
65 wait
66 messages
67 END_OF_DATA
68
69 run_bacula
70 check_for_zombie_jobs storage=File
71 stop_bacula
72
73 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
74 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
75 @output /dev/null
76 messages
77 @$out ${cwd}/tmp/log1.out
78 run level=incremental job=$JobName yes
79 wait
80 messages
81 @#
82 @# Now do the queries
83 @#
84 query
85 1
86 ficheriro1.txt
87 query
88 2
89 ${cwd}/tmp/build/
90 ficheriro1.txt
91 localhost-fd
92 query
93 6
94 TestVolume001
95 query
96 7
97 1
98 query
99 8
100 localhost-fd
101 query
102 9
103 Default
104 query
105 10
106 query
107 11
108 query
109 12
110 1
111 @# 
112 @# now do a restore
113 @#
114 @$out ${cwd}/tmp/log2.out
115 restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore-list
116 yes
117 wait
118 messages
119 quit
120 END_OF_DATA
121
122 run_bacula
123 check_for_zombie_jobs storage=File
124 stop_bacula
125
126 #
127 # Delete .c files because we will only restored the txt files
128 #
129 rm -f ${cwd}/tmp/build/*.c
130
131 check_two_logs
132 check_restore_tmp_build_diff
133 end_test