#!/bin/sh
#
-# Copyright (C) 2000-2015 Kern Sibbald
+# Copyright (C) 2000-2017 Kern Sibbald
# License: BSD 2-Clause; see file LICENSE-FOSS
-#
-
#
#
TestName="action-on-purge-test"
check_for_zombie_jobs storage=File
print_debug "Check all media"
-perl -Mscripts::functions -e 'foreach $i (1..5){check_min_volume_size(4096,"TestVolume00$i")}'
-
-if [ $? != 0 ]; then
- print_debug `ls -l $tmp`
- print_debug "Initialization problem"
- estat=2
-fi
+for i in 1 2 3 4 5 ; do
+ size=`du -b $tmp/TestVolume00$i|cut -f1`
+ if test $size -lt 5000 ; then
+ print_debug "ERROR 2: Volume TestVolum00$i is too small $size"
+ ls -l $tmp/TestVolume00$i
+ estat=2
+ fi
+done
echo "purge volume=TestVolume001 action storage=File" > $tmp/bconcmds
run_bconsole
-perl -Mscripts::functions -e '
-check_min_volume_size(4096, "TestVolume002","TestVolume003","TestVolume004","TestVolume005");
-check_max_volume_size(4096, "TestVolume001")'
-
-if [ $? != 0 ]; then
- print_debug `ls -l $tmp`
- ls -l $tmp
- estat=2
-fi
+for i in 2 3 4 5 ; do
+ size=`du -b $tmp/TestVolume00$i|cut -f1`
+ if test $size -lt 5000 ; then
+ print_debug "ERROR 3: Volume TestVolum00$i is too small $size"
+ ls -l $tmp/TestVolume00$i
+ estat=3
+ fi
+done
+for i in 1 ; do
+ size=`du -b $tmp/TestVolume00$i|cut -f1`
+ if test $size -gt 5000 ; then
+ print_debug "ERROR 4: Volume TestVolum00$i is not truncated (too big) $size"
+ ls -l $tmp/TestVolume00$i
+ estat=4
+ fi
+done
echo "purge volume action storage=File" > $tmp/bconcmds
run_bconsole
-perl -Mscripts::functions -e '
-check_min_volume_size(4096, "TestVolume002", "TestVolume005");
-check_max_volume_size(4096, "TestVolume001", "TestVolume003", "TestVolume004")'
-
-if [ $? != 0 ]; then
- print_debug `ls -l $tmp`
- ls -l $tmp
- estat=2
-fi
-
+for i in 2 5 ; do
+ size=`du -b $tmp/TestVolume00$i|cut -f1`
+ if test $size -lt 5000 ; then
+ print_debug "ERROR 5: Volume TestVolum00$i is too small $size"
+ ls -l $tmp/TestVolume00$i
+ estat=5
+ fi
+done
+for i in 1 3 4 ; do
+ size=`du -b $tmp/TestVolume00$i|cut -f1`
+ if test $size -gt 5000 ; then
+ print_debug "ERROR 6: Volume TestVolum00$i is not truncated (too big) $size"
+ ls -l $tmp/TestVolume00$i
+ estat=6
+ fi
+done
cat <<END_OF_DATA > $tmp/bconcmds
@#########################################################