]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/restore-replace-ifnewer-test
authorEric Bollengier <eric@baculasystems.com>
Wed, 2 Sep 2020 13:32:31 +0000 (15:32 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 1 Mar 2022 14:36:18 +0000 (15:36 +0100)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Jul 21 10:28:13 2020 +0200

    regress: Add copyright to regress scripts

Author: Kern Sibbald <kern@sibbald.com>
Date:   Tue Oct 23 18:52:29 2012 +0200

    Drop previous regression test output

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Mar 13 18:16:30 2012 +0100

    regress: Tweak the restore-replace-ifnewer test

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Mar 13 17:56:08 2012 +0100

    regress: Add test for replace=ifnewer bug

regress/tests/restore-replace-ifnewer-test [new file with mode: 0755]

diff --git a/regress/tests/restore-replace-ifnewer-test b/regress/tests/restore-replace-ifnewer-test
new file mode 100755 (executable)
index 0000000..e3cac39
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2020 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Run a simple backup of the Bacula build directory using the compressed option
+#   then restore it.
+#
+
+TestName="restore-replace-ifnewer-test"
+JobName=restore-replace-ifnewer
+. scripts/functions
+
+scripts/cleanup
+scripts/copy-test-confs
+
+mkdir -p ${cwd}/tmp/dir/dir1
+
+# use non usual rights to compare
+chmod 711 ${cwd}/tmp/dir/dir1
+GRP=`id -G`                     # should display the group list
+set $GRP                        # affect $1, $2 to this list
+chgrp $2 ${cwd}/tmp/dir/dir1    # the first one is the default, choose the 2nd
+
+touch ${cwd}/tmp/dir/dir1/file1
+touch ${cwd}/tmp/dir/dir1/file2
+echo ${cwd}/tmp/dir >${cwd}/tmp/file-list
+
+change_jobname CompressedTest $JobName
+start_test
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+setdebug level=50 trace=1 client
+@$out ${cwd}/tmp/log1.out
+label storage=File volume=TestVolume001
+run job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out ${cwd}/tmp/log2.out
+restore where=$cwd/tmp storage=File replace=ifnewer select all done yes
+@#restore storage=File select all done yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+
+scripts/diff.pl -s ${cwd}/tmp/dir -d ${cwd}/tmp/$cwd/tmp/dir
+if [ $? != 0 ]; then
+  dstat=1
+fi
+end_test