summaryrefslogtreecommitdiff
path: root/qa/897
blob: 754d9ee044be25179f8b2d6584ddd027e6251607 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
# PCP QA Test No. 897
# pmlc/pmlogger access control compatibility
#
# Copyright (c) 2014 Ken McDonell.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

status=1	# failure is the default!
$sudo rm -rf $tmp.* $seq.full
trap "cd $here; $sudo rm -rf $tmp.*; exit \$status" 0 1 2 3 15

hostname=`hostname`

_filter()
{
    sed \
	-e "s/^connect $pid/connect QA_LOGGER_PID/" \
	-e "s/^pmlogger \[$pid]/pmlogger [QA_LOGGER_PID]/" \
	-e "s/from host $hostname/from host HOST/" \
	-e "s/\(The following pmloggers .* on \)$hostname/\1HOST/" \
	-e '/primary (/s/([0-9][0-9]*).*/(LOGGER_PID) .../' \
	-e '/^PMCD host/s/\(   *\).*/\1HOST/' \
	-e 's/^\(log started  *\).*/\1DATESTAMP/' \
	-e 's/^\(last log entry  *\).*/\1DATESTAMP/' \
	-e '/^current time/s/\(   *\).*/\1DATE/' \
	-e '/^log volume/s/\(   *\).*/\1NUMBER/' \
	-e '/^log size/s/\(   *\).*/\1NUMBER/' \

}

# real QA test starts here
for acl in enquire advisory mandatory \
    'enquire,advisory' 'enquire,mandatory' 'advisory,mandatory' \
    'enquire,advisory,mandatory'
do
    echo | tee -a $seq.full
    echo "=== allow * : $acl ===" | tee -a $seq.full
    cat <<End-of-File >$tmp.config
log mandatory on once { sample.bin }

[access]
disallow * : all;
allow localhost : $acl;
End-of-File

    $sudo rm -f $tmp.[0-9]* $tmp.index $tmp.meta $tmp.log
    # Note: _start_up_pmlogger returns with $pid set
    #
    _start_up_pmlogger -L -c $tmp.config -l $tmp.log $tmp
    _wait_for_pmlogger $pid $tmp.log
    cat <<End-of-File | pmlc -e 2>&1 | tee -a $seq.full | _filter
show loggers
connect $pid
status
query { sample.colour sample.long.one }
# need mandatory
flush
new volume
log advisory on 5sec sample.long.one
log mandatory off sample.colour
# check
query { sample.colour sample.long.one }
End-of-File
    $sudo kill -TERM $pid
    wait
    cat $tmp.log >>$seq.full
done

# success, all done
status=0

exit