]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/weird-files-test
regress: add function to create many dirs
[bacula/bacula] / regress / tests / weird-files-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory
4 #   then restore it.
5 #
6 TestName="weird-files-test"
7 JobName=wierd-files
8 . scripts/functions
9
10 if test ! -d weird-files ; then
11    echo " "
12    echo "Weird files not configured. Test not run."
13    exit 0
14 fi
15
16 cwd=`pwd`
17 scripts/cleanup
18 scripts/copy-test-confs
19 change_jobname NightlySave $JobName
20 #
21 # Note, we save the weird-files directory twice on purpose
22 #  because this causes problems with hard linked files 
23 #  that are only saved once.  In 1.33, Bacula now deals
24 #  with this situation.
25 #
26 echo "${cwd}/weird-files" >${cwd}/tmp/file-list
27 echo "${cwd}/weird-files" >>${cwd}/tmp/file-list
28
29 # Create a Unix domain socket (sock-file)
30 cd weird-files
31 perl socket.pl
32 cd ..
33
34 start_test
35
36 cat <<END_OF_DATA >tmp/bconcmds
37 @$out /dev/null
38 messages
39 @$out tmp/log1.out
40 label storage=File
41 TestVolume001
42 run job=$JobName    
43 yes
44 wait
45 messages
46 @# 
47 @# now do a restore
48 @#
49 @$out tmp/log2.out
50 restore where=${cwd}/tmp/bacula-restores select storage=File
51 unmark *
52 mark *
53 done
54 yes
55 wait
56 messages
57 quit
58 END_OF_DATA
59
60 run_bacula
61 check_for_zombie_jobs storage=File 
62 stop_bacula
63 # Note, the Unix domain socket (sock-file) is not restored
64 #  by Bacula so we delete it for the diffs
65 rm -f weird-files/sock-file
66 touch weird-files tmp/bacula-restores${cwd}/weird-files
67
68 ${cwd}/bin/testls weird-files | sort >${cwd}/tmp/original
69 cd tmp/bacula-restores${cwd}
70 ${cwd}/bin/testls weird-files | sort >${cwd}/tmp/restored
71 cd ${cwd}
72
73 check_two_logs
74 if test "$debug" -eq 1; then
75   diff -u ${cwd}/tmp/original ${cwd}/tmp/restored
76   dstat=$?
77   if [ $dstat != 0 ] ; then
78      echo " "
79      echo "===== Original ======"
80      cat ${cwd}/tmp/original
81      echo "====="
82      echo " "
83      echo "===== Restored ======"
84      cat ${cwd}/tmp/restored
85      echo "====="
86   fi
87 else
88   diff -u ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null
89   dstat=$?
90 fi
91 end_test