numam-dpdk/app/test/test_telemetry.sh
David Marchand 09521b1cbe test: invoke all telemetry commands
Try and call all possible telemetry commands.
Each commands is tested with no argument, 0 (for command that accepts
a single integer like for a port identifier) and z (to catch commands
not properly validating input).
Fake cryptodev, dmadev, ethdev, eventdev and rawdev devices are created
using dummy drivers.

Output of the commands is not checked, the point of this test is mainly
to catch simple issues and leaks (when coupled with ASan in the CI).

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Ciara Power <ciara.power@intel.com>
2022-08-25 16:23:17 +02:00

29 lines
771 B
Bash
Executable File

#!/bin/sh -e
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2022 Red Hat, Inc.
which jq || {
echo "No jq available, skipping test."
exit 77
}
rootdir=$(readlink -f $(dirname $(readlink -f $0))/../..)
tmpoutput=$(mktemp -t dpdk.test_telemetry.XXXXXX)
trap "cat $tmpoutput; rm -f $tmpoutput" EXIT
call_all_telemetry() {
telemetry_script=$rootdir/usertools/dpdk-telemetry.py
echo >$tmpoutput
echo "Telemetry commands log:" >>$tmpoutput
for cmd in $(echo / | $telemetry_script | jq -r '.["/"][]')
do
for input in $cmd $cmd,0 $cmd,z
do
echo Calling $input >> $tmpoutput
echo $input | $telemetry_script >> $tmpoutput 2>&1
done
done
}
(sleep 1 && call_all_telemetry && echo quit) | $@