]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/speed-test
Merge branch 'master' into basejobv3
[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 # Can use following env variables
7 # ACCURATE=yes
8 # BASEJOB=yes
9 # NB_CONCURENT=4
10
11 TestName="speed-test"
12 JobName=speed 
13 . scripts/functions
14
15 ${rscripts}/cleanup
16 ${rscripts}/copy-test-confs
17 echo "${cwd}/files" >${tmp}/file-list
18 rm -rf ${tmp}/bacula-restores
19 mkdir -p $cwd/files
20
21 change_jobname CompressedTest $JobName
22 if [ a$ACCURATE != a ]; then
23   sed 's/Name = "speed"/Name = "speed"; accurate=yes/' $conf/bacula-dir.conf > $tmp/1
24   mv $tmp/1 $conf/bacula-dir.conf
25 fi
26
27 if [ a$BASEJOB != a ]; then
28   sed 's/Name = "speed"/Name = "speed"; accurate=yes;basejob=speed/' $conf/bacula-dir.conf > $tmp/1
29   mv $tmp/1 $conf/bacula-dir.conf
30   basejob="level=base"
31 fi
32
33 export NB_CONCURENT=${NB_CONCURENT:-1}
34
35 start_test
36
37 # Create X million of files 
38 echo "Creating 1.5M files"
39 perl -Mscripts::functions -e "create_many_files('$cwd/files');"
40
41 cat <<END_OF_DATA >${tmp}/bconcmds
42 @$out /dev/null
43 messages
44 @$out ${tmp}/log1.out
45 label storage=File volume=TestVolume001
46 run job=$JobName $basejob yes
47 wait
48 messages
49 quit
50 END_OF_DATA
51
52 run_bacula
53 check_for_zombie_jobs storage=File
54
55 cat <<END_OF_DATA >${tmp}/bconcmds
56 @$out /dev/null
57 messages
58 @$out ${tmp}/log1.out
59 END_OF_DATA
60
61 for j in $(seq 1 $NB_CONCURENT)
62 do
63     cat <<EOF >>${tmp}/bconcmds
64 @sleep 5
65 run job=$JobName level=Full yes
66 EOF
67 done
68
69 cat <<EOF >>${tmp}/bconcmds
70 wait
71 messages
72 quit
73 EOF
74
75 # insert X million files into File table
76 for i in $(seq 0 20)
77 do
78     run_bconsole
79 done
80
81 # Now, run many incremental
82 sed 's/Full/Incremental/' ${tmp}/bconcmds > $tmp/1
83 mv $tmp/1 ${tmp}/bconcmds
84
85 for i in $(seq 0 25)
86 do
87     perl -Mscripts::functions -e "update_some_files('$cwd/files/'.chr($i+65));"
88     run_bconsole
89 done
90
91 cat <<END_OF_DATA >${tmp}/bconcmds
92 @$out /dev/null
93 messages
94 @# 
95 @# now do a restore
96 @#
97 @$out ${tmp}/log2.out
98 time
99 restore where=${tmp}/bacula-restores storage=File select all done yes
100 time
101 wait
102 time
103 status storage=File
104 messages
105 quit
106 END_OF_DATA
107
108 run_bconsole
109 check_for_zombie_jobs storage=File
110 stop_bacula
111
112 check_two_logs
113 #rm -rf ${tmp}/files
114
115 find ${tmp}/bacula-restores | wc -l | tee $tmp/bacula-restore-list
116 rm -rf ${tmp}/bacula-restores
117
118 cp working/log files/log${WHICHDB}-$(date +%F_%H-%M).log
119
120 end_test