As the test itself does not have specific args, it just calls the cunit_common parsing function to pick up cunit_common and helpers arguments.
Signed-off-by: Christophe Milard <christophe.mil...@linaro.org> --- platform/linux-generic/test/pktio/pktio_run | 21 ++++++++++++++++++--- platform/linux-generic/test/pktio/pktio_run_dpdk | 17 ++++++++++++++++- platform/linux-generic/test/pktio/pktio_run_netmap | 5 ++++- platform/linux-generic/test/pktio/pktio_run_pcap | 5 ++++- platform/linux-generic/test/pktio/pktio_run_tap | 6 +++++- test/validation/pktio/pktio.c | 10 ++++++++-- test/validation/pktio/pktio.h | 2 +- test/validation/pktio/pktio_main.c | 4 ++-- 8 files changed, 58 insertions(+), 12 deletions(-) diff --git a/platform/linux-generic/test/pktio/pktio_run b/platform/linux-generic/test/pktio/pktio_run index 7029ab2..4086fc2 100755 --- a/platform/linux-generic/test/pktio/pktio_run +++ b/platform/linux-generic/test/pktio/pktio_run @@ -6,6 +6,15 @@ # SPDX-License-Identifier: BSD-3-Clause # +# Proceed the pktio tests. This script expects at least one argument: +# setup) setup the pktio test environment +# cleanup) cleanup the pktio test environment +# run) run the pktio tests (setup, run, cleanup) +# extra arguments are passed unchanged to the test itself (pktio_main) +# Without arguments, "run" is assumed and no extra argument is passed to the +# test (legacy mode). +# + # directories where pktio_main binary can be found: # -in the validation dir when running make check (intree or out of tree) # -in the script directory, when running after 'make install', or @@ -59,7 +68,7 @@ run_test() if [ "$disabletype" != "SKIP" ]; then export ODP_PKTIO_DISABLE_SOCKET_${distype}=y fi - pktio_main${EXEEXT} + pktio_main${EXEEXT} $* if [ $? -ne 0 ]; then ret=1 fi @@ -75,7 +84,7 @@ run_test() run() { echo "pktio: using 'loop' device" - pktio_main${EXEEXT} + pktio_main${EXEEXT} $* loop_ret=$? # need to be root to run tests with real interfaces @@ -103,8 +112,14 @@ run() exit $ret } -case "$1" in +if [ $# > 0]; then + action=$1 + shift +fi + +case "$action" in setup) setup_pktio_env ;; cleanup) cleanup_pktio_env ;; + run) run ;; *) run ;; esac diff --git a/platform/linux-generic/test/pktio/pktio_run_dpdk b/platform/linux-generic/test/pktio/pktio_run_dpdk index 50e910a..1a1efac 100755 --- a/platform/linux-generic/test/pktio/pktio_run_dpdk +++ b/platform/linux-generic/test/pktio/pktio_run_dpdk @@ -6,6 +6,15 @@ # SPDX-License-Identifier: BSD-3-Clause # +# Proceed the pktio tests. This script expects at least one argument: +# setup) setup the pktio test environment +# cleanup) cleanup the pktio test environment +# run) run the pktio tests (setup, run, cleanup) +# extra arguments are passed unchanged to the test itself (pktio_main) +# Without arguments, "run" is assumed and no extra argument is passed to the +# test (legacy mode). +# + # directories where pktio_main binary can be found: # -in the validation dir when running make check (intree or out of tree) # -in the script directory, when running after 'make install', or @@ -46,7 +55,7 @@ run_test() { local ret=0 - pktio_main${EXEEXT} + pktio_main${EXEEXT} $* ret=$? if [ $ret -ne 0 ]; then echo "!!! FAILED !!!" @@ -73,8 +82,14 @@ run() run_test } +if [ $# > 0]; then + action=$1 + shift +fi + case "$1" in setup) setup_pktio_env ;; cleanup) cleanup_pktio_env ;; + run) run ;; *) run ;; esac diff --git a/platform/linux-generic/test/pktio/pktio_run_netmap b/platform/linux-generic/test/pktio/pktio_run_netmap index b7f2575..b651ea3 100755 --- a/platform/linux-generic/test/pktio/pktio_run_netmap +++ b/platform/linux-generic/test/pktio/pktio_run_netmap @@ -6,6 +6,9 @@ # SPDX-License-Identifier: BSD-3-Clause # +# any parameter passed as arguments to this script is passed unchanged to +# the test itself (pktio_main) + # directories where pktio_main binary can be found: # -in the validation dir when running make check (intree or out of tree) # -in the script directory, when running after 'make install', or @@ -45,7 +48,7 @@ run_test() { local ret=0 - pktio_main${EXEEXT} + pktio_main${EXEEXT} $* ret=$? if [ $ret -ne 0 ]; then diff --git a/platform/linux-generic/test/pktio/pktio_run_pcap b/platform/linux-generic/test/pktio/pktio_run_pcap index c130417..51716fb 100755 --- a/platform/linux-generic/test/pktio/pktio_run_pcap +++ b/platform/linux-generic/test/pktio/pktio_run_pcap @@ -6,6 +6,9 @@ # SPDX-License-Identifier: BSD-3-Clause # +# any parameter passed as arguments to this script is passed unchanged to +# the test itself (pktio_main) + # directories where pktio_main binary can be found: # -in the validation dir when running make check (intree or out of tree) # -in the script directory, when running after 'make install', or @@ -27,7 +30,7 @@ fi PCAP_FNAME=vald.pcap export ODP_PKTIO_IF0="pcap:out=${PCAP_FNAME}" export ODP_PKTIO_IF1="pcap:in=${PCAP_FNAME}" -pktio_main${EXEEXT} +pktio_main${EXEEXT} $* ret=$? rm -f ${PCAP_FNAME} exit $ret diff --git a/platform/linux-generic/test/pktio/pktio_run_tap b/platform/linux-generic/test/pktio/pktio_run_tap index 2b4f289..1150158 100755 --- a/platform/linux-generic/test/pktio/pktio_run_tap +++ b/platform/linux-generic/test/pktio/pktio_run_tap @@ -6,6 +6,10 @@ # SPDX-License-Identifier: BSD-3-Clause # + +# any parameter passed as arguments to this script is passed unchanged to +# the test itself (pktio_main) + # directories where pktio_main binary can be found: # -in the validation dir when running make check (intree or out of tree) # -in the script directory, when running after 'make install', or @@ -109,7 +113,7 @@ if [ $ret -ne 0 ]; then fi # Using ODP_WAIT_FOR_NETWORK to prevent fail if tap still not enabled in bridge -ODP_WAIT_FOR_NETWORK=yes pktio_main${EXEEXT} +ODP_WAIT_FOR_NETWORK=yes pktio_main${EXEEXT} $* ret=$? exit $ret diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c index 7b7c0a5..4dfdc44 100644 --- a/test/validation/pktio/pktio.c +++ b/test/validation/pktio/pktio.c @@ -2138,9 +2138,15 @@ odp_suiteinfo_t pktio_suites[] = { ODP_SUITE_INFO_NULL }; -int pktio_main(void) +int pktio_main(int argc, char *argv[]) { - int ret = odp_cunit_register(pktio_suites); + int ret; + + /* parse common options: */ + if (odp_cunit_parse_options(argc, argv)) + return -1; + + ret = odp_cunit_register(pktio_suites); if (ret == 0) ret = odp_cunit_run(); diff --git a/test/validation/pktio/pktio.h b/test/validation/pktio/pktio.h index 5ff20f6..8131d05 100644 --- a/test/validation/pktio/pktio.h +++ b/test/validation/pktio/pktio.h @@ -59,6 +59,6 @@ int pktio_suite_init_unsegmented(void); extern odp_suiteinfo_t pktio_suites[]; /* main test program: */ -int pktio_main(void); +int pktio_main(int argc, char *argv[]); #endif diff --git a/test/validation/pktio/pktio_main.c b/test/validation/pktio/pktio_main.c index dca041c..2928e1b 100644 --- a/test/validation/pktio/pktio_main.c +++ b/test/validation/pktio/pktio_main.c @@ -6,7 +6,7 @@ #include "pktio.h" -int main(void) +int main(int argc, char *argv[]) { - return pktio_main(); + return pktio_main(argc, argv); } -- 2.5.0 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp