File: 1996

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (119 lines) | stat: -rwxr-xr-x 3,865 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/sh
# PCP QA Test No. 1996
# Exercise the InfiniBand PMDA with mock libraries (no hardware required)
#
# Copyright (c) 2025 Red Hat.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

[ -f $PCP_PMDAS_DIR/infiniband/pmdaib ] || _notrun "infiniband pmda not installed"

status=1	# failure is the default!
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15

# Check for mock IB libraries
test -f $here/src/libibumad.$DSO_SUFFIX || \
	_notrun "No InfiniBand mock umad library is available"
test -f $here/src/libibverbs.$DSO_SUFFIX || \
	_notrun "No InfiniBand mock verbs library is available"

_filter()
{
    tee -a $seq_full \
    | sed \
	-e 's/.* pminfo\(.*\) Info:/pminfo[PID] Info:/g' \
	-e 's/inst \[[0-9][0-9]* /inst [N /g' \
	-e '/No IB ports found to monitor/d' \
	-e '/Unknown parameter/d' \
    #end
}

pmda=$PCP_PMDAS_DIR/infiniband/pmda_ib.$DSO_SUFFIX,ib_init
pmns=$PCP_PMDAS_DIR/infiniband/root
domain=91
pminfo -L -K clear -K add,$domain,$pmda -d -n $pmns infiniband.hca.numports >$tmp.tmp 2>&1
echo "-- initial test for IB support --" >>$seq_full
cat $tmp.tmp >>$seq_full
if grep -q 'No IB kernel support or incorrect ABI version' $tmp.tmp
then
    _notrun "No InfiniBand support here"
fi

# real QA test starts here
root=$tmp.root
IB_STATSPATH=$root; export IB_STATSPATH

# Create versioned symlinks for mock libraries so the PMDA can find them
# Determine version numbers from what the PMDA actually needs
cd $here/src
if [ -f $PCP_PMDAS_DIR/infiniband/pmda_ib.$DSO_SUFFIX ]; then
    # Extract library versions that the PMDA links against
    for lib in $(ldd $PCP_PMDAS_DIR/infiniband/pmda_ib.$DSO_SUFFIX 2>/dev/null | \
                 grep -E 'libibmad|libibumad|libibverbs' | awk '{print $1}'); do
        case "$lib" in
            libibumad.so.*)
                umad_ver=$(echo $lib | sed 's/libibumad\.so\.//')
                ln -sf libibumad.$DSO_SUFFIX libibumad.$DSO_SUFFIX.$umad_ver
                ;;
            libibmad.so.*)
                mad_ver=$(echo $lib | sed 's/libibmad\.so\.//')
                # Our umad mock also provides mad functions
                ln -sf libibumad.$DSO_SUFFIX libibmad.$DSO_SUFFIX.$mad_ver
                ;;
            libibverbs.so.*)
                verbs_ver=$(echo $lib | sed 's/libibverbs\.so\.//')
                ln -sf libibverbs.$DSO_SUFFIX libibverbs.$DSO_SUFFIX.$verbs_ver
                ;;
        esac
    done
fi
cd $here

LD_LIBRARY_PATH=$here/src:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH

for tgz in $here/infiniband/ib-root-*.tgz
do
    rm -fr $root
    mkdir $root || _fail "root in use when processing $tgz"
    cd $root
    tar xzf $tgz
    base=`basename $tgz`

    echo
    echo "== Testing InfiniBand PMDA with mock libraries - $base ==" | tee -a $seq_full

    # Test basic metric fetching
    echo
    echo "=== HCA (Host Channel Adapter) metrics ===" | tee -a $seq_full
    metrics="infiniband.hca.numports infiniband.hca.res.pd"
    pminfo -L -K clear -K add,$domain,$pmda -dfmtT -n $pmns $metrics 2>&1 | _filter

    echo
    echo "=== Port state metrics ===" | tee -a $seq_full
    metrics=infiniband.port.state
    pminfo -L -K clear -K add,$domain,$pmda -dfmtT -n $pmns $metrics 2>&1 | _filter

    echo
    echo "=== Port performance counters ===" | tee -a $seq_full
    metrics="infiniband.port.in.bytes infiniband.port.out.bytes"
    pminfo -L -K clear -K add,$domain,$pmda -dfmtT -n $pmns $metrics 2>&1 | _filter

    echo
    echo "=== Sysfs-based metrics ===" | tee -a $seq_full
    metrics="infiniband.hca.board_id infiniband.port.node_desc"
    pminfo -L -K clear -K add,$domain,$pmda -dfmtT -n $pmns $metrics 2>&1 | _filter

    ( echo && echo "== done" && echo ) | tee -a $seq_full
    cd $here
done

# success, all done
status=0
exit