From f92ef1a8e850762a8f3f79f280804bc6cf4c73e3 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 14 Sep 2017 17:01:18 -0700 Subject: [PATCH] ofp-print: Avoid trailing white space in OpenFlow dumps. ofp_to_string() 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. Signed-off-by: Ben Pfaff Acked-by: Russell Bryant --- lib/ofp-print.c | 1 + tests/ofp-print.at | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/ofp-print.c b/lib/ofp-print.c index f77b31baf0b..151d618b59e 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -3791,6 +3791,7 @@ ofp_to_string(const void *oh_, size_t len, error = ofpraw_decode(&raw, oh); if (!error) { ofp_to_string__(oh, port_map, raw, &string, verbosity); + ds_chomp(&string, ' '); if (verbosity >= 5) { if (ds_last(&string) != '\n') { ds_put_char(&string, '\n'); diff --git a/tests/ofp-print.at b/tests/ofp-print.at index a00e3f3fe74..50083a34d55 100644 --- a/tests/ofp-print.at +++ b/tests/ofp-print.at @@ -1355,7 +1355,7 @@ ff fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ 00 00 00 00 ff 00 ff ff \ "], [0], [dnl -OFPST_FLOW request (xid=0x4): @&t@ +OFPST_FLOW request (xid=0x4): ]) AT_CLEANUP @@ -1367,7 +1367,7 @@ ff 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 \ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ 00 01 00 04 00 00 00 00 \ "], [0], [dnl -OFPST_FLOW request (OF1.2) (xid=0x2): @&t@ +OFPST_FLOW request (OF1.2) (xid=0x2): ]) AT_CLEANUP @@ -1379,7 +1379,7 @@ ff 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 \ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ 00 01 00 04 00 00 00 00 \ "], [0], [dnl -OFPST_FLOW request (OF1.3) (xid=0x2): @&t@ +OFPST_FLOW request (OF1.3) (xid=0x2): ]) AT_CLEANUP @@ -1470,7 +1470,7 @@ ff fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ 00 00 00 00 ff 00 ff ff \ "], [0], [dnl -OFPST_AGGREGATE request (xid=0x4): @&t@ +OFPST_AGGREGATE request (xid=0x4): ]) AT_CLEANUP @@ -1482,7 +1482,7 @@ ff 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 \ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ 00 01 00 04 00 00 00 00 \ "], [0], [dnl -OFPST_AGGREGATE request (OF1.2) (xid=0x2): @&t@ +OFPST_AGGREGATE request (OF1.2) (xid=0x2): ]) AT_CLEANUP @@ -1494,7 +1494,7 @@ ff 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 \ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ 00 01 00 04 00 00 00 00 \ "], [0], [dnl -OFPST_AGGREGATE request (OF1.3) (xid=0x2): @&t@ +OFPST_AGGREGATE request (OF1.3) (xid=0x2): ]) AT_CLEANUP @@ -3256,7 +3256,7 @@ AT_CHECK([ovs-ofctl ofp-print "\ 01 10 00 20 00 00 00 04 ff ff 00 00 00 00 23 20 \ 00 00 00 00 00 00 00 00 ff ff 00 00 ff 00 00 00 \ "], [0], [dnl -NXST_FLOW request (xid=0x4): @&t@ +NXST_FLOW request (xid=0x4): ]) AT_CLEANUP @@ -3420,7 +3420,7 @@ AT_CHECK([ovs-ofctl ofp-print "\ 01 10 00 20 00 00 00 04 ff ff 00 00 00 00 23 20 \ 00 00 00 01 00 00 00 00 ff ff 00 00 ff 00 00 00 \ "], [0], [dnl -NXST_AGGREGATE request (xid=0x4): @&t@ +NXST_AGGREGATE request (xid=0x4): ]) AT_CLEANUP