bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6547: GNU coreutils 8.5 "make check" => tests/test-suite.log 8 of 36


From: Jim Meyering
Subject: bug#6547: GNU coreutils 8.5 "make check" => tests/test-suite.log 8 of 365 tests failed
Date: Mon, 05 Jul 2010 14:35:17 +0200

Pádraig Brady wrote:
> On 04/07/10 11:54, Pádraig Brady wrote:
>> On 02/07/10 12:27, Jost, Martin (NSN - DE/Munich) wrote:
>>> Yes, the system was reeeaaal slow.
>>> Ok, I will rebuild, look for the lib and try to add to the sleep.
>>
>> You just need to increase the "sleep .2"s in tests/misc/stdbuf
>> I'm now doing a change to repeat with increasing delays
>> time based tests like this.
>
> The promised patch to the tests is attached.
...

Thanks!

> diff --git a/tests/init.cfg b/tests/init.cfg
> index aecdd5a..c9b95d7 100644
> --- a/tests/init.cfg
> +++ b/tests/init.cfg
> @@ -357,4 +357,30 @@ working_umask_or_skip_()
>    esac
>  }
>
> +# Continually retry a function requiring a sufficient delay to _pass_
> +#     Example: retry_delay dd_reblock_1 .1 6
> +# This example will call the dd_reblock_1 function with
> +# an initial delay of .1 second and call it at most 6 times
> +# with a max delay of 3.2s (doubled each time), or a total of 6.3s
> +# Note ensure you do _not_ quote the parameter to GNU sleep in
> +# your function, as it may contain separate values that `sleep`
> +# needs to accumulate.
> +retry_delay_()
> +{
> +  local test_func="$1"

Please don't use double quotes right after an "=" when the RHS is a
variable reference.  They're not needed.

> +  local time_start="$2"

Maybe `delay', so it doesn't sound like a "starting time"?

> +  local time_tries="$3"

`max_n_tries'?

> +  local attempt=1
> +  local num_sleeps=$attempt
> +  local time_fail
> +  while [ $attempt -le $time_tries ]; do

We've tried to avoid use of "[...]", and instead use test.
Slightly less syntax that way, and only one byte longer:

     while test $attempt -le $time_tries; do

> +    local delay=$(yes "$time_start" | head -n$num_sleeps | tr '\n' ' ')

We've had portability problems with yes...|head pipes before, so something
like this will save a couple processes and should be more portable:

local delay=$($AWK -v n=$num_sleeps -v s="$delay" \
              'BEGIN { for (i=0;i<n;i++) t = s" "t; print t }'

> +    "$1" "$delay" && { time_fail=0; break; } || time_fail=1

I guess that should be "test_func", rather than "$1"?

> +    attempt=$(($attempt + 1))
> +    num_sleeps=$(($num_sleeps * 2))

These would be the first uses of $((...)).
I'm pretty sure that construct is not portable enough.
Please use $(expr ...) instead.

> +  done
> +  test "$time_fail" = 0
> +}
> +
>  sanitize_path_





reply via email to

[Prev in Thread] Current Thread [Next in Thread]