File: 1423

package info (click to toggle)
pcp 7.0.5-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,916 kB
  • sloc: ansic: 1,478,844; sh: 177,285; xml: 160,462; cpp: 83,809; python: 24,349; perl: 18,303; yacc: 6,877; lex: 2,864; makefile: 2,694; awk: 165; fortran: 60; java: 52
file content (79 lines) | stat: -rwxr-xr-x 2,068 bytes parent folder | download
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
#! /bin/sh
# PCP QA Test No. 1423
# checks basic pcp2spark functionality
#
# Copyright (c) 2018 Red Hat
#
seq=`basename $0`
echo "QA output created by $seq"

. ./common.python

$python -c "from pcp import pmapi" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "python pcp pmapi module not installed"
which nc >/dev/null 2>&1 || _notrun "nc binary not installed"
which pcp2spark >$seq_full 2>&1 || _notrun "pcp2spark not installed"

port=44325
$PCP_BINADM_DIR/telnet-probe -c localhost $port \
       && _notrun "Someone already listening on typical pcp2spark $port"

signal=$PCP_BINADM_DIR/pmsignal
status=1       # failure is the default!

trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

_filter_pcp2spark()
{
    # deal with lack of sensible rounding in some Python variants
    #
    sed \
	-e 's/ 5587.42000000[0-6]*/ 5587.42/' \
	-e 's/ 3029.03099999[5-9]*/ 3029.031/' \
	   -e 's/ 0.08999999[5-9]*/ 0.09/' \
	   -e 's/ 0.08000000[0-6]*/ 0.08/' \
      -e 's/ 781261.93799999[5-9]*/ 781261.938/' \
        -e 's/ 2723.43699999[5-9]*/ 2723.437/' \
	   -e 's/ 9.99900000[0-6]*/ 9.999/' \
	-e 's/ 2800.10899999[5-9]*/ 2800.109/' \
    # end
}

pcp2spark="$python `which pcp2spark`"

echo "=== pcp2spark archive replay session ===" | tee -a $seq_full
$pcp2spark -a $here/archives/rep -I "" >$tmp.p2s.out 2>$tmp.p2s.err &
# the 2 sleeps below are something of a hack ... if pcp2spark does
# not get going, then we risk the nc being killed before the socket
# has been drained, which leaves pcp2spark hung and the QA test
# never finishes
#
sleep 3
nc localhost $port >$tmp.nc.out 2>$tmp.nc.err &
pid=$!
sleep 2
$signal $pid >>$seq_full 2>&1
wait
# some nc(1) variants chatter a bit, filter out lines like
# nc: using stream socket
#
sed <$tmp.nc.err >$tmp.tmp \
    -e '/ using stream socket$/d' \
# end
if [ -s $tmp.tmp ]
then
    echo "errors from nc ..."
    cat $tmp.tmp
fi
_filter_pcp2spark <$tmp.nc.out

for i in $tmp.p2s.out $tmp.p2s.err $tmp.nc.out $tmp.nc.err
do
    echo "=== $i ===" >>$seq_full
    cat $i >>$seq_full
done

echo "" | tee -a $seq_full

status=0
exit