Commit Graph

12 Commits

Author SHA1 Message Date
Josh Soref
7be78d0279 fix spelling in comments and strings
The tool comes from https://github.com/jsoref

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2022-01-11 12:16:53 +01:00
Xueming Li
9be46b4308 kvargs: support multiple lists
This patch updates kvargs parser to support value of multiple lists or
ranges:
  k1=v[1,2]v[3-5]

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-03-16 20:15:29 +01:00
Yunjian Wang
ffcf831454 kvargs: fix buffer overflow when parsing list
When the input string is "key=[", the ending '\0' is replaced
by a ',', leading to a heap buffer overflow.

Check the content of ctx1 to avoid this problem.

Fixes: cc0579f233 ("kvargs: support list value")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2020-03-27 17:03:46 +01:00
Olivier Matz
4bf2b36fd1 test/kvargs: fix invalid cases check
The return was not properly placed, and only the first test case
was validated.

Fixes: e495f54355 ("kvargs: add test case in app/test")
Cc: stable@dpdk.org

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2020-03-27 17:03:43 +01:00
Olivier Matz
55fa01f7ed test/kvargs: fix to consider empty elements as valid
Empty elements passed to the kvargs parser are silently
ignored. Examples of valid strings:
  ""
  ","
  ",,,,,,key=val,,,,"

Fix the unit tests to conform to this behavior.

Note: the test_invalid_kvargs() function is currently broken, which
explain why the tests were not failing. It is fixed in the next commit.

Fixes: e495f54355 ("kvargs: add test case in app/test")
Cc: stable@dpdk.org

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2020-03-27 17:03:31 +01:00
Bruce Richardson
a9de470cc7 test: move to app directory
Since all other apps have been moved to the "app" folder, the autotest app
remains alone in the test folder. Rather than having an entire top-level
folder for this, we can move it back to where it all started in early
versions of DPDK - the "app/" folder.

This move has a couple of advantages:
* This reduces clutter at the top level of the project, due to one less
  folder.
* It eliminates the separate build task necessary for building the
  autotests using make "make test-build" which means that developers are
  less likely to miss something in their own compilation tests
* It re-aligns the final location of the test binary in the app folder when
  building with make with it's location in the source tree.

For meson builds, the autotest app is different from the other apps in that
it needs a series of different test cases defined for it for use by "meson
test". Therefore, it does not get built as part of the main loop in the
app folder, but gets built separately at the end.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-02-26 15:29:27 +01:00
Ferruh Yigit
7d3b1ec47f test: move unit tests to separate directory
This is to logically group unit tests into their own folder,
separating them from "app" folder.

Hopefully this will make the unit test in DPDK more visible.

Following binaries moved to "test" folder:
cmdline-test
test-acl
test-pipeline
test            <-- various DPDK unit tests

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-02-28 16:04:18 +01:00
Thomas Monjalon
26e09db6cb app/test: rework command registration
The tests are registered with their command name by adding a structure
to a list. The structure of each test was declared in each test file
and passed to the register macro.
This rework generate the structure inside the register macro.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
2016-07-15 17:25:02 +02:00
Bruce Richardson
b38e6ee0fa app/test: fix crash after null check
In the kvargs test cases, we were checking for errors by checking if the
returned pointer value was NULL. In the error handling, we then tried to
free back the NULL pointer, which would cause a crash.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2014-12-17 01:04:06 +01:00
David Marchand
942405f9e2 app/test: convert all tests to register system
Remove all tests from the builtin commands list and use the dynamic commands
list register macro.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2014-08-26 17:52:33 +02:00
Olivier Matz
a8b97e3a1d devargs: use a comma instead of semicolon to separate key/values
This commit changes the API of --use-device command line argument.
It changes the separators from ';' to ','. Indeed, ';' is not the best
choice as this character is also used to separate shell commands,
forcing the user to surround arguments with quotes.

This commit impacts both devargs and kvargs as each of them define
a separator in --use-device argument:

- devargs defines the separator between the device name or pci_id and
   its arguments
- kvargs defines the separator between each key/value pairs in
   arguments for drivers using the kvargs API to parse their arguments

The modification of devargs and kvargs is done in one commit to keep
the coherency of --use-device.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2014-04-10 15:50:11 +02:00
Olivier Matz
e495f54355 kvargs: add test case in app/test
Add a file app/test/test_kvargs.c that checks the rte_kvargs API.
The test passes:

  RTE>>kvargs
  == test valid case ==
  == test invalid case ==
  PMD: Error parsing device, invalid key <wrong-key>
  Test OK

I also tested that rte_eth_pcap runs with the following arguments:

  ./app/testpmd -c 0x15 -n 3 --proc-type=primary --huge-dir=/mnt/huge \
    --use-device="eth_pcap0;iface=ixgbe0" \
    -- -i --port-topology=chained

  ./app/testpmd -c 0x15 -n 3 --proc-type=primary --huge-dir=/mnt/huge \
    --use-device="eth_pcap0;rx_iface=ixgbe0;rx_iface=ixgbe1;tx_iface=ixgbe0" \
    -- -i --port-topology=chained

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2014-02-26 11:01:14 +01:00