]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/speed-test
Add new test
[bacula/bacula] / regress / tests / speed-test
1 #!/bin/sh
2 #
3 # Run a big test with backup of millions of files then run 100 incremental
4 # modifying 10% each time
5 #
6 TestName="speed-test"
7 JobName=speed 
8 . scripts/functions
9
10 ${rscripts}/cleanup
11 ${rscripts}/copy-test-confs
12 echo "${cwd}/files" >${tmp}/file-list
13 rm -rf ${tmp}/bacula-restores
14 mkdir -p $cwd/files
15
16 change_jobname CompressedTest $JobName
17 if [ "$1" = "accurate" ]; then
18   sed 's/Name = "speed"/Name = "speed"; accurate=yes/' $conf/bacula-dir.conf > $tmp/1
19   mv $tmp/1 $conf/bacula-dir.conf
20 fi
21
22 start_test
23
24 # Create X million of files 
25 echo "Creating 1.5M files"
26 perl -e '
27 my $dest="'$cwd/files'";
28 my $base;
29 mkdir $dest;
30 $base = chr(1450000 % 26 + 65);
31 if (-f "$dest/$base/aaa1450000aaa$base") {
32   exit 0;
33 }
34 $| = 1;
35 for(my $i=0; $i < 26; $i++) {
36  $base = chr($i + 65);
37   mkdir("$dest/$base") or die "$dest/$base $!";
38 }
39 for(my $i=0; $i<=1500000; $i++) {
40  $base = chr($i % 26 + 65);
41  open(FP, ">$dest/$base/aaa${i}aaa$base") or die "$dest/$base $!";
42  print FP "$i\n";
43  close(FP);
44
45  mkdir "$dest/$base/$base$i$base" if (!($i % 100));
46  print "." if (!($i % 10000));
47 }
48 print "\n";
49 '
50
51 cat <<END_OF_DATA >${tmp}/bconcmds
52 @$out /dev/null
53 messages
54 @$out ${tmp}/log1.out
55 label storage=File volume=TestVolume001
56 run job=$JobName yes
57 wait
58 messages
59 quit
60 END_OF_DATA
61
62 run_bacula
63 check_for_zombie_jobs storage=File
64
65 cat <<END_OF_DATA >${tmp}/bconcmds
66 @$out /dev/null
67 messages
68 @$out ${tmp}/log1.out
69 run job=$JobName level=Full yes
70 wait
71 messages
72 quit
73 END_OF_DATA
74
75 # insert 15 million files into File table
76 for i in $(seq 0 10)
77 do
78  run_bconsole
79 done
80
81 cat <<END_OF_DATA >${tmp}/bconcmds
82 @$out /dev/null
83 messages
84 @$out ${tmp}/log1.out
85 run job=$JobName level=Incremental yes
86 wait
87 messages
88 quit
89 END_OF_DATA
90
91
92 for i in $(seq 0 25)
93 do
94
95 perl -e '
96 my $dest="'$cwd/files'";
97 my $start="'$i'";
98 my $base = chr($start + 65);
99
100 opendir(DIR, "$dest/$base") || die "$!";
101 map {
102  open(FP, ">$dest/$base/$_") or die "$_ $!";
103  print FP "update $_\n";
104  close(FP);
105 } grep { ! /^\./  } readdir(DIR);
106 closedir DIR;
107 '
108 run_bconsole
109
110 done
111
112 cat <<END_OF_DATA >${tmp}/bconcmds
113 @$out /dev/null
114 messages
115 @# 
116 @# now do a restore
117 @#
118 @$out ${tmp}/log2.out
119 time
120 restore where=${tmp}/bacula-restores storage=File select all done yes
121 time
122 wait
123 time
124 status storage=File
125 messages
126 quit
127 END_OF_DATA
128
129 run_bconsole
130 check_for_zombie_jobs storage=File
131 stop_bacula
132
133 check_two_logs
134 #rm -rf ${tmp}/files
135
136 find ${tmp}/bacula-restores | wc -l | tee $tmp/bacula-restore-list
137
138 rm -rf ${tmp}/bacula-restores
139 end_test