summaryrefslogtreecommitdiff
path: root/qa/342
blob: 4a9c8b798ff7bf89b6b7258f62717ed2b446bccb (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
#!/bin/sh
# PCP QA Test No. 342
# dbpmda with new open socket command
#
# Copyright (c) 2010 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=0	# success is the default!
username=`id -u -n`
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

_await_file()
{
    file=$1
    done=0

    for t in 0.01 0.02 0.05 0.1 0.5 1 2
    do
	pmsleep $t
	[ -e "$file" ] && return
    done
    echo "Giving up waiting for file $file to appear"
    exit 1
}

_filter()
{
    _filter_dumpresult \
    | sed -e "s;$tmp.socket;MYSOCKET;"
}

pmdaargs="-d 29 -l $tmp.log -u $tmp.socket"
id pcp >/dev/null 2>&1 && pmdaargs="$pmdaargs -U $username"

# real QA test starts here
$PCP_PMDAS_DIR/sample/pmdasample $pmdaargs &
_await_file $tmp.socket

cat <<End-of-File | dbpmda -ie 2>&1 | _filter
open socket $tmp.socket
getdesc on
fetch sample.colour
desc sample.colour
profile 29.1 none
profile 29.1 add 2
fetch sample.colour
End-of-File

# success, all done
exit