[v2,2/2] app/test: invoke all telemetry commands

Message ID 20220729124256.1384838-2-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v2,1/2] app/test: load drivers using build directory |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-unit-testing fail Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing fail Testing issues

Commit Message

David Marchand July 29, 2022, 12:42 p.m. UTC
  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>
---
 .github/workflows/build.yml |  2 +-
 app/test/meson.build        | 33 ++++++++++++++++++++++++++++++++-
 app/test/test_telemetry.sh  | 28 ++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100755 app/test/test_telemetry.sh
  

Comments

Aaron Conole July 29, 2022, 6:04 p.m. UTC | #1
David Marchand <david.marchand@redhat.com> writes:

> 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>
  
Power, Ciara Aug. 16, 2022, 4:20 p.m. UTC | #2
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Friday 29 July 2022 13:43
> To: dev@dpdk.org
> Cc: Chengwen Feng <fengchengwen@huawei.com>; Aaron Conole
> <aconole@redhat.com>; Michael Santana <maicolgabriel@hotmail.com>;
> Power, Ciara <ciara.power@intel.com>
> Subject: [PATCH v2 2/2] app/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>
> ---
Good idea, thanks!
Acked-by: Ciara Power <ciara.power@intel.com>
  
David Marchand Aug. 26, 2022, 9:42 a.m. UTC | #3
On Tue, Aug 16, 2022 at 6:20 PM Power, Ciara <ciara.power@intel.com> wrote:
> > 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>

Series applied, thanks.
  

Patch

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6f04e7071c..bf17d2b278 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -140,7 +140,7 @@  jobs:
       run: sudo apt install -y crossbuild-essential-riscv64
     - name: Install test tools packages
       if: env.AARCH64 != 'true' || env.PPC64LE != 'true' || env.RISCV64 != 'true' || env.RUN_TESTS == 'true'
-      run: sudo apt install -y gdb
+      run: sudo apt install -y gdb jq
     - name: Install doc generation packages
       if: env.BUILD_DOCS == 'true'
       run: sudo apt install -y doxygen graphviz python3-sphinx
diff --git a/app/test/meson.build b/app/test/meson.build
index 861dd92ebd..bf1d81f84a 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -473,12 +473,14 @@  message('hugepage availability: @0@'.format(has_hugepage))
 timeout_seconds = 600
 timeout_seconds_fast = 10
 
+test_no_huge_args = ['--no-huge', '-m', '2048']
+
 foreach arg : fast_tests
     test_args = []
     run_test = true
     if not has_hugepage
         if arg[1]
-            test_args += ['--no-huge', '-m', '2048']
+            test_args += test_no_huge_args
         else
             run_test = false
         endif
@@ -518,6 +520,35 @@  foreach arg : fast_tests
     endif
 endforeach
 
+if not is_windows and dpdk_conf.has('RTE_LIB_TELEMETRY')
+    test_args = [dpdk_test]
+    test_args += test_no_huge_args
+    if get_option('default_library') == 'shared'
+        test_args += ['-d', dpdk_drivers_build_dir]
+    endif
+    if dpdk_conf.has('RTE_CRYPTO_NULL')
+        test_args += ['--vdev=crypto_null0']
+    endif
+    if dpdk_conf.has('RTE_DMA_SKELETON')
+        test_args += ['--vdev=dma_skeleton0']
+    endif
+    if dpdk_conf.has('RTE_EVENT_SKELETON')
+        test_args += ['--vdev=event_skeleton0']
+    endif
+    if dpdk_conf.has('RTE_NET_NULL')
+        test_args += ['--vdev=net_null0']
+    endif
+    if dpdk_conf.has('RTE_RAW_SKELETON')
+        test_args += ['--vdev=rawdev_skeleton0']
+    endif
+    test_args += ['-a', '0000:00:00.0']
+    test('telemetry_all', find_program('test_telemetry.sh'),
+            args: test_args,
+            timeout : timeout_seconds_fast,
+            is_parallel : false,
+            suite : 'fast-tests')
+endif
+
 foreach arg : perf_test_names
     test(arg, dpdk_test,
             env : ['DPDK_TEST=' + arg],
diff --git a/app/test/test_telemetry.sh b/app/test/test_telemetry.sh
new file mode 100755
index 0000000000..ca6abe266e
--- /dev/null
+++ b/app/test/test_telemetry.sh
@@ -0,0 +1,28 @@ 
+#!/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) | $@