* [PATCH iproute2 v2 0/2] tests: fix issues in autopkgtest environment
@ 2018-01-10 15:11 Christian Ehrhardt
2018-01-10 15:11 ` [PATCH iproute2 v2 1/2] tests: read limited amount from /dev/urandom Christian Ehrhardt
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2018-01-10 15:11 UTC (permalink / raw)
To: Netdev; +Cc: Luca Boccassi, Christian Ehrhardt
Hi,
while working on Debian bug [1] and the Ubuntu counterpart of it
I found that the tests can throw a broken pipe warning.
I kept the associated check-and-retry of the length separate to
discuss the changes individually - feel free to squash them on
commit if preferred.
*Updates in v2*
tag with --subject-prefix='PATCH iproute2' to trigger the right
review queues in patchwork as requested by Luca Bocassi.
[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879854
Christian Ehrhardt (2):
tests: read limited amount from /dev/urandom
tests: make sure rand_dev suffix has 6 chars
testsuite/lib/generic.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH iproute2 v2 1/2] tests: read limited amount from /dev/urandom
2018-01-10 15:11 [PATCH iproute2 v2 0/2] tests: fix issues in autopkgtest environment Christian Ehrhardt
@ 2018-01-10 15:11 ` Christian Ehrhardt
2018-01-10 15:11 ` [PATCH iproute2 v2 2/2] tests: make sure rand_dev suffix has 6 chars Christian Ehrhardt
2018-01-10 16:31 ` [PATCH iproute2 v2 0/2] tests: fix issues in autopkgtest environment Stephen Hemminger
2 siblings, 0 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2018-01-10 15:11 UTC (permalink / raw)
To: Netdev; +Cc: Luca Boccassi, Christian Ehrhardt
In some test environments like e.g. Ubuntu & Debian autopkgtest it
can happen that while generating random device names the pipes
between tr and head are considered dead while processing.
That prints (non fatal) issues like:
Running ip/link/new_link.t [iproute2-this/4.13.0-17-generic]: tr:
write error: Broken pipe
tr: write error
PASS
This only happens if reading an infinite amount of chars with the
read from urandom, so reading a defined amount fixes the issue.
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
testsuite/lib/generic.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuite/lib/generic.sh b/testsuite/lib/generic.sh
index b7de704..3645ff5 100644
--- a/testsuite/lib/generic.sh
+++ b/testsuite/lib/generic.sh
@@ -87,7 +87,7 @@ ts_qdisc_available()
rand_dev()
{
- echo "dev-$(tr -dc "[:alpha:]" < /dev/urandom | head -c 6)"
+ echo "dev-$(head -c 250 /dev/urandom | tr -dc '[:alpha:]' | head -c 6)"
}
pr_failed()
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH iproute2 v2 2/2] tests: make sure rand_dev suffix has 6 chars
2018-01-10 15:11 [PATCH iproute2 v2 0/2] tests: fix issues in autopkgtest environment Christian Ehrhardt
2018-01-10 15:11 ` [PATCH iproute2 v2 1/2] tests: read limited amount from /dev/urandom Christian Ehrhardt
@ 2018-01-10 15:11 ` Christian Ehrhardt
2018-01-10 16:31 ` [PATCH iproute2 v2 0/2] tests: fix issues in autopkgtest environment Stephen Hemminger
2 siblings, 0 replies; 4+ messages in thread
From: Christian Ehrhardt @ 2018-01-10 15:11 UTC (permalink / raw)
To: Netdev; +Cc: Luca Boccassi, Christian Ehrhardt
The change to limit the read size from /dev/urandom is a tradeoff.
Reading too much can trigger an issue, but so it could if the
suggested 250 random chars would not contain enough [:alpha:] chars.
If they contain:
a) >=6 all is ok
b) [1-5] the devname would be shorter than expected (non fatal).
c) 0 things would break
In loops of hundreds of thousands it always was (a) for my, but since
if occuring in a test it might be hard to track what happened avoid
this issue by retrying on the length condition.
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
testsuite/lib/generic.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/testsuite/lib/generic.sh b/testsuite/lib/generic.sh
index 3645ff5..8cef20f 100644
--- a/testsuite/lib/generic.sh
+++ b/testsuite/lib/generic.sh
@@ -87,7 +87,11 @@ ts_qdisc_available()
rand_dev()
{
- echo "dev-$(head -c 250 /dev/urandom | tr -dc '[:alpha:]' | head -c 6)"
+ rnd=""
+ while [ ${#rnd} -ne 6 ]; do
+ rnd="$(head -c 250 /dev/urandom | tr -dc '[:alpha:]' | head -c 6)"
+ done
+ echo "dev-$rnd"
}
pr_failed()
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2 v2 0/2] tests: fix issues in autopkgtest environment
2018-01-10 15:11 [PATCH iproute2 v2 0/2] tests: fix issues in autopkgtest environment Christian Ehrhardt
2018-01-10 15:11 ` [PATCH iproute2 v2 1/2] tests: read limited amount from /dev/urandom Christian Ehrhardt
2018-01-10 15:11 ` [PATCH iproute2 v2 2/2] tests: make sure rand_dev suffix has 6 chars Christian Ehrhardt
@ 2018-01-10 16:31 ` Stephen Hemminger
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2018-01-10 16:31 UTC (permalink / raw)
To: Christian Ehrhardt; +Cc: Netdev, Luca Boccassi
On Wed, 10 Jan 2018 16:11:35 +0100
Christian Ehrhardt <christian.ehrhardt@canonical.com> wrote:
> Hi,
> while working on Debian bug [1] and the Ubuntu counterpart of it
> I found that the tests can throw a broken pipe warning.
>
> I kept the associated check-and-retry of the length separate to
> discuss the changes individually - feel free to squash them on
> commit if preferred.
>
> *Updates in v2*
> tag with --subject-prefix='PATCH iproute2' to trigger the right
> review queues in patchwork as requested by Luca Bocassi.
>
> [1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879854
>
> Christian Ehrhardt (2):
> tests: read limited amount from /dev/urandom
> tests: make sure rand_dev suffix has 6 chars
>
> testsuite/lib/generic.sh | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
Looks good. Applied.
The method of generating a name seems a bit overly complex.
Maybe using something like pwgen would be easier.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-10 16:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10 15:11 [PATCH iproute2 v2 0/2] tests: fix issues in autopkgtest environment Christian Ehrhardt
2018-01-10 15:11 ` [PATCH iproute2 v2 1/2] tests: read limited amount from /dev/urandom Christian Ehrhardt
2018-01-10 15:11 ` [PATCH iproute2 v2 2/2] tests: make sure rand_dev suffix has 6 chars Christian Ehrhardt
2018-01-10 16:31 ` [PATCH iproute2 v2 0/2] tests: fix issues in autopkgtest environment Stephen Hemminger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.