]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/big-files-test
Fix backup-bacula regression
[bacula/bacula] / regress / tests / big-files-test
1 #!/bin/sh
2 #
3 #  Test if Bacula can handle big fileset
4 #  This test create 2M files on a directory and
5 #  backup it twice in accurate mode.
6 #
7 #  Creating 2M files is very long, so the "many-files"
8 #  directory isn' cleaned at the end.
9 #
10
11 TestName="big-files-test"
12 JobName=BigFiles
13 . scripts/functions
14
15 copy_test_confs
16
17 echo "${cwd}/many-files" >${cwd}/tmp/file-list
18 if [ ! -f ${cwd}/many-files/100000file100000 ]; then
19     mkdir -p ${cwd}/many-files
20     cd ${cwd}/many-files
21     print_debug "Creating files..."
22     time perl -e 'for($i=0; $i < 2000000; $i++) {open(FP, ">${i}file${i}") or die "$!"; print FP "$i\n"; close(FP); print "." if ($i%10000);}'
23 fi
24
25 sed "s%# Label Format%  Label Format%" ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
26 sed "s%Type = Backup%Type = Backup; Accurate = yes" ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
27
28 change_jobname MonsterFileSet $JobName
29 start_test
30
31 cat <<END_OF_SCRIPT >${cwd}/tmp/bconcmds
32 @$out /dev/null
33 messages
34 @$out ${cwd}/tmp/log1.out
35 status all
36 status all
37 list pools
38 messages
39 @#setdebug level=110 storage=File
40 run job=$JobName storage=File yes
41 list pools
42 list volumes
43 wait
44 sql
45 SELECT StartTime, JobFiles, JobId, Level, count(*) AS nb_jobmedia  
46 FROM JobMedia join Job using (JobId) join Client using (ClientId) 
47 where Client.Name = 'localhost-fd' group by JobId, Level, StartTime, 
48 JobFiles order by JobId desc ;
49
50 messages
51 run job=$JobName storage=File yes
52 wait
53 messages
54 @# 
55 @# now do a restore
56 @#
57 @$out ${cwd}/tmp/log2.out
58 @#setdebug level=400 storage=File
59 restore where=${cwd}/tmp/bacula-restores select storage=File
60 unmark *
61 mark *
62 count
63 find 10file10
64 pwd
65 estimate
66 done
67 yes
68 wait
69 messages
70 quit
71 END_OF_SCRIPT
72
73 run_bacula
74 check_for_zombie_jobs storage=File || exit 1
75 stop_bacula
76
77 check_two_logs
78
79 # we are really more interested to know if backup and restore 
80 # worked, but checking the files restored is non-trivial due
81 # to the big fileset exclusions
82 #  check_restore_diff
83
84 zstat=0
85 dstat=0
86 bstat=0
87 rstat=0
88 end_test