]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/sparse-encrypt-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / sparse-encrypt-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 simple backup with encryption and a real sparse file.
9 #
10 TestName="sparse-encrypt-test"
11 JobName=Crypto
12 . scripts/functions
13
14 scripts/cleanup
15 scripts/copy-crypto-confs
16 echo "${cwd}/build" >${cwd}/tmp/file-list
17 cd ${cwd}/build/src/tools
18 ./gigaslam
19 if [ $? != 0 ]; then
20    echo "Execute of ${cwd}/build/src/tools/gigaslam failed."
21    rm -f ${cwd}/build/src/tools/gigaslam.gif
22    exit 1
23 fi
24 cd ${cwd}
25
26 change_jobname SparseTest $JobName
27 start_test
28
29 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
30 @output /dev/null
31 messages
32 @$out ${cwd}/tmp/log1.out
33 label storage=File volume=TestVolume001
34 setdebug level=10 fd
35 run job=$JobName yes
36 wait
37 messages
38 list volumes
39 @# 
40 @# now do a restore
41 @#
42 @$out ${cwd}/tmp/log2.out
43 @# setdebug level=0 fd
44 restore where=${cwd}/tmp/bacula-restores storage=File
45 5
46 mark *
47 done
48 yes
49 wait
50 messages
51 quit
52 END_OF_DATA
53
54 run_bacula
55 sleep 2
56 check_for_zombie_jobs storage=File 
57 stop_bacula
58
59 if [ ! -f ${cwd}/tmp/bacula-restores/${cwd}/build/src/tools/gigaslam.gif ]; then
60    echo "============= file gigaslam.gif was not restored ======="
61    size=0
62 else
63    size=`du ${cwd}/tmp/bacula-restores/${cwd}/build/src/tools/gigaslam.gif | cut -f 1`
64   if [ $size -gt 120 ]; then
65       echo "========== restored sparse file: gigaslam.gif too big ========="
66       echo "      size is ${size}K it should be 120K"
67    fi                                                    
68 fi
69
70 check_two_logs
71 check_restore_diff
72 end_test
73 rm -f ${cwd}/build/src/tools/gigaslam.gif
74 rm -f ${cwd}/build/gigaslam.gif