]> git.sur5r.net Git - bacula/bacula/commitdiff
Add new test
authorEric Bollengier <eric@eb.homelinux.org>
Thu, 17 Sep 2009 20:49:27 +0000 (22:49 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Thu, 17 Sep 2009 20:49:27 +0000 (22:49 +0200)
regress/tests/speed-test [new file with mode: 0755]

diff --git a/regress/tests/speed-test b/regress/tests/speed-test
new file mode 100755 (executable)
index 0000000..b2379ef
--- /dev/null
@@ -0,0 +1,139 @@
+#!/bin/sh
+#
+# Run a big test with backup of millions of files then run 100 incremental
+# modifying 10% each time
+#
+TestName="speed-test"
+JobName=speed 
+. scripts/functions
+
+${rscripts}/cleanup
+${rscripts}/copy-test-confs
+echo "${cwd}/files" >${tmp}/file-list
+rm -rf ${tmp}/bacula-restores
+mkdir -p $cwd/files
+
+change_jobname CompressedTest $JobName
+if [ "$1" = "accurate" ]; then
+  sed 's/Name = "speed"/Name = "speed"; accurate=yes/' $conf/bacula-dir.conf > $tmp/1
+  mv $tmp/1 $conf/bacula-dir.conf
+fi
+
+start_test
+
+# Create X million of files 
+echo "Creating 1.5M files"
+perl -e '
+my $dest="'$cwd/files'";
+my $base;
+mkdir $dest;
+$base = chr(1450000 % 26 + 65);
+if (-f "$dest/$base/aaa1450000aaa$base") {
+  exit 0;
+}
+$| = 1;
+for(my $i=0; $i < 26; $i++) {
+ $base = chr($i + 65);
+  mkdir("$dest/$base") or die "$dest/$base $!";
+}
+for(my $i=0; $i<=1500000; $i++) {
+ $base = chr($i % 26 + 65);
+ open(FP, ">$dest/$base/aaa${i}aaa$base") or die "$dest/$base $!";
+ print FP "$i\n";
+ close(FP);
+
+ mkdir "$dest/$base/$base$i$base" if (!($i % 100));
+ print "." if (!($i % 10000));
+}
+print "\n";
+'
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+label storage=File volume=TestVolume001
+run job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+run job=$JobName level=Full yes
+wait
+messages
+quit
+END_OF_DATA
+
+# insert 15 million files into File table
+for i in $(seq 0 10)
+do
+ run_bconsole
+done
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+run job=$JobName level=Incremental yes
+wait
+messages
+quit
+END_OF_DATA
+
+
+for i in $(seq 0 25)
+do
+
+perl -e '
+my $dest="'$cwd/files'";
+my $start="'$i'";
+my $base = chr($start + 65);
+
+opendir(DIR, "$dest/$base") || die "$!";
+map {
+ open(FP, ">$dest/$base/$_") or die "$_ $!";
+ print FP "update $_\n";
+ close(FP);
+} grep { ! /^\./  } readdir(DIR);
+closedir DIR;
+'
+run_bconsole
+
+done
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@# 
+@# now do a restore
+@#
+@$out ${tmp}/log2.out
+time
+restore where=${tmp}/bacula-restores storage=File select all done yes
+time
+wait
+time
+status storage=File
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+#rm -rf ${tmp}/files
+
+find ${tmp}/bacula-restores | wc -l | tee $tmp/bacula-restore-list
+
+rm -rf ${tmp}/bacula-restores
+end_test