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