]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/tests/one-file-test
authorKern Sibbald <kern@sibbald.com>
Wed, 2 Sep 2020 13:30:13 +0000 (15:30 +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:   Wed Nov 14 10:07:21 2012 +0100

    Tweak simple regression tests

Author: Kern Sibbald <kern@sibbald.com>
Date:   Sun Oct 28 17:54:42 2012 +0100

    Tweak regression tests

Author: Kern Sibbald <kern@sibbald.com>
Date:   Sun Oct 21 09:52:00 2012 +0200

    Tweak adata tests + make failures easier to see

Author: Kern Sibbald <kern@sibbald.com>
Date:   Mon Oct 15 12:17:38 2012 +0200

    Tweak pull files from new-aligned

Author: Kern Sibbald <kern@sibbald.com>
Date:   Thu Oct 4 17:59:49 2012 +0200

    Get new tests from working-aligned

regress/tests/one-file-test [new file with mode: 0755]

diff --git a/regress/tests/one-file-test b/regress/tests/one-file-test
new file mode 100755 (executable)
index 0000000..8478bca
--- /dev/null
@@ -0,0 +1,81 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2020 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Run a simple backup of a single file then restore that file.
+#
+TestName="one-file-test"
+JobName=Simple
+. scripts/functions
+
+${rscripts}/cleanup
+${rscripts}/copy-test-confs
+echo "${tmpsrc}" >${tmp}/file-list
+# File to deal with
+file=${src}/src/filed/xattr.c
+#file=${src}/src/testprogs.tar.gz
+#file=${src}/src/dird/xxx
+mkdir -p ${tmpsrc}
+#echo "111111111111111111111" >${src}/src/dird/xxx
+cp -p $file ${tmpsrc}
+cd ${tmp}
+#echo "${tmpsrc}/xxx" >restore-list
+#echo "${tmpsrc}/testprogs.tar.gz" >restore-list
+echo "${tmpsrc}/xattr.c" >restore-list
+
+cd ${cwd}
+
+#change_jobname CompressedTest $JobName
+start_test
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@output /dev/null
+messages
+@$out ${tmp}/log1.out
+setdebug level=100 storage=File
+@#setdebug level=200 client
+@#setdebug level=100 director
+label storage=File volume=TestVolume001
+@#label storage=File volume=TestVolume002
+run job=$JobName yes
+status client
+wait
+@#run level=Full job=$JobName yes
+@#wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+$bin/bls -d 104 -v -c $conf/bacula-sd.conf -V 'TestVolume001' FileStorage
+
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@output /dev/null
+messages
+@# 
+@# now do a restore
+@#
+@$out ${tmp}/log2.out
+setdebug level=100 storage=File
+restore where=${tmp}/bacula-restores storage=File file=<${tmp}/restore-list
+yes
+wait
+@#status client
+@#status storage=File
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+check_for_zombie_jobs storage=File
+stop_bacula
+
+#check_two_logs
+#
+# Delete .c files because we will only restored the txt files
+#
+check_restore_tmp_build_diff
+end_test