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