On Thu, Jun 27, 2019 at 01:16:01PM +0100, Burakov, Anatoly wrote: > On 27-Jun-19 11:40 AM, Bruce Richardson wrote: > > Add in the "info_get" function to the driver, to allow us to query the > > device. This allows us to have the unit test pick up the presence of > > supported hardware or not. > > > > Signed-off-by: Bruce Richardson <bruce.richard...@intel.com> > > > > --- > > > > V2: Test case is placed in driver self-test routine > > --- > > app/test/test_rawdev.c | 11 ++++++++++ > > doc/guides/rawdevs/ioat_rawdev.rst | 34 ++++++++++++++++++++++++++++++ > > drivers/raw/ioat/ioat_rawdev.c | 11 ++++++++++ > > drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++ > > 4 files changed, 67 insertions(+) > > > > diff --git a/app/test/test_rawdev.c b/app/test/test_rawdev.c > > index 88549fb61..4db762b4c 100644 > > --- a/app/test/test_rawdev.c > > +++ b/app/test/test_rawdev.c > > @@ -29,6 +29,17 @@ REGISTER_TEST_COMMAND(rawdev_autotest, > > test_rawdev_selftest_skeleton); > > static int > > test_rawdev_selftest_ioat(void) > > { > > + const int count = rte_rawdev_count(); > > + int i; > > + > > + for (i = 0; i < count; i++) { > > + struct rte_rawdev_info info = { .dev_private = NULL }; > > + if (rte_rawdev_info_get(i, &info) == 0 && > > + strstr(info.driver_name, "ioat") != NULL) > > + return 0; > > TEST_SUCCESS? Also, didn't "ioat" have a macro for its name? >
Ack on the TEST_SUCCESS part. For the seond point, yes, there is a macro for the name, but to get it one has to include the header file for the driver, which will not be available if the driver is not being built. Therefore, I just use a basic check for the "ioat" name, rather than cluttering up the code with lots of conditionals for handling cases where the driver won't be built. /Bruce