]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: Add regress script for GPFS code
authorRadoslaw Korzeniewski <radekk@inteos.pl>
Wed, 15 Jul 2020 15:08:15 +0000 (17:08 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 1 Mar 2022 14:36:17 +0000 (15:36 +0100)
regress/.gitignore
regress/prototype.conf
regress/scripts/do_sed
regress/scripts/gpfs-bacula-dir.conf.in [new file with mode: 0644]
regress/scripts/gpfs-copy-confs [new file with mode: 0755]
regress/scripts/regress-utils.sh
regress/tests/gpfs-acl-test [new file with mode: 0755]

index 084250c3593c32f7ed90596e272f576693c2046b..6ee40cacc7ae023fd2e0a9eef3604ebedc223b63 100644 (file)
@@ -43,4 +43,9 @@ scripts/prepare-two-tapes
 scripts/regress-config
 scripts/update-ctest
 scripts/mtx-changer
+<<<<<<< HEAD
+=======
+scripts/k8s_backend
+scripts/bacula-dir.conf.gpfs
+>>>>>>> e694fcf7a1... regress: Add regress script for GPFS code
 /tmp2/
index 087b40f28034ad70392d93632aea7b0ee3ec362e..5ca729ae2cb7c4509de52cfee7f931a405d9b3f1 100644 (file)
@@ -203,3 +203,9 @@ REMOTE_STORE_ADDR="zzzz"
 # you can use: unix:///var/run/docker.sock
 # to simulate remote operation with local socket
 #PLUGDOCKERHOST="tcp://10.0.0.1:2376"
+
+#
+# This is a config variable for GPFS regression tests
+# It should point to the mounted GPFS
+#
+#GPFSDIR=/gpfs
index 23af678a9c805f1c6231fd2da75d708bcfe1731e..46caccf6f092e7f5157b1b89389c6dcc74386889 100755 (executable)
@@ -38,6 +38,7 @@ sed -f ${out} ${rscripts}/migrate-bacula-sd.conf.in >${rscripts}/migrate-bacula-
 sed -f ${out} ${rscripts}/virtualfull-extreme-bacula-dir.conf.in >${rscripts}/virtualfull-extreme-bacula-dir.conf
 sed -f ${out} ${rscripts}/test-console.conf.in >${rscripts}/test-console.conf
 sed -f ${out} ${rscripts}/crypto-bacula-fd.conf.in >${rscripts}/crypto-bacula-fd.conf
+sed -f ${out} ${rscripts}/gpfs-bacula-dir.conf.in >${rscripts}/gpfs-bacula-dir.conf
 sed -f ${out} ${rscripts}/bacula-dir-tape.conf.in >${rscripts}/bacula-dir-tape.conf
 sed -f ${out} ${rscripts}/bacula-dir-2client.conf.in >${rscripts}/bacula-dir-2client.conf
 sed -f ${out} ${rscripts}/bacula-dir-2media-virtual.conf.in >${rscripts}/bacula-dir-2media-virtual.conf
@@ -95,7 +96,7 @@ if test -f ${conf}/bacula-sd.conf ; then
   cp ${conf}/bacula-sd.conf ${tmp}/bac$$
   sed "s% /tmp%${tmp}%g" ${tmp}/bac$$ >${conf}/bacula-sd.conf
 fi
-chmod 755 ${rscripts}/cleanup-*tape ${rscripts}/cleanup-*drive ${rscripts}/prepare-two-tapes 
+chmod 755 ${rscripts}/cleanup-*tape ${rscripts}/cleanup-*drive ${rscripts}/prepare-two-tapes
 rm -f ${tmp}/tmp/bac$$
 cp ${scripts}/mtx-changer ${tmp}/bac$$
 sed "s%^MTX.*$%MTX=${AUTOCHANGER_PATH}%g" ${tmp}/bac$$ >${scripts}/mtx-changer
diff --git a/regress/scripts/gpfs-bacula-dir.conf.in b/regress/scripts/gpfs-bacula-dir.conf.in
new file mode 100644 (file)
index 0000000..44df87a
--- /dev/null
@@ -0,0 +1,112 @@
+#
+# Default Bacula Director Configuration file
+#
+#  The only thing that MUST be changed is to add one or more
+#   file or directory names in the Include directive of the
+#   FileSet resource.
+#
+#  For Bacula release 1.39.27 (24 October 2006) -- debian testing/unstable
+#
+#  You might also want to change the default email address
+#   from root to your address.  See the "mail" and "operator"
+#   directives in the Messages resource.
+#
+
+Director {                            # define myself
+  Name = @hostname@-dir
+  DIRPort = @dirport@                # where we listen for UA connections
+  QueryFile = "@scriptdir@/query.sql"
+  WorkingDirectory = "@working_dir@"
+  PidDirectory = "@piddir@"
+  SubSysDirectory = "@subsysdir@"
+  Maximum Concurrent Jobs = 4
+  Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3"         # Console password
+  Messages = Standard
+}
+
+JobDefs {
+  Name = "DefaultJob"
+  Type = Backup
+  Level = Incremental
+  Client = @hostname@-fd
+  FileSet = GPFS
+  Storage = File
+  Messages = Standard
+  Pool = Default
+  Priority = 10
+  Maximum Concurrent Jobs = 16
+}
+
+FileSet {
+ Name = GPFS
+ Include {
+   Options {
+    aclsupport = yes
+   }
+   File = <@tmpdir@/file-list
+ }
+}
+
+Job {
+  Name = backup
+  Accurate = yes
+  JobDefs = DefaultJob
+}
+
+# Standard Restore template, to be changed by Console program
+Job {
+  Name = "RestoreFiles"
+  Type = Restore
+  Client=@hostname@-fd
+  FileSet= GPFS
+  Storage = File
+  Messages = Standard
+  Pool = Default
+  Where = @tmpdir@/bacula-restores
+}
+
+# Client (File Services) to backup
+Client {
+  Name = @hostname@-fd
+  Address = @hostname@
+  FDPort = @fdport@
+  Catalog = MyCatalog
+  Password = "xevrjURYoCHhn26RaJoWbeWXEY/a3VqGKp/37tgWiuHc"          # password for FileDaemon
+  File Retention = 30d                # 30 days
+  Job Retention = 180d                # six months
+  AutoPrune = yes                     # Prune expired Jobs/Files
+  Maximum Concurrent Jobs = 4
+}
+
+# Definiton of file storage device
+Storage {
+  Name = File
+  Address = @hostname@                # N.B. Use a fully qualified name here
+  SDPort = @sdport@
+  Password = "ccV3lVTsQRsdIUGyab0N4sMDavui2hOBkmpBU0aQKOr9"
+  Device = FileStorage
+  Media Type = File
+  Maximum Concurrent Jobs = 4
+}
+
+# Generic catalog service
+Catalog {
+  Name = MyCatalog
+  @libdbi@
+  dbname = @db_name@; user = @db_user@; password = "@db_password@"
+}
+
+Messages {
+  Name = Standard
+  console = all, !skipped, saved
+  catalog = all, !skipped
+}
+
+# Default pool definition
+Pool {
+  Name = Default
+  Pool Type = Backup
+  Recycle = yes                       # Bacula can automatically recycle Volumes
+  AutoPrune = yes                     # Prune expired volumes
+  Volume Retention = 365d             # one year
+}
diff --git a/regress/scripts/gpfs-copy-confs b/regress/scripts/gpfs-copy-confs
new file mode 100755 (executable)
index 0000000..9a0ce55
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+. scripts/functions
+/bin/cp -f ${rscripts}/gpfs-bacula-dir.conf ${conf}/bacula-dir.conf
+/bin/cp -f ${rscripts}/test-bacula-sd.conf ${conf}/bacula-sd.conf
+/bin/cp -f ${rscripts}/test-bacula-fd.conf ${conf}/bacula-fd.conf
+/bin/cp -f ${rscripts}/test-console.conf ${conf}/bconsole.conf
+/bin/cp -f ${rscripts}/test-console.conf ${conf}/bat.conf
+
+${rscripts}/set_tape_options
index a4a4665f83224f7fc0f013bf4fbc9a7dbb40c8f9..154ade1484b6ceff8902861774cd7f43dc74fecf 100644 (file)
@@ -65,7 +65,9 @@ do_regress_unittest()
 tname=$1
 tdirloc=$2
 make -C ${src}/${tdirloc} ${tname}
-${src}/${tdirloc}/${tname}
+if test $? -eq 0; then
+   ${src}/${tdirloc}/${tname}
+fi
 exit $?
 }
 
@@ -82,7 +84,7 @@ ltest=$1
 blevel="full"
 if [ "x$2" != "x" ]
 then
-        blevel=$2
+   blevel=$2
 fi
 printf "     backup test${ltest} ... "
 cat << END_OF_DATA >${tmp}/bconcmds
@@ -144,7 +146,7 @@ lpath=$2
 lplug=$LPLUG
 if [ "x$3" != "x" ]
 then
-        lplug=$3
+   lplug=$3
 fi
 printf "     listing test${ltest} ... "
 cat << END_OF_DATA >${tmp}/bconcmds
diff --git a/regress/tests/gpfs-acl-test b/regress/tests/gpfs-acl-test
new file mode 100755 (executable)
index 0000000..c80dac1
--- /dev/null
@@ -0,0 +1,164 @@
+#!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
+#
+# Run a backup of the GPFS directory with some acls then restore it.
+# The test requires $GPFSDIR env variable set which will points to gpfs mounted filesystem
+#
+TestName="gpfs-acl-test"
+JobName=backup
+. scripts/functions
+
+#
+# See if the right software is installed.
+#
+if test x$GPFSDIR = x; then
+   echo "$TestName skipped: \$GPFSDIR not set but required"
+   exit 0
+fi
+
+if test x`uname -s` != xLinux; then
+   echo "$TestName skipped: test is supported on Linux only"
+   exit 0
+fi
+
+mmgetacl $GPFSDIR 2>&1 >/dev/null
+if test  $? -ne 0; then
+   echo "$TestName skipped: mmgetacl not installed"
+   exit 0
+fi
+
+scripts/cleanup
+scripts/gpfs-copy-confs
+
+d=$GPFSDIR/acl
+rm -rf $d
+mkdir -p $d
+mkdir -p $d/acl-dir
+cp ${cwd}/bin/bconsole $d/bconsole
+cp ${cwd}/bin/bconsole $d/other
+
+cat > $d/acl.param.acl << EOD
+#owner:root
+#group:root
+user::rwxc
+group::rwx-
+other::--x-
+mask::rwxc
+user:bacula:r-xc
+group:sys:rwx-
+group:adm:rw--
+EOD
+
+cat > $d/acl.param.nfs4 << EOD
+#NFSv4 ACL
+#owner:root
+#group:root
+special:owner@:rwxc:allow
+ (X)READ/LIST (X)WRITE/CREATE (X)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL  (X)READ_ATTR  (X)READ_NAMED
+ (-)DELETE    (-)DELETE_CHILD (X)CHOWN        (X)EXEC/SEARCH (X)WRITE_ACL (X)WRITE_ATTR (X)WRITE_NAMED
+
+user:bacula:-w--:deny
+ (-)READ/LIST (X)WRITE/CREATE (X)APPEND/MKDIR (-)SYNCHRONIZE (-)READ_ACL  (-)READ_ATTR  (-)READ_NAMED
+ (-)DELETE    (X)DELETE_CHILD (-)CHOWN        (-)EXEC/SEARCH (-)WRITE_ACL (X)WRITE_ATTR (-)WRITE_NAMED
+
+user:bacula:r-xc:allow
+ (X)READ/LIST (-)WRITE/CREATE (-)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL  (X)READ_ATTR  (X)READ_NAMED
+ (-)DELETE    (-)DELETE_CHILD (-)CHOWN        (X)EXEC/SEARCH (X)WRITE_ACL (-)WRITE_ATTR (-)WRITE_NAMED
+
+special:group@:rwx-:allow
+ (X)READ/LIST (X)WRITE/CREATE (X)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL  (X)READ_ATTR  (X)READ_NAMED
+ (-)DELETE    (-)DELETE_CHILD (-)CHOWN        (X)EXEC/SEARCH (-)WRITE_ACL (-)WRITE_ATTR (-)WRITE_NAMED
+
+group:sys:rwx-:allow
+ (X)READ/LIST (X)WRITE/CREATE (X)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL  (X)READ_ATTR  (X)READ_NAMED
+ (-)DELETE    (-)DELETE_CHILD (-)CHOWN        (X)EXEC/SEARCH (-)WRITE_ACL (-)WRITE_ATTR (-)WRITE_NAMED
+
+group:adm:rw--:allow
+ (X)READ/LIST (X)WRITE/CREATE (X)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL  (X)READ_ATTR  (X)READ_NAMED
+ (-)DELETE    (-)DELETE_CHILD (-)CHOWN        (-)EXEC/SEARCH (-)WRITE_ACL (-)WRITE_ATTR (-)WRITE_NAMED
+
+group:adm:--xc:deny
+ (-)READ/LIST (-)WRITE/CREATE (-)APPEND/MKDIR (-)SYNCHRONIZE (-)READ_ACL  (-)READ_ATTR  (-)READ_NAMED
+ (-)DELETE    (X)DELETE_CHILD (-)CHOWN        (X)EXEC/SEARCH (X)WRITE_ACL (X)WRITE_ATTR (-)WRITE_NAMED
+
+special:everyone@:--x-:allow
+ (-)READ/LIST (-)WRITE/CREATE (-)APPEND/MKDIR (X)SYNCHRONIZE (X)READ_ACL  (X)READ_ATTR  (X)READ_NAMED
+ (-)DELETE    (-)DELETE_CHILD (-)CHOWN        (X)EXEC/SEARCH (-)WRITE_ACL (-)WRITE_ATTR (-)WRITE_NAMED
+
+EOD
+
+mmputacl -d -i $d/acl.param.acl $d/acl-dir 2>/dev/null 1>/dev/null
+mmputacl -i $d/acl.param.acl $d/bconsole 2>/dev/null 1>/dev/null
+mmputacl -i $d/acl.param.nfs4 $d/other 2>/dev/null 1>/dev/null
+
+cp ${cwd}/bin/bconsole $d/acl-dir/bconsole
+
+cat > ${tmp}/file-list << EOD
+$d/acl-dir
+$d/bconsole
+$d/other
+EOD
+
+change_jobname backup $JobName
+start_test
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+@$out ${cwd}/tmp/log1.out
+label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
+setdebug level=500 trace=1 client
+setdebug level=500 trace=1 director
+@#setdebug level=300 trace=1 storage=File1
+run job=$JobName yes
+wait
+messages
+@#
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+restore where=${d}/bacula-restores select all done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+# create a file list for backup
+
+run_bacula
+check_for_zombie_jobs storage=File1
+stop_bacula
+
+# now get restored acls
+mmgetacl -d $d/acl-dir -o ${tmp}/acl-dir.default.acl 2>/dev/null 1>/dev/null
+mmgetacl $d/bconsole -o ${tmp}/bconsole.access.acl 2>/dev/null 1>/dev/null
+mmgetacl $d/other -o ${tmp}/other.access.nfs4 2>/dev/null 1>/dev/null
+
+diff -u ${tmp}/acl-dir.default.acl $d/acl.param.acl
+if [ $? -ne 0 ]; then
+   rstat=1
+fi
+
+diff -u ${tmp}/bconsole.access.acl $d/acl.param.acl
+if [ $? -ne 0 ]; then
+   rstat=1
+fi
+
+diff -u ${tmp}/other.access.nfs4 $d/acl.param.nfs4
+if [ $? -ne 0 ]; then
+   rstat=1
+fi
+
+check_two_logs
+# check_restore_diff
+
+if [ x$REGRESS_DEBUG != x ]; then
+  rm -rf $d
+fi
+
+end_test