[dpdk-dev] [PATCH 1/2] test: use env variable to run test if set
Van Haaren, Harry
harry.van.haaren at intel.com
Mon Dec 18 16:24:22 CET 2017
> From: Jerin Jacob [mailto:jerin.jacob at caviumnetworks.com]
> Sent: Monday, December 18, 2017 2:59 PM
> To: Van Haaren, Harry <harry.van.haaren at intel.com>
> Cc: dev at dpdk.org; Richardson, Bruce <bruce.richardson at intel.com>
> Subject: Re: [dpdk-dev] [PATCH 1/2] test: use env variable to run test if
> -----Original Message-----
> > Date: Mon, 18 Dec 2017 11:53:57 +0000
> > From: Harry van Haaren <harry.van.haaren at intel.com>
> > To: dev at dpdk.org
> > CC: bruce.richardson at intel.com, Harry van Haaren
> > <harry.van.haaren at intel.com>
> > Subject: [dpdk-dev] [PATCH 1/2] test: use env variable to run test if set
> > X-Mailer: git-send-email 2.7.4
> > This commit paves the way for the meson tests in the next
> > patch. With this patch the test binary checks the DPDK_TEST
> > environment variable and if set, the contents of the var
> > are inserted on the test app command line, and run.
> > This allows testing of various different unit tests without
> > manual interaction with the RTE>> test prompt, instead automating
> > it using the DPDK_TEST environment variable.
> Another alternative is to pipe the command.
> echo "eventdev_common_autotest" | sudo ./build/app/test
With the current implementation, meson handles which tests to run, and the command line. This gives us a clean interface from which to run tests. Note that the following command will run the tests requested:
$ meson test ring_autotest ring_perf_autotest acl_autotest
Meson itself supports two methods of launching tests from the same binary: argv and env variables. In this implementation, the DPDK_TEST env is set by the test runner - and the user doesn't have to use it manually at all, and it is not exported in the shell after the tests have run.
In short - I don't see added value in reworking this to argc argv, or in using terminal tricks like echo "test" | sudo ./test.
Actually, the current method has an easter egg included:
If a developer is focused on a single test-case (TDD anyone? :), then they could use the DPDK_TEST env var as a feature, $ export DPDK_TEST=ring_autotest and run that test automatically when the binary is launched.
More information about the dev