app/test: invoke all telemetry commands
PATCH 1/1 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).
--- .github/workflows/build.yml | 2 +- app/test/meson.build | 35 ++++++++++++++++++++++++++++++++++- app/test/test_telemetry.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100755 app/test/test_telemetry.sh
.github/workflows/build.yml +1 -1
@@ -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
app/test/meson.build +34 -1
@@ -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
@@ -520,6 +522,37 @@ 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' + foreach drv:dpdk_drivers + test_args += ['-d', drv.full_path().split('.a')[0] + '.so'] + endforeach + 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],
app/test/test_telemetry.sh new file +28 -0
@@ -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) | $@
Signature · 1 line
2.36.1
Quoted 53 lines · David Marchand
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 <[email protected]>Acked-by Chengwen Feng <[email protected]>--- .github/workflows/build.yml | 2 +- app/test/meson.build | 35 ++++++++++++++++++++++++++++++++++- app/test/test_telemetry.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100755 app/test/test_telemetry.sh.github/workflows/build.yml +1
-1@@ -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-sphinxapp/test/meson.build +3
-1@@ -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
app/test/meson.build foreach arg : fast_tests · line 531
Quoted 10 lines
app/test/meson.build +7
-0@@ -520,6 +522,37 @@ 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' + foreach drv:dpdk_drivers + test_args += ['-d', drv.full_path().split('.a')[0] + '.so'] + endforeach
Rather than looping for each driver and building a huge cmdline, we should just be able to pass in the path to the drivers directory, and have DPDK auto-load all .so files there. Passing in "meson.project_build_root() + '/drivers'" should probably work. If we want a more correct way to get the drivers build directory, we can call meson.current_build_dir() when processing the drivers and save off that value to be reused here.
/Bruce
Quoted 8 lines · Bruce Richardson
app/test/meson.build foreach arg : fast_tests · line 531
Quoted 7 lines
app/test/meson.build +7
-0+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' + foreach drv:dpdk_drivers + test_args += ['-d', drv.full_path().split('.a')[0] + '.so'] + endforeach
Quoted 6 lines
Rather than looping for each driver and building a huge cmdline, we should just be able to pass in the path to the drivers directory, and have DPDK auto-load all .so files there. Passing in "
meson.project_build_root()+ '/drivers'" should probably work. If we want a more correct way to get the drivers build directory, we can callmeson.current_build_dir()when processing the drivers and save off that value to be reused here.
I copied this loop from an existing block added with 207b1c813f39 ("test: fix build without ring PMD").
On the need for this loop at the time... I think it was to avoid loading non .so stuff from a build directory.
And you probably handled this with 49b536fc3060 ("eal: load only shared libs from driver plugin directories").
I'll try your suggestion and, if it works, I'll update the other existing test.
Signature · 1 line
David Marchand
Quoted 17 lines · David Marchand
Quoted 8 lines · Bruce Richardson
app/test/meson.build foreach arg : fast_tests · line 531
Quoted 7 lines
app/test/meson.build +7
-0+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' + foreach drv:dpdk_drivers + test_args += ['-d', drv.full_path().split('.a')[0] + '.so'] + endforeachQuoted 6 lines
Rather than looping for each driver and building a huge cmdline, we should just be able to pass in the path to the drivers directory, and have DPDK auto-load all .so files there. Passing in "
meson.project_build_root()+ '/drivers'" should probably work. If we want a more correct way to get the drivers build directory, we can callmeson.current_build_dir()when processing the drivers and save off that value to be reused here.
Quoted 9 lines
I copied this loop from an existing block added with
207b1c813f39("test: fix build without ring PMD").
On the need for this loop at the time... I think it was to avoid loading non .so stuff from a build directory.
And you probably handled this with49b536fc3060("eal: load only shared libs from driver plugin directories").I'll try your suggestion and, if it works, I'll update the other existing test.
Many thanks. If it doesn't work and needs some investigation, let me know and maybe I can take a look at it for a bit.
/Bruce
Quoted 58 lines · Bruce Richardson
Quoted 56 lines · David Marchand
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 <[email protected]>Acked-by Chengwen Feng <[email protected]>--- .github/workflows/build.yml | 2 +- app/test/meson.build | 35 ++++++++++++++++++++++++++++++++++- app/test/test_telemetry.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100755 app/test/test_telemetry.sh.github/workflows/build.yml +1
-1@@ -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-sphinxapp/test/meson.build +3
-1@@ -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@@ -520,6 +522,37 @@ foreach arg : fast_tests endif endforeach
Quoted 14 lines
app/test/meson.build foreach arg : fast_tests · line 531
Quoted 7 lines
app/test/meson.build +7
-0+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' + foreach drv:dpdk_drivers + test_args += ['-d', drv.full_path().split('.a')[0] + '.so'] + endforeachRather than looping for each driver and building a huge cmdline, we should just be able to pass in the path to the drivers directory, and have DPDK auto-load all .so files there. Passing in "
meson.project_build_root()+ '/drivers'" should probably work. If we want a more correct way to get the drivers build directory, we can callmeson.current_build_dir()when processing the drivers and save off that value to be reused here.
Or simply resolve this with a:test_args += ['-d', fs.parent(dpdk_drivers[0].full_path())]
But the problem is that the fs meson module comes with version 0.53 afaics. Any elegant alternative idea?
Signature · 1 line
David Marchand
Quoted 75 lines · David Marchand
Quoted 58 lines · Bruce Richardson
Quoted 56 lines · David Marchand
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 <[email protected]>Acked-by Chengwen Feng <[email protected]>--- .github/workflows/build.yml | 2 +- app/test/meson.build | 35 ++++++++++++++++++++++++++++++++++- app/test/test_telemetry.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100755 app/test/test_telemetry.sh.github/workflows/build.yml +1
-1@@ -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-sphinxapp/test/meson.build +3
-1@@ -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@@ -520,6 +522,37 @@ foreach arg : fast_tests endif endforeachQuoted 14 lines
app/test/meson.build foreach arg : fast_tests · line 531
Quoted 7 lines
app/test/meson.build +7
-0+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' + foreach drv:dpdk_drivers + test_args += ['-d', drv.full_path().split('.a')[0] + '.so'] + endforeachRather than looping for each driver and building a huge cmdline, we should just be able to pass in the path to the drivers directory, and have DPDK auto-load all .so files there. Passing in "
meson.project_build_root()+ '/drivers'" should probably work. If we want a more correct way to get the drivers build directory, we can callmeson.current_build_dir()when processing the drivers and save off that value to be reused here.
Quoted 6 lines
Or simply resolve this with a:
test_args+= ['-d', fs.parent(dpdk_drivers[0].full_path())]But the problem is that the fs meson module comes with version 0.53 afaics. Any elegant alternative idea?
I think the approach you have taken in the v2 is best.
Quoted 7 lines · Bruce Richardson
Quoted 7 lines
Quoted 6 lines
Rather than looping for each driver and building a huge cmdline, we should just be able to pass in the path to the drivers directory, and have DPDK auto-load all .so files there. Passing in "
meson.project_build_root()+ '/drivers'" should probably work. If we want a more correct way to get the drivers build directory, we can callmeson.current_build_dir()when processing the drivers and save off that value to be reused here.
Quoted 7 lines
Quoted 6 lines
Or simply resolve this with a:
test_args+= ['-d', fs.parent(dpdk_drivers[0].full_path())]But the problem is that the fs meson module comes with version 0.53 afaics. Any elegant alternative idea?
I think the approach you have taken in the v2 is best.
I'm happy that you like your own suggestion ;-).
Joke aside, thanks Bruce.
Signature · 1 line
David Marchand
PATCH v2 1/2 app/test: load drivers using build directory
In reply to David MarchandSince commit 49b536fc3060 ("eal: load only shared libs from driver ...), we can specify a build directory to the -d option.
--- app/test/meson.build | 4 +--- drivers/meson.build | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-)
app/test/meson.build +1 -3
@@ -492,9 +492,7 @@ foreach arg : fast_tests if (get_option('default_library') == 'shared' and arg[0] == 'event_eth_tx_adapter_autotest') - foreach drv:dpdk_drivers - test_args += ['-d', drv.full_path().split('.a')[0] + '.so'] - endforeach + test_args += ['-d', dpdk_drivers_build_dir] endif if is_linux test_args += ['--file-prefix=@0@'.format(arg[0])]
drivers/meson.build +2 -0
@@ -52,6 +52,8 @@ if cc.has_argument('-Wno-format-truncation') default_cflags += '-Wno-format-truncation' endif +dpdk_drivers_build_dir = meson.current_build_dir() + foreach subpath:subdirs drivers = [] std_deps = []
Signature · 1 line
2.36.1
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).
--- .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
.github/workflows/build.yml +1 -1
@@ -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
app/test/meson.build +32 -1
@@ -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],
app/test/test_telemetry.sh new file +28 -0
@@ -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) | $@
Signature · 1 line
2.36.1
Quoted 7 lines · David Marchand
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.
Quoted 6 lines
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 <[email protected]>Acked-by Chengwen Feng <[email protected]>---
Quoted 18 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Friday 29 July 2022 13:43
To: [email protected]
Cc: Chengwen Feng <[email protected]>; Aaron Conole <[email protected]>; Michael Santana <[email protected]>; Power, Ciara <[email protected]>
Subject: [PATCH v2 2/2] app/test: invoke all telemetry commandsTry 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.
Quoted 6 lines
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 <[email protected]>Acked-by Chengwen Feng <[email protected]>---
Good idea, thanks!
David Marchand
Acked-by Aaron ConoleQuoted 7 lines · Ciara
Quoted 7 lines
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.
Quoted 5 lines
Quoted 5 lines
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 <[email protected]>Acked-by Chengwen Feng <[email protected]>
Quoted 1 line
Acked-by Ciara Power <[email protected]>
Series applied, thanks.
Signature · 1 line
David Marchand
Re: [PATCH v2 1/2] app/test: load drivers using build directory
In reply to David MarchandQuoted 5 lines · David Marchand
Since commit
49b536fc3060("eal: load only shared libs from driver ...), we can specify a build directory to the -d option.Suggested-by Bruce Richardson <[email protected]>Signed-off-by David Marchand <[email protected]>