#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Set prefer mounted volumes to no to try to force use of
# the drive swap code.
#
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Test running a Virtual disk changer with two Media Types
# and two different Archive directories
# This tests bug #8033 where a Volume is not truncated,
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Copyright (C) 2000-2015 Kern Sibbald
# License: BSD 2-Clause; see file LICENSE-FOSS
#
--- /dev/null
+#!/bin/sh
+#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+#
+# Run a simple backup of the Bacula build directory then create some
+# new files, do an Incremental and restore those two files.
+# test the bvfs interface
+#
+TestName="bvfs-acl-test"
+JobName=Incremental
+. scripts/functions
+
+${rscripts}/cleanup
+${rscripts}/copy-test-confs
+echo "${tmpsrc}" >${tmp}/file-list
+echo "${cwd}/build" >> ${tmp}/file-list
+
+mkdir -p ${tmpsrc}
+cp -p ${src}/src/dird/*.c ${tmpsrc}
+cd ${tmp}
+echo "${tmpsrc}/ficheriro1.txt" >restore-list
+echo "${tmpsrc}/ficheriro2.txt" >>restore-list
+cd ${cwd}
+
+# Create a new client
+$bperl -e "print get_resource('$conf/bacula-dir.conf', 'Client', '$HOST-fd')" | sed "s/$HOST-fd/$HOST-fd2/" >> $conf/bacula-dir.conf
+$bperl -e "print get_resource('$conf/bacula-dir.conf', 'Client', '$HOST-fd')" | sed "s/$HOST-fd/$HOST-fd3/" >> $conf/bacula-dir.conf
+
+cat <<EOF >> $conf/bacula-dir.conf
+Console {
+ Name = restricted-user
+ Password = "xxx"
+ JobACL = NightlySave, $JobName
+ ClientACL = $HOST-fd
+ PoolACL = Default
+ FileSetACL = CompressedSet
+ CatalogACL = *all*
+ CommandACL = show, .jobs, messages, .pool, .storage, .client, .fileset, .bvfs_get_jobids, .bvfs_restore, .bvfs_lsdirs, .bvfs_update, reload, quit, .bvfs_lsfiles
+ WhereACL = "/"
+ DirectoryAcl = *all*
+}
+EOF
+
+cp $conf/bconsole.conf $conf/bconsole.conf.2
+
+cat <<EOF >> $conf/bconsole.conf.2
+Console {
+ Name = restricted-user
+ Password = xxx
+}
+EOF
+
+change_jobname CompressedTest $JobName
+start_test
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+label storage=File volume=TestVolume001
+label storage=File volume=TestVolume00
+run job=$JobName client=$HOST-fd yes
+wait
+messages
+run job=$JobName client=$HOST-fd2 yes
+wait
+messages
+run job=$JobName client=$HOST-fd3 yes
+wait
+messages
+run job=NightlySave client=$HOST-fd yes
+wait
+messages
+@exec "touch ${tmpsrc}/fic1"
+run job=$JobName client=$HOST-fd2 yes
+wait
+messages
+run job=$JobName client=$HOST-fd3 yes
+wait
+messages
+run job=$JobName client=$HOST-fd yes
+wait
+messages
+run job=NightlySave client=$HOST-fd yes
+wait
+messages
+.bvfs_update
+@$out $tmp/out10.log
+.bvfs_get_jobids client=$HOST-fd
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File $HOST-fd
+
+cat << EOF > $tmp/cmd
+@$out $tmp/out10.log
+.bvfs_get_jobids client=$HOST-fd
+.bvfs_lsfiles jobid=1 path=${tmpsrc}/ filename=dird_conf.c
+@$out $tmp/out11.log
+.bvfs_get_jobids client=$HOST-fd2
+.bvfs_lsfiles jobid=2 path=${tmpsrc}/ filename=dird_conf.c
+@$out $tmp/out12.log
+.bvfs_get_jobids client=$HOST-fd3
+.bvfs_lsfiles jobid=3 path=${tmpsrc}/ filename=dird_conf.c
+EOF
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+reload
+END_OF_DATA
+
+$bin/bconsole -c $conf/bconsole.conf.2 < $tmp/cmd
+
+sed -i "s/out1/out2/" $tmp/cmd
+sed -i "s/ClientACL = $HOST-fd/ClientACL = $HOST-fd2/" $conf/bacula-dir.conf
+
+run_bconsole
+
+$bin/bconsole -c $conf/bconsole.conf.2 < $tmp/cmd
+
+sed -i "s/out2/out3/" $tmp/cmd
+sed -i "s/ClientACL = $HOST-fd2/ClientACL = $HOST-fd3/" $conf/bacula-dir.conf
+
+run_bconsole
+
+$bin/bconsole -c $conf/bconsole.conf.2 < $tmp/cmd
+
+stop_bacula
+
+grep -E "\s1\s.*dird_conf.c" $tmp/out10.log > /dev/null
+if [ $? -ne 0 ]; then
+ print_debug "ERROR: should find dird_conf.c for jobid 1 in out10.log"
+ estat=1
+fi
+
+grep -E "\s[32]\s.*dird_conf.c" $tmp/out11.log $tmp/out12.log > /dev/null
+if [ $? -eq 0 ]; then
+ print_debug "ERROR: should not find dird_conf.c for jobid 2 or 3 in out10.log or out11.log"
+ estat=2
+fi
+
+grep -E "\s2\s.*dird_conf.c" $tmp/out21.log > /dev/null
+if [ $? -ne 0 ]; then
+ print_debug "ERROR: should find dird_conf.c for jobid 2 in out21.log"
+ estat=3
+fi
+
+grep -E "\s[31]\s.*dird_conf.c" $tmp/out20.log $tmp/out22.log > /dev/null
+if [ $? -eq 0 ]; then
+ print_debug "ERROR: should not find dird_conf.c for jobid 3 or 1 in out20.log or out22.log"
+ estat=4
+fi
+
+grep -E "\s3\s.*dird_conf.c" $tmp/out32.log > /dev/null
+if [ $? -ne 0 ]; then
+ print_debug "ERROR: should find dird_conf.c for jobid 3 in out32.log"
+ estat=5
+fi
+
+grep -E "\s[21]\s.*dird_conf.c" $tmp/out31.log $tmp/out30.log > /dev/null
+if [ $? -eq 0 ]; then
+ print_debug "ERROR: should not find dird_conf.c for jobid 2 or 1 in out31.log or out30.log"
+ estat=6
+fi
+
+end_test
--- /dev/null
+#!/bin/sh
+#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+# Run a simple backup of the Bacula build directory then create some
+# new files, do an Incremental and restore those two files.
+# test the bvfs interface
+#
+TestName="bvfs-cmds-test"
+JobName=Incremental
+. scripts/functions
+
+${rscripts}/cleanup
+${rscripts}/copy-test-confs
+echo "${tmpsrc}" >${tmp}/file-list
+
+mkdir -p $tmpsrc
+cp -p $src/src/dird/*.c $tmpsrc
+
+change_jobname CompressedTest $JobName
+start_test
+
+$bperl -e 'add_attribute("$conf/bacula-dir.conf", "ClientRunBeforeJob", "sleep 2", "Job")'
+
+cat <<END_OF_DATA >$tmp/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+label storage=File volume=TestVolume001
+run job=$JobName yes
+wait
+@exec "touch $tmpsrc/dird.c"
+run job=$JobName yes
+wait
+@exec "touch $tmpsrc/ua_cmds.c"
+run job=$JobName yes
+wait
+@exec "touch $tmpsrc/ua_dotcmds.c"
+run job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+
+cat <<EOF >$tmp/bconcmds
+@$out /dev/null
+use MyCatalog
+@$out $tmp/log0.out
+sql
+SELECT JobId, StartTime, EndTime FROM Job;
+
+EOF
+
+run_bconsole
+
+start=`perl -ne '/(\d)\s+\|\s+([0-9 :-]+?)\s*\|/ && ($1 == 2) && print $2' $tmp/log0.out`
+
+cat <<EOF >$tmp/bconcmds
+@$out /dev/null
+use MyCatalog
+@$out $tmp/log3.out
+.bvfs_get_jobids client=$CLIENT
+@$out $tmp/log4.out
+.bvfs_get_jobids client=$CLIENT count
+@$out $tmp/log5.out
+.bvfs_get_jobids client=$CLIENT count limit=2
+@$out $tmp/log6.out
+.bvfs_get_jobids client=$CLIENT count start="$start"
+@$out $tmp/log7.out
+.bvfs_get_jobids client=$CLIENT count end="$start"
+EOF
+
+run_bconsole
+
+estat=0
+grep '^1,2,3,4$' $tmp/log3.out >/dev/null # All jobids
+estat=`expr $estat + $?`
+grep '^4$' $tmp/log4.out >/dev/null # Number of jobs
+estat=`expr $estat + $?`
+grep '^2$' $tmp/log5.out >/dev/null # with a limit
+estat=`expr $estat + $?`
+grep '^3$' $tmp/log6.out >/dev/null # with a filter on the date
+estat=`expr $estat + $?`
+grep '^2$' $tmp/log7.out >/dev/null # with a filter on the date
+estat=`expr $estat + $?`
+
+stop_bacula
+touch $tmp/log2.out
+check_two_logs
+
+end_test
#!/bin/sh
#
-# Copyright (C) 2000-2015 Kern Sibbald
+# Copyright (C) 2000-2017 Kern Sibbald
# License: BSD 2-Clause; see file LICENSE-FOSS
-#
-
#
# Run a simple backup of the Bacula build directory then create some
# new files, do an Incremental and restore those two files.
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Script to automate hardware certification
# This script assumes that everything is in regress/bin and that
# you have an autochanger
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Run two jobs at the same time
#
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Run a simple backup of the Bacula build directory then copy it
# to another device.
#
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# A shell and stripped down version version of the crazy-small-volume-test.py
#
#
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Run a simple backup of a big file but
# split the archive into four volumes, two of which are
# totally full. I.e. make sure that bsr selects all tapes
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# The script is writing simultaneously (20 jobs) on the same device
# Normally each job will have to generate many JobMedia. Let see if
# all JobMedia records are fine.
- #!/bin/sh
+#!/bin/sh
+#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
#
# Run backups with dummy tape driver
# This test setups an Autochanger with 80 slots
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Run four jobs at the same time, with four Volumes, but set
# Maximum Job Volumes = 1 on each of the Volumes. Note,
# Volume 2 will probably have two jobs on it. Something to
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Run a simple backup of the Bacula build directory and see
# if bacula is respecting the maximum concurrent job (MJC)
#
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# See if Pool/Media attributes are correctly handled
#
TestName="pool-attributes-test"
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Run a backup of the build directory but force it to have
# a comm error, and check that it restarts correctly.
#
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Run a simple backup of the Bacula build directory. Create three
# tapes, each in a different pool, then run two jobs both of which
# want the tape that is not loaded. Note, they both have
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Test truncate command in //
#
#
#!/bin/sh
#
+# Copyright (C) 2000-2017 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
# Run backups with dummy tape driver
# This test setups an Autochanger with 80 slots
# and 5 drives (3 LTO3 and 2 LTO1)