]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore-replace-never-test
d5542cec861b5f3fe9aa5b6053b090bbd5b40842
[bacula/bacula] / regress / tests / restore-replace-never-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory using the compressed option
4 #   then restore it.
5 #
6
7 TestName="restore-replace-never"
8 JobName=restore-replace-never
9 . scripts/functions
10
11 scripts/cleanup
12 scripts/copy-test-confs
13 mkdir -p ${cwd}/tmp/dir/dir1
14 touch ${cwd}/tmp/dir/dir1/file1
15 touch ${cwd}/tmp/dir/dir1/file2
16 echo ${cwd}/tmp/dir >${cwd}/tmp/file-list
17
18 stat ${cwd}/tmp/dir                >${cwd}/tmp/1
19 stat ${cwd}/tmp/dir/dir1          >>${cwd}/tmp/1
20 stat ${cwd}/tmp/dir/dir1/file1    >>${cwd}/tmp/1
21 stat ${cwd}/tmp/dir/dir1/file2    >>${cwd}/tmp/1
22 # Strip Change: lines
23 grep -v "Change:" ${cwd}/tmp/1 >${cwd}/tmp/stat-before
24
25 change_jobname CompressedTest $JobName
26 start_test
27
28 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
29 @$out /dev/null
30 messages
31 @$out ${cwd}/tmp/log1.out
32 label storage=File volume=TestVolume001
33 run job=$JobName yes
34 wait
35 messages
36 quit
37 END_OF_DATA
38
39 run_bacula
40
41 rm -rf ${cwd}/tmp/dir
42
43 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
44 @$out /dev/null
45 messages
46 @$out ${cwd}/tmp/log2.out
47 restore where=/ storage=File replace=never select all done yes
48 @#restore where=/ storage=File select all done yes
49 wait
50 messages
51 quit
52 END_OF_DATA
53
54 run_bconsole
55
56 stat ${cwd}/tmp/dir                >${cwd}/tmp/1
57 stat ${cwd}/tmp/dir/dir1          >>${cwd}/tmp/1
58 stat ${cwd}/tmp/dir/dir1/file1    >>${cwd}/tmp/1
59 stat ${cwd}/tmp/dir/dir1/file2    >>${cwd}/tmp/1
60 # Strip Change: lines
61 grep -v "Change:" ${cwd}/tmp/1 >${cwd}/tmp/stat-after
62
63 check_for_zombie_jobs storage=File
64 stop_bacula
65
66 check_two_logs
67 if test "$debug" -eq 1 ; then
68   diff -u ${cwd}/tmp/stat-before ${cwd}/tmp/stat-after
69 else
70   diff -u ${cwd}/tmp/stat-before ${cwd}/tmp/stat-after 2>&1 >/dev/null
71 fi
72 if [ $? != 0 ]; then
73   dstat=1
74 fi
75 end_test