netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
To: Netdev <netdev@vger.kernel.org>
Cc: Luca Boccassi <bluca@debian.org>,
	Christian Ehrhardt <christian.ehrhardt@canonical.com>
Subject: [PATCH iproute2 v2 1/2] tests: read limited amount from /dev/urandom
Date: Wed, 10 Jan 2018 16:11:36 +0100	[thread overview]
Message-ID: <1515597097-870-2-git-send-email-christian.ehrhardt@canonical.com> (raw)
In-Reply-To: <1515597097-870-1-git-send-email-christian.ehrhardt@canonical.com>

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

  reply	other threads:[~2018-01-10 15:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=1515597097-870-2-git-send-email-christian.ehrhardt@canonical.com \
    --to=christian.ehrhardt@canonical.com \
    --cc=bluca@debian.org \
    --cc=netdev@vger.kernel.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).