1#!/bin/sh
2#
3#  Test MaxRunTime
4#  Note: this test doesn't really do anything yet. It is used in helping
5#    to duplicate bug #1268, but so far not successful ...
6#
7
8TestName="maxruntime-test"
9JobName=backup
10
11. scripts/functions
12
13copy_test_confs
14
15cp -f ${cwd}/scripts/bareos-dir.conf.maxruntime ${cwd}/bin/bareos-dir.conf
16WHEN=`date '+%Y-%m-%d %H:%M:%S'`
17
18# Directory to backup.
19# This directory will be created by setup_data().
20BackupDirectory="${tmp}/data"
21
22# Use a tgz to setup data to be backed up.
23# Data will be placed at "${tmp}/data/".
24setup_data data/small.tgz
25
26# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
27echo "${BackupDirectory}" >${tmp}/file-list
28
29
30start_test
31
32cat <<END_OF_DATA >${cwd}/tmp/bconcmds
33@$out ${cwd}/tmp/log1.out
34messages
35label volume=TestVolume001 pool=PoolA
36label volume=TestVolume002 pool=Default
37mount
38wait
39messages
40setdebug level=60 dir
41run job=RUN_MAXRUNTIME pool=PoolA yes
42wait
43messages
44st dir
45quit
46END_OF_DATA
47
48(mkfifo ${cwd}/tmp/fifo
49 mkfifo ${cwd}/tmp/fifo2
50 mkfifo ${cwd}/tmp/fifo3) 2> /dev/null
51
52run_bareos
53check_for_zombie_jobs storage=File
54stop_bareos
55
56dstat=0
57bstat=0
58rstat=0
59touch ${cwd}/tmp/log2.out
60
61grep -e ': Fatal error: Max run time exceeded. Job canceled.' ${cwd}/tmp/log1.out >/dev/null
62if [ $? -eq 0 ]
63then
64    [ "$debug" = 1 ] && echo MAXRUNTIME ok
65else
66   echo "MAXRUNTIME in error"
67   bstat=1
68fi
69
70end_test
71