summaryrefslogtreecommitdiff
path: root/qa/160
blob: d6f6f807166daf6246453d2374f1fe8f892fd3d9 (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
#! /bin/sh
# PCP QA Test No. 160
# Exercise __pmSetClientId()
#
# Copyright (c) 2009 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!
$sudo rm -rf $tmp.*
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
rm -f $seq.full

_filter()
{
    egrep 'QA-clientid|Error|__pmSetClientId' \
    | sed -e 's/value ".* QA/value "<host> QA/' \
    | sed -e 's/\[/[ /' -e 's/]/ ]/' \
    | awk '
BEGIN		{ seq = 1 }
$1 == "inst"	{ if (seen[$3] == "") {
		    seen[$3] = "INST-" seq++
		  }
		  $5 = "\"" seen[$3] "\""
		  $3 = seen[$3]
		}
		{ print }' \
    | LC_COLLATE=POSIX sort -u
}

# real QA test starts here
src/clientid -l a bb ccc dddd eeeee ffffff ggggggg hhhhhhhh iiiiiiiii >$tmp.1 2>$tmp.2 &
pidlist="$pidlist $!"
sleep 2
src/clientid -l foo-bar-mumble >$tmp.3 2>$tmp.4 &
pidlist="$pidlist $!"
sleep 2
src/clientid -l "here is a longer string to go in the ident place holder to try things out that are not quite so short and boring" >$tmp.5 2>$tmp.6 &
pidlist="$pidlist $!"
sleep 2

kill -TERM $pidlist
wait

cat $tmp.? \
| tee $seq.full \
| _filter

# success, all done
exit