From: Briana Oursler <briana.oursler@gmail.com>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Petr Machata <petrm@mellanox.com>,
Davide Caratti <dcaratti@redhat.com>,
Stefano Brivio <sbrivio@redhat.com>,
Jiri Pirko <jiri@mellanox.com>,
Briana Oursler <briana.oursler@gmail.com>
Subject: Question Print Formatting iproute2
Date: Sun, 26 Jul 2020 21:46:16 -0700 [thread overview]
Message-ID: <20200727044616.735-1-briana.oursler@gmail.com> (raw)
I have a patch I've written to address a format specifier change that
breaks some tests in tc-testing, but I wanted to ask about the change
and for some guidance with respect to how formatters are approached in
iproute2.
On a recent run of tdc tests I ran ./tdc.py -c qdisc and found:
1..91
not ok 1 8b6e - Create RED with no flags
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kb
not ok 2 342e - Create RED with adaptive flag
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbadaptive
not ok 3 2d4b - Create RED with ECN flag
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn
not ok 4 650f - Create RED with flags ECN, adaptive
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn adaptive
not ok 5 5f15 - Create RED with flags ECN, harddrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn harddrop
not ok 6 53e8 - Create RED with flags ECN, nodrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn nodrop
ok 7 d091 - Fail to create RED with only nodrop flag
not ok 8 af8e - Create RED with flags ECN, nodrop, harddrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn harddrop
nodrop
I git bisected and found d0e450438571("tc: q_red: Add support for
qevents "mark" and "early_drop"), the commit that introduced the
formatting change causing the break.
- print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
+ print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));
I made a patch that adds a space after the format specifier in the
iproute2 tc/q_red.c and tested it using: tdc.py -c qdisc. After the
change, all the broken tdc qdisc red tests return ok. I'm including the
patch under the scissors line.
I wanted to ask the ML if adding the space after the specifier is preferred usage.
The commit also had:
- print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
+ print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);
so I wanted to check with everyone.
Thanks
>8------------------------------------------------------------------------8<
From 1e7bee22a799a320bd230ad959d459b386bec26d Mon Sep 17 00:00:00 2001
Subject: [RFC iproute2-next] tc: Add space after format specifier
Add space after format specifier in print_string call. Fixes broken
qdisc tests within tdc testing suite.
Fixes: d0e450438571("tc: q_red: Add support for
qevents "mark" and "early_drop")
Signed-off-by: Briana Oursler <briana.oursler@gmail.com>
---
tc/q_red.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tc/q_red.c b/tc/q_red.c
index dfef1bf8..7106645a 100644
--- a/tc/q_red.c
+++ b/tc/q_red.c
@@ -222,7 +222,7 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt->qth_min, b2));
print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
- print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));
+ print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
tc_red_print_flags(qopt->flags);
base-commit: 1ca65af1c5e131861a3989cca3c7ca8b067e0833
--
2.27.0
next reply other threads:[~2020-07-27 4:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 4:46 Briana Oursler [this message]
2020-07-27 19:31 ` Question Print Formatting iproute2 Petr Machata
2020-07-27 20:37 ` Stephen Hemminger
2020-07-28 4:12 ` Briana Oursler
2020-07-27 23:47 ` Stephen Hemminger
2020-07-28 4:14 ` Briana Oursler
2020-07-28 5:20 ` [PATCH iproute2] tc: Add space after format specifier Briana Oursler
2020-07-28 5:53 ` Briana Oursler
2020-07-29 15:24 ` David Ahern
2020-07-28 13:24 ` Petr Machata
2020-07-29 17:07 ` David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200727044616.735-1-briana.oursler@gmail.com \
--to=briana.oursler@gmail.com \
--cc=dcaratti@redhat.com \
--cc=jiri@mellanox.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=petrm@mellanox.com \
--cc=sbrivio@redhat.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).