]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/strip-test
Pull regression truncate-test from Branch-9.1
[bacula/bacula] / regress / tests / strip-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 # Attempt to strip the path
9 #
10 TestName="strip-test"
11 JobName=stripTest
12 . scripts/functions
13
14 scripts/cleanup
15 scripts/copy-strip-confs
16
17 # Make a copy of build/src/dird to be backed up
18 rm -rf ${tmp}/$$-strip
19 mkdir -p ${tmp}/$$-strip
20 cp -rpf ${cwd}/build/src/dird/ ${tmp}/$$-strip/
21 echo "${tmp}/$$-strip" >${cwd}/tmp/file-list
22
23 # Now, strip the first 4 parts of the path (which is what
24 #   the backup will do and put the result in rpath
25 echo "${tmp}/$$-strip/" >${tmp}/1
26 rpath=`cut -f5- -d'/' ${tmp}/1`
27 #echo "========= $rpath"
28
29 change_jobname NightlySave $JobName
30 start_test
31
32 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
33 @output /dev/null
34 messages
35 @#
36 @# Do a backup
37 @#
38 @$out ${cwd}/tmp/log1.out
39 @#setdebug level=150 dir
40 @#setdebug level=150 storage=FileStorage
41 setdebug level=100 client=$CLIENT
42 label storage=FileStorage pool=Default volume=TestVolume001
43 run job=$JobName storage=FileStorage pool=Default yes
44 wait
45 messages
46 quit
47 END_OF_DATA
48
49
50 run_bacula
51
52 rm -rf ${cwd}/tmp/bacula-restores
53
54 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
55 @output /dev/null
56 messages
57 @# 
58 @# now do a restore
59 @#
60 @$out ${cwd}/tmp/log2.out
61 @#setdebug level=50 client=$CLIENT
62 restore where=${cwd}/tmp/bacula-restores select all storage=FileStorage done
63 yes
64 wait
65 messages
66 quit
67 END_OF_DATA
68
69 run_bconsole
70
71 check_for_zombie_jobs storage=FileStorage
72 stop_bacula
73
74 check_two_logs
75 #
76 if test "$debug" -eq 1 ; then
77    diff -ur ${tmp}/$$-strip/ ${tmp}/bacula-restores/${rpath}
78 else 
79    diff -r ${tmp}/$$-strip/ ${tmp}/bacula-restores/${rpath} 2>&1 >/dev/null
80 fi
81 dstat=$?
82
83 rm -rf ${tmp}/$$-strip
84
85 end_test