Drop unused condition check
[pcp.git] / qa / 900
blob32355a93698691880e3b74b5cfaad0b65196953d
1 #!/bin/sh
2 # PCP QA Test No. 900
3 # Test pcp(1) invokes other utilities with environment set.
5 # Copyright (c) 2014 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 status=1 # failure is the default!
17 bindir="$HOME/.pcp/bin"
18 $sudo rm -rf $tmp.* $seq.full
20 _cleanup()
22 rm -f "$bindir/pcp-env"
23 rm -rf $tmp.*
25 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # real QA test starts here
28 mkdir -p "$bindir" 2>/dev/null
29 test -d "$HOME/.pcp/bin" || _notrun "Failed making local directory: $bindir"
30 test -w "$HOME/.pcp/bin" || _notrun "Cannot write local directory: $bindir"
32 # build a sub-command for pcp(1), installed locally
33 $sudo rm -f $bindir/pcp-env
34 cat <<EOF > $bindir/pcp-env
35 #!/bin/sh
36 env | grep ^PCP_
37 EOF
38 chmod 755 "$bindir/pcp-env"
40 # compare baseline pcp.conf variables to new additions on each
41 # invocation of pcp(1) with a sub-command and the standard PCP
42 # command line options.
44 env \
45 | grep ^PCP_ \
46 | LC_COLLATE=posix sort >$tmp.baseline
48 _verify()
50 echo && echo "$1"
51 LC_COLLATE=posix sort $2 \
52 | diff $tmp.baseline - \
53 | sed \
54 -e 's/^[0-9][0-9]*a[0-9][0-9]*/added:/g'
58 pcp env > $tmp.env.none
59 _verify "no arguments" $tmp.env.none
61 pcp -A '1 hour' env > $tmp.env.align
62 _verify "align argument" $tmp.env.align
64 pcp -a archives/rattle env > $tmp.env.archive
65 _verify "archive argument" $tmp.env.archive
67 pcp -h moo.cow.com env > $tmp.env.host
68 _verify "hostname argument" $tmp.env.host
70 pcp -D TRACE_PDU env > $tmp.env.debug
71 _verify "debug argument" $tmp.env.debug
73 pcp -g env > $tmp.env.guimode
74 _verify "gui mode argument" $tmp.env.guimode
76 pcp -L env > $tmp.env.localmode
77 _verify "local mode argument" $tmp.env.localmode
79 pcp -n /pmns/file env > $tmp.env.pmns
80 _verify "namespace argument" $tmp.env.pmns
82 pcp -O '@ 1996-03-05 14:07:47 EST -1hour' env > $tmp.env.origin
83 _verify "origin argument" $tmp.env.origin
85 pcp -p 12345 env > $tmp.env.guiport
86 _verify "gui port argument" $tmp.env.guiport
88 pcp -S 'yesterday, 2am' env > $tmp.env.start
89 _verify "start time argument" $tmp.env.start
91 pcp -s 5 env > $tmp.env.samples
92 _verify "samples argument" $tmp.env.samples
94 pcp -T '@ Mar 4 13:07:47 1996' env > $tmp.env.finish
95 _verify "finish time argument" $tmp.env.finish
97 pcp -t '2.5 seconds' env > $tmp.env.samples
98 _verify "interval argument" $tmp.env.samples
100 pcp -Z UTC env > $tmp.env.timezone
101 _verify "timezone argument" $tmp.env.timezone
103 pcp -z env > $tmp.env.hostzone
104 _verify "hostzone argument" $tmp.env.hostzone
106 # success, all done
107 status=0
108 exit