netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] tests: fix issues in autopkgtest environment
@ 2018-01-02  7:28 Christian Ehrhardt
  2018-01-02  7:28 ` [PATCH 1/2] tests: read limited amount from /dev/urandom Christian Ehrhardt
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Christian Ehrhardt @ 2018-01-02  7:28 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.

[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] 5+ messages in thread

* [PATCH 1/2] tests: read limited amount from /dev/urandom
  2018-01-02  7:28 [PATCH 0/2] tests: fix issues in autopkgtest environment Christian Ehrhardt
@ 2018-01-02  7:28 ` Christian Ehrhardt
  2018-01-02  7:28 ` [PATCH 2/2] tests: make sure rand_dev suffix has 6 chars Christian Ehrhardt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Christian Ehrhardt @ 2018-01-02  7:28 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] 5+ messages in thread

* [PATCH 2/2] tests: make sure rand_dev suffix has 6 chars
  2018-01-02  7:28 [PATCH 0/2] tests: fix issues in autopkgtest environment Christian Ehrhardt
  2018-01-02  7:28 ` [PATCH 1/2] tests: read limited amount from /dev/urandom Christian Ehrhardt
@ 2018-01-02  7:28 ` Christian Ehrhardt
  2018-01-02 11:22 ` [PATCH 0/2] tests: fix issues in autopkgtest environment Luca Boccassi
  2018-01-06 23:46 ` Luca Boccassi
  3 siblings, 0 replies; 5+ messages in thread
From: Christian Ehrhardt @ 2018-01-02  7:28 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] 5+ messages in thread

* Re: [PATCH 0/2] tests: fix issues in autopkgtest environment
  2018-01-02  7:28 [PATCH 0/2] tests: fix issues in autopkgtest environment Christian Ehrhardt
  2018-01-02  7:28 ` [PATCH 1/2] tests: read limited amount from /dev/urandom Christian Ehrhardt
  2018-01-02  7:28 ` [PATCH 2/2] tests: make sure rand_dev suffix has 6 chars Christian Ehrhardt
@ 2018-01-02 11:22 ` Luca Boccassi
  2018-01-06 23:46 ` Luca Boccassi
  3 siblings, 0 replies; 5+ messages in thread
From: Luca Boccassi @ 2018-01-02 11:22 UTC (permalink / raw)
  To: Christian Ehrhardt, Netdev

[-- Attachment #1: Type: text/plain, Size: 748 bytes --]

On Tue, 2018-01-02 at 08:28 +0100, Christian Ehrhardt 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.
> 
> [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(-)
> 

Series acked-by: Luca Boccassi <bluca@debian.org>

-- 
Kind regards,
Luca Boccassi

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] tests: fix issues in autopkgtest environment
  2018-01-02  7:28 [PATCH 0/2] tests: fix issues in autopkgtest environment Christian Ehrhardt
                   ` (2 preceding siblings ...)
  2018-01-02 11:22 ` [PATCH 0/2] tests: fix issues in autopkgtest environment Luca Boccassi
@ 2018-01-06 23:46 ` Luca Boccassi
  3 siblings, 0 replies; 5+ messages in thread
From: Luca Boccassi @ 2018-01-06 23:46 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Christian Ehrhardt, Netdev

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

On Tue, 2018-01-02 at 08:28 +0100, Christian Ehrhardt 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.
> 
> [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(-)
> 

Stephen,

The subject of this series is missing the "iproute2" tag so it likely
fell off the back of the wagon, could you have a look please?

Archive link:
https://marc.info/?l=linux-netdev&m=151487814431958&w=2

Patchwork:
https://patchwork.ozlabs.org/patch/854412/
https://patchwork.ozlabs.org/patch/854410/

Thanks

-- 
Kind regards,
Luca Boccassi

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-06 23:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-02  7:28 [PATCH 0/2] tests: fix issues in autopkgtest environment Christian Ehrhardt
2018-01-02  7:28 ` [PATCH 1/2] tests: read limited amount from /dev/urandom Christian Ehrhardt
2018-01-02  7:28 ` [PATCH 2/2] tests: make sure rand_dev suffix has 6 chars Christian Ehrhardt
2018-01-02 11:22 ` [PATCH 0/2] tests: fix issues in autopkgtest environment Luca Boccassi
2018-01-06 23:46 ` Luca Boccassi

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).