Commands that use the table library, such as ovs-vsctl and "ovsdb-client dump", print trailing white space in tabular output, to fill out the entire width of their tabular columns. This is annoying whenever we use these commands in 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 <b...@ovn.org> --- lib/table.c | 3 ++ tests/ovsdb-replication.at | 12 ++++---- tests/ovsdb-server.at | 38 ++++++++++++------------ tests/ovsdb-tool.at | 72 +++++++++++++++++++++++----------------------- 4 files changed, 64 insertions(+), 61 deletions(-) diff --git a/lib/table.c b/lib/table.c index e454dfbc8bf7..c8e9f4153d3a 100644 --- a/lib/table.c +++ b/lib/table.c @@ -214,6 +214,9 @@ table_add_cell(struct table *table) static void table_print_table_line__(struct ds *line) { + while (ds_last(line) == ' ') { + line->length--; + } puts(ds_cstr(line)); ds_clear(line); } diff --git a/tests/ovsdb-replication.at b/tests/ovsdb-replication.at index e1e68b326f09..f81381bdb3bf 100644 --- a/tests/ovsdb-replication.at +++ b/tests/ovsdb-replication.at @@ -41,7 +41,7 @@ OVSDB_CHECK_REPLICATION([insert monitored table, insert excluded table], [[8,10c8,9 < _uuid name number < ------------------------------------ ---- ------ -< <0> one 1 @&t@ +< <0> one 1 --- > _uuid name number > ----- ---- ------]] @@ -69,7 +69,7 @@ OVSDB_CHECK_REPLICATION([insert monitored table, update excluded table], [[8,10c8,9 < _uuid name number < ------------------------------------ ---- ------ -< <0> two 2 @&t@ +< <0> two 2 --- > _uuid name number > ----- ---- ------]] @@ -93,7 +93,7 @@ OVSDB_CHECK_REPLICATION([update monitored table, insert excluded table], [[7,9c7,8 < _uuid name number < ------------------------------------ ---- ------ -< <0> two 2 @&t@ +< <0> two 2 --- > _uuid name number > ----- ---- ------]] @@ -122,7 +122,7 @@ OVSDB_CHECK_REPLICATION([update monitored table, update excluded table], [[7,9c7,8 < _uuid name number < ------------------------------------ ----- ------ -< <0> three 3 @&t@ +< <0> three 3 --- > _uuid name number > ----- ---- ------]] @@ -149,7 +149,7 @@ OVSDB_CHECK_REPLICATION([delete monitored table, insert excluded table], [[7,9c7,8 < _uuid name number < ------------------------------------ ---- ------ -< <0> one 1 @&t@ +< <0> one 1 --- > _uuid name number > ----- ---- ------]] @@ -181,7 +181,7 @@ OVSDB_CHECK_REPLICATION([delete monitored table, update excluded table], [[7,9c7,8 < _uuid name number < ------------------------------------ ---- ------ -< <0> two 2 @&t@ +< <0> two 2 --- > _uuid name number > ----- ---- ------]] diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at index e72a65b4847b..0f8c791128b1 100644 --- a/tests/ovsdb-server.at +++ b/tests/ovsdb-server.at @@ -689,12 +689,12 @@ AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table _uuid name number ------------------------------------ ----- ------ -<0> five 5 @&t@ -<1> four 4 @&t@ -<2> one 1 @&t@ -<3> three 3 @&t@ -<4> two 2 @&t@ -<5> zero 0 @&t@ +<0> five 5 +<1> four 4 +<2> one 1 +<3> three 3 +<4> two 2 +<5> zero 0 ], [], [test ! -e pid || kill `cat pid`]) dnl Now compact the database in-place. AT_CHECK([[ovs-appctl -t ovsdb-server ovsdb-server/compact]], @@ -720,12 +720,12 @@ AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table _uuid name number ------------------------------------ ----- ------ -<0> five 5 @&t@ -<1> four 4 @&t@ -<2> one 1 @&t@ -<3> three 3 @&t@ -<4> two 2 @&t@ -<5> zero 0 @&t@ +<0> five 5 +<1> four 4 +<2> one 1 +<3> three 3 +<4> two 2 +<5> zero 0 ], [], [test ! -e pid || kill `cat pid`]) dnl Now do some more transactions. AT_CHECK( @@ -750,9 +750,9 @@ AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table _uuid name number ------------------------------------ ----- ------ -<0> five 5 @&t@ -<1> four 4 @&t@ -<2> three 3 @&t@ +<0> five 5 +<1> four 4 +<2> three 3 ], [], [test ! -e pid || kill `cat pid`]) OVSDB_SERVER_SHUTDOWN AT_CLEANUP @@ -1223,7 +1223,7 @@ cat stdout > output AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [7,9c7,8 < _uuid name number < ------------------------------------ ---- ------ -< <0> one 1 @&t@ +< <0> one 1 --- > _uuid name number > ----- ---- ------ @@ -1325,7 +1325,7 @@ cat stdout > output AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [7,9c7,8 < _uuid name number < ------------------------------------ ---- ------ -< <0> one 1 @&t@ +< <0> one 1 --- > _uuid name number > ----- ---- ------ @@ -1344,12 +1344,12 @@ cat stdout > output AT_CHECK([${PERL} $srcdir/uuidfilt.pl output], [0], [a table _uuid name number ------------------------------------ ---- ------ -<0> zero 0 @&t@ +<0> zero 0 b table _uuid name number ------------------------------------ ---- ------ -<1> one 1 @&t@ +<1> one 1 ]) OVSDB_SERVER_SHUTDOWN diff --git a/tests/ovsdb-tool.at b/tests/ovsdb-tool.at index 2d0f2aa54e97..f782952a3d7f 100644 --- a/tests/ovsdb-tool.at +++ b/tests/ovsdb-tool.at @@ -127,12 +127,12 @@ AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table _uuid name number ------------------------------------ ----- ------ -<0> five 5 @&t@ -<1> four 4 @&t@ -<2> one 1 @&t@ -<3> three 3 @&t@ -<4> two 2 @&t@ -<5> zero 0 @&t@ +<0> five 5 +<1> four 4 +<2> one 1 +<3> three 3 +<4> two 2 +<5> zero 0 ]) dnl Now compact the database in-place. touch .db.tmp.~lock~ @@ -160,12 +160,12 @@ AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table _uuid name number ------------------------------------ ----- ------ -<0> five 5 @&t@ -<1> four 4 @&t@ -<2> one 1 @&t@ -<3> three 3 @&t@ -<4> two 2 @&t@ -<5> zero 0 @&t@ +<0> five 5 +<1> four 4 +<2> one 1 +<3> three 3 +<4> two 2 +<5> zero 0 ]) AT_CLEANUP @@ -202,12 +202,12 @@ AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table _uuid name number ------------------------------------ ----- ------ -<0> five 5 @&t@ -<1> four 4 @&t@ -<2> one 1 @&t@ -<3> three 3 @&t@ -<4> two 2 @&t@ -<5> zero 0 @&t@ +<0> five 5 +<1> four 4 +<2> one 1 +<3> three 3 +<4> two 2 +<5> zero 0 ]) OVS_APP_EXIT_AND_WAIT([ovsdb-server]) dnl Now convert the database in-place. @@ -226,12 +226,12 @@ AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table _uuid number ------------------------------------ ------ -<0> 0 @&t@ -<1> 1 @&t@ -<2> 2 @&t@ -<3> 3 @&t@ -<4> 4 @&t@ -<5> 5 @&t@ +<0> 0 +<1> 1 +<2> 2 +<3> 3 +<4> 4 +<5> 5 ]) OVS_APP_EXIT_AND_WAIT([ovsdb-server]) AT_CLEANUP @@ -268,12 +268,12 @@ AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table _uuid number ------------------------------------ ------ -<0> 0 @&t@ -<1> 1 @&t@ -<2> 2 @&t@ -<3> 3 @&t@ -<4> 4 @&t@ -<5> 5 @&t@ +<0> 0 +<1> 1 +<2> 2 +<3> 3 +<4> 4 +<5> 5 ]) OVS_APP_EXIT_AND_WAIT([ovsdb-server]) dnl Now convert the database in-place. @@ -292,12 +292,12 @@ AT_CHECK([${PERL} $srcdir/uuidfilt.pl stdout], [0], [dnl ordinals table _uuid name number ------------------------------------ ---- ------ -<0> "" 0 @&t@ -<1> "" 1 @&t@ -<2> "" 2 @&t@ -<3> "" 3 @&t@ -<4> "" 4 @&t@ -<5> "" 5 @&t@ +<0> "" 0 +<1> "" 1 +<2> "" 2 +<3> "" 3 +<4> "" 4 +<5> "" 5 ]) OVS_APP_EXIT_AND_WAIT([ovsdb-server]) AT_CLEANUP -- 2.10.2 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev