[PATCH v2 1/3] test: remove some strings from cmdline_etheraddr tests
Stephen Hemminger
stephen at networkplumber.org
Mon Oct 2 20:37:28 CEST 2023
Some of the ethernet address formats which were invalid will
now become valid inputs when rte_ether_unformat_addr is modified
to allow leading zeros.
Also, make local variables static.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
app/test/test_cmdline_etheraddr.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/app/test/test_cmdline_etheraddr.c b/app/test/test_cmdline_etheraddr.c
index 9691c32ba250..166c5716ba9b 100644
--- a/app/test/test_cmdline_etheraddr.c
+++ b/app/test/test_cmdline_etheraddr.c
@@ -20,7 +20,7 @@ struct ether_addr_str {
};
/* valid strings */
-const struct ether_addr_str ether_addr_valid_strs[] = {
+static const struct ether_addr_str ether_addr_valid_strs[] = {
{"01:23:45:67:89:AB", 0xAB8967452301ULL},
{"4567:89AB:CDEF", 0xEFCDAB896745ULL},
};
@@ -30,7 +30,7 @@ const struct ether_addr_str ether_addr_valid_strs[] = {
* end of token, which is either space chars, null char or
* a hash sign.
*/
-const char * ether_addr_garbage_strs[] = {
+static const char * const ether_addr_garbage_strs[] = {
"00:11:22:33:44:55\0garbage",
"00:11:22:33:44:55#garbage",
"00:11:22:33:44:55 garbage",
@@ -46,14 +46,13 @@ const char * ether_addr_garbage_strs[] = {
#define GARBAGE_ETHERADDR 0x554433221100ULL /* corresponding address */
-const char * ether_addr_invalid_strs[] = {
+static const char * const ether_addr_invalid_strs[] = {
/* valid chars, invalid syntax */
"0123:45:67:89:AB",
"01:23:4567:89:AB",
"01:23:45:67:89AB",
"012:345:678:9AB",
"01:23:45:67:89:ABC",
- "01:23:45:67:89:A",
"01:23:45:67:89",
"01:23:45:67:89:AB:CD",
/* invalid chars, valid syntax */
@@ -61,10 +60,8 @@ const char * ether_addr_invalid_strs[] = {
"INVA:LIDC:HARS",
/* misc */
"01 23 45 67 89 AB",
- "01.23.45.67.89.AB",
"01,23,45,67,89,AB",
- "01:23:45\0:67:89:AB",
- "01:23:45#:67:89:AB",
+ "01:23:45:67#:89:AB",
"random invalid text",
"random text",
"",
--
2.39.2
More information about the dev
mailing list