]> git.proxmox.com Git - ovs.git/commitdiff
util: Avoid trailing white space in hex dumps.
authorBen Pfaff <blp@ovn.org>
Fri, 15 Sep 2017 00:00:38 +0000 (17:00 -0700)
committerBen Pfaff <blp@ovn.org>
Sat, 7 Oct 2017 03:52:24 +0000 (20:52 -0700)
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 <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
lib/util.c
tests/ofp-errors.at
tests/ofp-util.at
tests/ovs-ofctl.at

index 36e373120af82217d74f1a76878293478dea9679..b7e896b4cdf84b0793f5cb704dc74a9ecfd612d9 100644 (file)
@@ -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, "|");
index caf4e4a7d16f20663e082c8e87af9ae696756e2c..690c4a6fb776e51ff768de00a07064193a7aa84e 100644 (file)
@@ -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
index 700173a34f6fd1409a374121fc9c3527a80fa664..c242f6402d0534011b8ff076878210efcab8ad8c 100644 (file)
@@ -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
 ])
index 6d2ae1d26bea8dddf169da285d37151ac80ce61d..28bca8b9b781179808b9fd5a7d55b24c48170128 100644 (file)
@@ -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