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