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