]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/big-files-test
regress: add function to create many dirs
[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 2000000 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 "\r$i   " 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 sed 's%Type = Backup%Type = Backup%' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
28
29 change_jobname MonsterFileSet $JobName
30 start_test
31
32 cat <<END_OF_SCRIPT >${cwd}/tmp/bconcmds
33 @$out /dev/null
34 messages
35 @$out ${cwd}/tmp/log1.out
36 status all
37 status all
38 list pools
39 messages
40 @#setdebug level=110 storage=File
41 run job=$JobName storage=File yes
42 list pools
43 list volumes
44 wait
45 sql
46 SELECT StartTime, JobFiles, JobId, Level, count(*) AS nb_jobmedia  
47 FROM JobMedia join Job using (JobId) join Client using (ClientId) 
48 where Client.Name = 'localhost-fd' group by JobId, Level, StartTime, 
49 JobFiles order by JobId desc ;
50
51 messages
52 run job=$JobName storage=File yes
53 wait
54 messages
55 @# 
56 @# now do a restore
57 @#
58 @$out ${cwd}/tmp/log2.out
59 @#setdebug level=400 storage=File
60 restore where=${cwd}/tmp/bacula-restores select storage=File
61 unmark *
62 mark *
63 count
64 find 10file10
65 pwd
66 estimate
67 done
68 yes
69 wait
70 messages
71 quit
72 END_OF_SCRIPT
73
74 run_bacula
75 check_for_zombie_jobs storage=File || exit 1
76 stop_bacula
77
78 check_two_logs
79
80 # we are really more interested to know if backup and restore 
81 # worked, but checking the files restored is non-trivial due
82 # to the big fileset exclusions
83 #  check_restore_diff
84
85 zstat=0
86 dstat=0
87 bstat=0
88 rstat=0
89 end_test