ovs_hex_dump() sometimes yields a trailing space in its output. This is annoying for the test infrastructure, since we have to specially mark the trailing white space in Autotest with a "@&t@" marker at the end of the line. This commit gets rid of the trailing white space and the annoying "@&t@" markers.
This also gets rid of an occasional trailing hyphen. Signed-off-by: Ben Pfaff <[email protected]> --- lib/util.c | 7 ++++--- tests/ofp-errors.at | 44 ++++++++++++++++++++++---------------------- tests/ofp-util.at | 18 +++++++++--------- tests/ovs-ofctl.at | 20 ++++++++++---------- 4 files changed, 45 insertions(+), 44 deletions(-) diff --git a/lib/util.c b/lib/util.c index 36e373120af8..b7e896b4cdf8 100644 --- a/lib/util.c +++ b/lib/util.c @@ -658,14 +658,15 @@ ovs_hex_dump(FILE *stream, const void *buf_, size_t size, n = end - start; /* Print line. */ - fprintf(stream, "%08"PRIxMAX" ", (uintmax_t) ROUND_DOWN(ofs, per_line)); + fprintf(stream, "%08"PRIxMAX" ", (uintmax_t) ROUND_DOWN(ofs, per_line)); for (i = 0; i < start; i++) fprintf(stream, " "); for (; i < end; i++) - fprintf(stream, "%02x%c", - buf[i - start], i == per_line / 2 - 1? '-' : ' '); + fprintf(stream, "%c%02x", + i == per_line / 2 ? '-' : ' ', buf[i - start]); if (ascii) { + fprintf(stream, " "); for (; i < per_line; i++) fprintf(stream, " "); fprintf(stream, "|"); diff --git a/tests/ofp-errors.at b/tests/ofp-errors.at index caf4e4a7d16f..690c4a6fb776 100644 --- a/tests/ofp-errors.at +++ b/tests/ofp-errors.at @@ -120,18 +120,18 @@ AT_SETUP([encoding errors extension that became official]) AT_KEYWORDS([ofp-print ofp-errors]) AT_CHECK( [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0100000812345678], [0], [dnl -00000000 01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@ -00000010 00 01 02 01 01 00 00 08-12 34 56 78 @&t@ +00000000 01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 +00000010 00 01 02 01 01 00 00 08-12 34 56 78 ]) AT_CHECK( [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0200000812345678], [0], [dnl -00000000 02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@ -00000010 00 01 02 01 02 00 00 08-12 34 56 78 @&t@ +00000000 02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 +00000010 00 01 02 01 02 00 00 08-12 34 56 78 ]) AT_CHECK( [ovs-ofctl encode-error-reply OFPRRFC_BAD_ROLE 0300000812345678], [0], [dnl -00000000 03 01 00 14 12 34 56 78-00 0b 00 02 03 00 00 08 @&t@ -00000010 12 34 56 78 @&t@ +00000000 03 01 00 14 12 34 56 78-00 0b 00 02 03 00 00 08 +00000010 12 34 56 78 ]) AT_CLEANUP @@ -190,18 +190,18 @@ AT_KEYWORDS([ofp-print ofp-errors]) # correctly using the standard experimenter format in OF1.2. AT_CHECK( [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0100000812345678], [0], [dnl -00000000 01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@ -00000010 00 01 02 03 01 00 00 08-12 34 56 78 @&t@ +00000000 01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 +00000010 00 01 02 03 01 00 00 08-12 34 56 78 ]) AT_CHECK( [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0200000812345678], [0], [dnl -00000000 02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@ -00000010 00 01 02 03 02 00 00 08-12 34 56 78 @&t@ +00000000 02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 +00000010 00 01 02 03 02 00 00 08-12 34 56 78 ]) AT_CHECK( [ovs-ofctl encode-error-reply NXBRC_MUST_BE_ZERO 0300000812345678], [0], [dnl -00000000 03 01 00 18 12 34 56 78-ff ff 00 04 00 00 23 20 @&t@ -00000010 03 00 00 08 12 34 56 78- +00000000 03 01 00 18 12 34 56 78-ff ff 00 04 00 00 23 20 +00000010 03 00 00 08 12 34 56 78 ]) # Check that OFPERR_OFPBIC_DUP_INST is: @@ -211,24 +211,24 @@ AT_CHECK( # - encoded in the standard form in OF1.4. AT_CHECK( [ovs-ofctl '-vPATTERN:console:%c|%p|%m' encode-error-reply OFPBIC_DUP_INST 0100000812345678], [0], [dnl -00000000 01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@ -00000010 00 01 02 09 01 00 00 08-12 34 56 78 @&t@ +00000000 01 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 +00000010 00 01 02 09 01 00 00 08-12 34 56 78 ], [ofp_errors|ERR|cannot encode OFPBIC_DUP_INST for OpenFlow 1.0 ]) AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0200000812345678], [0], -[00000000 02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 @&t@ -00000010 00 03 01 00 02 00 00 08-12 34 56 78 @&t@ +[00000000 02 01 00 1c 12 34 56 78-b0 c2 00 00 00 00 23 20 +00000010 00 03 01 00 02 00 00 08-12 34 56 78 ]) AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0300000812345678], [0], -[00000000 03 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00 @&t@ -00000010 03 00 00 08 12 34 56 78- +[00000000 03 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00 +00000010 03 00 00 08 12 34 56 78 ]) AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0400000812345678], [0], -[00000000 04 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00 @&t@ -00000010 04 00 00 08 12 34 56 78- +[00000000 04 01 00 18 12 34 56 78-ff ff 0a 28 4f 4e 46 00 +00000010 04 00 00 08 12 34 56 78 ]) AT_CHECK([ovs-ofctl encode-error-reply OFPBIC_DUP_INST 0500000812345678], [0], -[00000000 05 01 00 14 12 34 56 78-00 03 00 09 05 00 00 08 @&t@ -00000010 12 34 56 78 @&t@ +[00000000 05 01 00 14 12 34 56 78-00 03 00 09 05 00 00 08 +00000010 12 34 56 78 ]) AT_CLEANUP diff --git a/tests/ofp-util.at b/tests/ofp-util.at index 700173a34f6f..c242f6402d05 100644 --- a/tests/ofp-util.at +++ b/tests/ofp-util.at @@ -3,49 +3,49 @@ AT_BANNER([OpenFlow utilities]) AT_SETUP([encoding hellos]) dnl All versions up to a max version supported: AT_CHECK([ovs-ofctl encode-hello 0x2], [0], [dnl -00000000 01 00 00 08 00 00 00 01- +00000000 01 00 00 08 00 00 00 01 OFPT_HELLO (xid=0x1): version bitmap: 0x01 ]) AT_CHECK([ovs-ofctl encode-hello 0x6], [0], [dnl -00000000 02 00 00 08 00 00 00 01- +00000000 02 00 00 08 00 00 00 01 OFPT_HELLO (OF1.1) (xid=0x1): version bitmap: 0x01, 0x02 ]) AT_CHECK([ovs-ofctl encode-hello 0xe], [0], [dnl -00000000 03 00 00 08 00 00 00 01- +00000000 03 00 00 08 00 00 00 01 OFPT_HELLO (OF1.2) (xid=0x1): version bitmap: 0x01, 0x02, 0x03 ]) AT_CHECK([ovs-ofctl encode-hello 0x1e], [0], [dnl -00000000 04 00 00 08 00 00 00 01- +00000000 04 00 00 08 00 00 00 01 OFPT_HELLO (OF1.3) (xid=0x1): version bitmap: 0x01, 0x02, 0x03, 0x04 ]) AT_CHECK([ovs-ofctl encode-hello 0x3e], [0], [dnl -00000000 05 00 00 08 00 00 00 01- +00000000 05 00 00 08 00 00 00 01 OFPT_HELLO (OF1.4) (xid=0x1): version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05 ]) dnl Some versions below max version missing. AT_CHECK([ovs-ofctl encode-hello 0xc], [0], [dnl -00000000 03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 0c @&t@ +00000000 03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 0c OFPT_HELLO (OF1.2) (xid=0x1): version bitmap: 0x02, 0x03 ]) AT_CHECK([ovs-ofctl encode-hello 0xa], [0], [dnl -00000000 03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 0a @&t@ +00000000 03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 0a OFPT_HELLO (OF1.2) (xid=0x1): version bitmap: 0x01, 0x03 ]) AT_CHECK([ovs-ofctl encode-hello 0x8], [0], [dnl -00000000 03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 08 @&t@ +00000000 03 00 00 10 00 00 00 01-00 01 00 08 00 00 00 08 OFPT_HELLO (OF1.2) (xid=0x1): version bitmap: 0x03 ]) AT_CHECK([ovs-ofctl encode-hello 0x4], [0], [dnl -00000000 02 00 00 10 00 00 00 01-00 01 00 08 00 00 00 04 @&t@ +00000000 02 00 00 10 00 00 00 01-00 01 00 08 00 00 00 04 OFPT_HELLO (OF1.1) (xid=0x1): version bitmap: 0x02 ]) diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index 6d2ae1d26bea..28bca8b9b781 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -2443,30 +2443,30 @@ NXOXM_ET_DP_HASH_W(01234567/0fffffff) # in OF1.5. AT_CHECK([ovs-ofctl -m --strict parse-oxm OpenFlow15 < oxm.txt], [0], [dnl NXOXM_ET_DP_HASH(01234567) -00000000 00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67 @&t@ +00000000 00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67 NXOXM_ET_DP_HASH(01234567) -00000000 00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67 @&t@ +00000000 00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67 NXOXM_ET_DP_HASH_W(01234567/0fffffff) -00000000 00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67 @&t@ -00000010 0f ff ff ff 00 00 00 00- +00000000 00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67 +00000010 0f ff ff ff 00 00 00 00 NXOXM_ET_DP_HASH_W(01234567/0fffffff) -00000000 00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67 @&t@ -00000010 0f ff ff ff 00 00 00 00- +00000000 00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67 +00000010 0f ff ff ff 00 00 00 00 ]) # Then verify that both forms are accepted and NXM_NX_DP_HASH is encoded # in OF1.2. AT_CHECK([ovs-ofctl -m --strict parse-oxm OpenFlow12 < oxm.txt], [0], [dnl NXM_NX_DP_HASH(01234567) -00000000 00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00 @&t@ +00000000 00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00 NXM_NX_DP_HASH(01234567) -00000000 00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00 @&t@ +00000000 00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00 NXM_NX_DP_HASH_W(01234567/0fffffff) -00000000 00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff @&t@ +00000000 00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff NXM_NX_DP_HASH_W(01234567/0fffffff) -00000000 00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff @&t@ +00000000 00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff ]) AT_CLEANUP -- 2.10.2 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
