blob: f9b28173438f6cd759a1c9fb0c65e1043228ed4c (
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#!/bin/sh
# PCP QA Test No. 900
# Test pcp(1) invokes other utilities with environment set.
#
# Copyright (c) 2014 Red Hat.
#
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!
bindir="$HOME/.pcp/bin"
$sudo rm -rf $tmp.* $seq.full
_cleanup()
{
rm -f "$bindir/pcp-env"
rm -rf $tmp.*
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# real QA test starts here
mkdir -p "$bindir" 2>/dev/null
test -d "$HOME/.pcp/bin" || _notrun "Failed making local directory: $bindir"
test -w "$HOME/.pcp/bin" || _notrun "Cannot write local directory: $bindir"
# build a sub-command for pcp(1), installed locally
$sudo rm -f $bindir/pcp-env
cat <<EOF > $bindir/pcp-env
#!/bin/sh
env | grep ^PCP_
EOF
chmod 755 "$bindir/pcp-env"
# compare baseline pcp.conf variables to new additions on each
# invocation of pcp(1) with a sub-command and the standard PCP
# command line options.
#
env | grep ^PCP_ > $tmp.baseline
_verify()
{
echo && echo "$1"
diff $tmp.baseline $2 | sed \
-e 's/^[0-9][0-9]*a[0-9][0-9]*/added:/g'
}
pcp env > $tmp.env.none
_verify "no arguments" $tmp.env.none
pcp -A '1 hour' env > $tmp.env.align
_verify "align argument" $tmp.env.align
pcp -a src/rattle env > $tmp.env.archive
_verify "archive argument" $tmp.env.archive
pcp -h moo.cow.com env > $tmp.env.host
_verify "hostname argument" $tmp.env.host
pcp -D TRACE_PDU env > $tmp.env.debug
_verify "debug argument" $tmp.env.debug
pcp -g env > $tmp.env.guimode
_verify "gui mode argument" $tmp.env.guimode
pcp -L env > $tmp.env.localmode
_verify "local mode argument" $tmp.env.localmode
pcp -n /pmns/file env > $tmp.env.pmns
_verify "namespace argument" $tmp.env.pmns
pcp -O '@ 1996-03-05 14:07:47 EST -1hour' env > $tmp.env.origin
_verify "origin argument" $tmp.env.origin
pcp -p 12345 env > $tmp.env.guiport
_verify "gui port argument" $tmp.env.guiport
pcp -S 'yesterday, 2am' env > $tmp.env.start
_verify "start time argument" $tmp.env.start
pcp -s 5 env > $tmp.env.samples
_verify "samples argument" $tmp.env.samples
pcp -T '@ Mar 4 13:07:47 1996' env > $tmp.env.finish
_verify "finish time argument" $tmp.env.finish
pcp -t '2.5 seconds' env > $tmp.env.samples
_verify "interval argument" $tmp.env.samples
pcp -Z UTC env > $tmp.env.timezone
_verify "timezone argument" $tmp.env.timezone
pcp -z env > $tmp.env.hostzone
_verify "hostzone argument" $tmp.env.hostzone
# success, all done
status=0
exit
|