]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/fileregexp-test
ebl add test for fileregexp bsr code
[bacula/bacula] / regress / tests / fileregexp-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory
4 #   then restore it.
5 #
6 TestName="fileregexp-test"
7 JobName=backup
8 . scripts/functions
9
10 scripts/cleanup
11 scripts/copy-confs
12
13 #
14 # Zap out any schedule in default conf file so that
15 #  it doesn't start during our test
16 #
17 outf="tmp/sed_tmp"
18 echo "s%  Schedule =%# Schedule =%g" >${outf}
19 echo "s%File Retention =%File Retention = 2 #%" >>  ${outf}
20 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
21 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
22
23 change_jobname Client1 $JobName
24 start_test
25
26 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
27 @output /dev/null
28 messages
29 @$out ${cwd}/tmp/log1.out
30 label volume=TestVolume001 storage=File pool=Default
31 run job=$JobName yes
32 wait
33 messages
34 @sleep 5
35 prune files yes
36 @# 
37 @# now do a restore
38 @#
39 @$out ${cwd}/tmp/log2.out  
40 restore where=${cwd}/tmp/bacula-restores
41 5
42 no
43 README
44 yes
45 wait
46 messages
47 @$out
48 quit
49 END_OF_DATA
50
51 run_bacula
52 check_for_zombie_jobs storage=File
53 stop_bacula
54
55 COUNT_OTHER=`find ${cwd}/tmp/bacula-restores -type f | grep -v README | wc -l`
56 COUNT_README=`find ${cwd}/tmp/bacula-restores -type f | grep README | wc -l`
57
58 if [ $COUNT_OTHER -gt 0 -o $COUNT_README -lt 15 ]; then
59     print_debug "Found non matching files"
60     print_debug `find ${cwd}/tmp/bacula-restores -type f | grep -v README`
61     rstat=2
62 fi
63
64 #check_two_logs         # don't work because of "warning file count mismatch"
65 grep "Backup OK" ${cwd}/tmp/log1.out > /dev/null
66 if [ $? -ne 0 ]; then
67     print_debug "Found error on backup"
68     bstat=2
69 fi
70
71 end_test