From e96abfb81fdd69469bb2b802cdf4d68f8bc70a42 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 25 May 2017 11:53:03 +0200 Subject: [PATCH] Tweak add copyright to regression tests that do not have one --- regress/tests/2drive-offline-test | 3 + regress/tests/2media-virtual-test | 3 + regress/tests/broken-media-bug-test | 3 + regress/tests/bvfs-acl-test | 168 ++++++++++++++++++++++++ regress/tests/bvfs-cmds-test | 95 ++++++++++++++ regress/tests/bvfs-test | 4 +- regress/tests/certify-changer | 3 + regress/tests/concurrent-jobs-test | 3 + regress/tests/copy-job-test | 3 + regress/tests/crazy-smaller-vol-test | 3 + regress/tests/file-span-vol-test | 3 + regress/tests/jobmedia-bug2-test | 3 + regress/tests/maxdev-test | 5 +- regress/tests/maxuseduration-test | 3 + regress/tests/mcj-test | 3 + regress/tests/pool-attributes-test | 3 + regress/tests/restart2-job-test | 3 + regress/tests/three-pool-test | 3 + regress/tests/truncate-concurrent-test | 3 + regress/tests/vtape-round-robin-changer | 3 + 20 files changed, 316 insertions(+), 4 deletions(-) create mode 100755 regress/tests/bvfs-acl-test create mode 100755 regress/tests/bvfs-cmds-test diff --git a/regress/tests/2drive-offline-test b/regress/tests/2drive-offline-test index 9351ccf924..c5d44f7611 100755 --- a/regress/tests/2drive-offline-test +++ b/regress/tests/2drive-offline-test @@ -1,5 +1,8 @@ #!/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. # diff --git a/regress/tests/2media-virtual-test b/regress/tests/2media-virtual-test index 32ea1a7961..571c2e5767 100755 --- a/regress/tests/2media-virtual-test +++ b/regress/tests/2media-virtual-test @@ -1,5 +1,8 @@ #!/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, diff --git a/regress/tests/broken-media-bug-test b/regress/tests/broken-media-bug-test index 0c6530e5fa..4e6a887183 100644 --- a/regress/tests/broken-media-bug-test +++ b/regress/tests/broken-media-bug-test @@ -1,5 +1,8 @@ #!/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 # diff --git a/regress/tests/bvfs-acl-test b/regress/tests/bvfs-acl-test new file mode 100755 index 0000000000..47c448cbbf --- /dev/null +++ b/regress/tests/bvfs-acl-test @@ -0,0 +1,168 @@ +#!/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 <> $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 <> $conf/bconsole.conf.2 +Console { + Name = restricted-user + Password = xxx +} +EOF + +change_jobname CompressedTest $JobName +start_test + +cat <${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 <${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 diff --git a/regress/tests/bvfs-cmds-test b/regress/tests/bvfs-cmds-test new file mode 100755 index 0000000000..b266b9081f --- /dev/null +++ b/regress/tests/bvfs-cmds-test @@ -0,0 +1,95 @@ +#!/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 <$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 <$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 <$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 diff --git a/regress/tests/bvfs-test b/regress/tests/bvfs-test index 17195eec6b..ca4f515ef3 100755 --- a/regress/tests/bvfs-test +++ b/regress/tests/bvfs-test @@ -1,9 +1,7 @@ #!/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. diff --git a/regress/tests/certify-changer b/regress/tests/certify-changer index f33077633c..e1dd06d453 100755 --- a/regress/tests/certify-changer +++ b/regress/tests/certify-changer @@ -1,5 +1,8 @@ #!/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 diff --git a/regress/tests/concurrent-jobs-test b/regress/tests/concurrent-jobs-test index b5872f4ab2..420f50e061 100755 --- a/regress/tests/concurrent-jobs-test +++ b/regress/tests/concurrent-jobs-test @@ -1,5 +1,8 @@ #!/bin/sh # +# Copyright (C) 2000-2017 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# # Run two jobs at the same time # diff --git a/regress/tests/copy-job-test b/regress/tests/copy-job-test index 14a2b68b0d..da6922cb7b 100755 --- a/regress/tests/copy-job-test +++ b/regress/tests/copy-job-test @@ -1,5 +1,8 @@ #!/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. # diff --git a/regress/tests/crazy-smaller-vol-test b/regress/tests/crazy-smaller-vol-test index 7263b885b2..356b7f596a 100755 --- a/regress/tests/crazy-smaller-vol-test +++ b/regress/tests/crazy-smaller-vol-test @@ -1,5 +1,8 @@ #!/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 # # diff --git a/regress/tests/file-span-vol-test b/regress/tests/file-span-vol-test index d815cd674f..e8b6ba3e2b 100755 --- a/regress/tests/file-span-vol-test +++ b/regress/tests/file-span-vol-test @@ -1,5 +1,8 @@ #!/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 diff --git a/regress/tests/jobmedia-bug2-test b/regress/tests/jobmedia-bug2-test index f1c6e4f78a..e89201c515 100755 --- a/regress/tests/jobmedia-bug2-test +++ b/regress/tests/jobmedia-bug2-test @@ -1,5 +1,8 @@ #!/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. diff --git a/regress/tests/maxdev-test b/regress/tests/maxdev-test index b24d4bbe8a..6c4844dc0e 100755 --- a/regress/tests/maxdev-test +++ b/regress/tests/maxdev-test @@ -1,4 +1,7 @@ - #!/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 diff --git a/regress/tests/maxuseduration-test b/regress/tests/maxuseduration-test index 377f1679d7..248287abfb 100755 --- a/regress/tests/maxuseduration-test +++ b/regress/tests/maxuseduration-test @@ -1,5 +1,8 @@ #!/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 diff --git a/regress/tests/mcj-test b/regress/tests/mcj-test index e92a335e55..95695f3a1c 100755 --- a/regress/tests/mcj-test +++ b/regress/tests/mcj-test @@ -1,5 +1,8 @@ #!/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) # diff --git a/regress/tests/pool-attributes-test b/regress/tests/pool-attributes-test index baf5ae6dbd..7d0c6ed8a7 100755 --- a/regress/tests/pool-attributes-test +++ b/regress/tests/pool-attributes-test @@ -1,5 +1,8 @@ #!/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" diff --git a/regress/tests/restart2-job-test b/regress/tests/restart2-job-test index 4bdc904f6c..be9b22496c 100755 --- a/regress/tests/restart2-job-test +++ b/regress/tests/restart2-job-test @@ -1,5 +1,8 @@ #!/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. # diff --git a/regress/tests/three-pool-test b/regress/tests/three-pool-test index c8bf7ae11e..2bac855474 100755 --- a/regress/tests/three-pool-test +++ b/regress/tests/three-pool-test @@ -1,5 +1,8 @@ #!/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 diff --git a/regress/tests/truncate-concurrent-test b/regress/tests/truncate-concurrent-test index 6d022379a8..f8e3d8d15d 100755 --- a/regress/tests/truncate-concurrent-test +++ b/regress/tests/truncate-concurrent-test @@ -1,5 +1,8 @@ #!/bin/sh # +# Copyright (C) 2000-2017 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# # Test truncate command in // # # diff --git a/regress/tests/vtape-round-robin-changer b/regress/tests/vtape-round-robin-changer index d93c98e594..a677ce9ced 100755 --- a/regress/tests/vtape-round-robin-changer +++ b/regress/tests/vtape-round-robin-changer @@ -1,5 +1,8 @@ #!/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) -- 2.39.5