lava-test-runner shell script assumes 'read -t'

Bug #1092032 reported by Senthil Kumaran S
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
LAVA Dispatcher
Fix Released
Medium
Antonio Terceiro

Bug Description

When we call a test case via lava-test-shell and inside the test definition if we have a step which makes use of 'lava-test-case' then the lava-test-runner script assumes the current shell has 'read -t' command. This happens for tests run in android where we do not have 'read -t' option. An extract from the log is shown below:

<snip>
<LAVA_TEST_RUNNER>: running 0_busybox under lava-test-shell...
<LAVA_SIGNAL_STARTRUN 0_busybox c02dd49d-dbe4-45e9-8895-8012c86671ee>
echo LAVA_ACK > /lava_ack.fifo
root@linaro# /data/lava/tests/0_busybox/run.sh[9]: read: -t: unknown option
<LAVA_TEST_RUNNER>: 0_busybox exited with: 2
0_busybox-1357314707
hwcontext
swcontext
<LAVA_TEST_RUNNER>: calling sync
</snip>

The complete log is available here - https://validation.linaro.org/lava-server/scheduler/job/42479/log_file

Sample test definition for android is available here - http://git.linaro.org/gitweb?p=ubuntu/test-definitions.git;a=blob_plain;f=android/busybox.yaml

Related branches

Revision history for this message
Antonio Terceiro (terceiro) wrote : Re: [Bug 1092032] [NEW] lava-test-runner shell script assumes 'read -t'

BTW I discovered yesterday that when reading stdin from a fifo, `read
-t` does not work at all, i.e. the timeout never happens.

`read -t 1 < /tmp/fifo` will block until there is something to be read
in the fifo.

This behaviour is consistent across busybox sh, bash and dash.

I am dropping the `-t N` in my branches.

Changed in lava-dispatcher:
status: New → Confirmed
assignee: Linaro Validation Team (linaro-validation) → Antonio Terceiro (terceiro)
milestone: none → 2013.01
importance: Undecided → Medium
Revision history for this message
Andy Doan (doanac) wrote : Re: [Bug 1092032] Re: lava-test-runner shell script assumes 'read -t'

On 12/19/2012 07:50 AM, Antonio Terceiro wrote:
> BTW I discovered yesterday that when reading stdin from a fifo, `read
> -t` does not work at all, i.e. the timeout never happens.
>
> `read -t 1 < /tmp/fifo` will block until there is something to be read
> in the fifo.
>
> This behaviour is consistent across busybox sh, bash and dash.

works in my version of bash and busybox (one from
http://busybox.net/downloads/binaries/1.20.0/):

  $ ./busybox-x86_64 sh
  $ read -t 3 blah || echo "timeout"
  timeout

> I am dropping the `-t N` in my branches.

seems risky to me

Revision history for this message
Antonio Terceiro (terceiro) wrote :

On Wed, Dec 19, 2012 at 06:41:06PM -0000, Andy Doan wrote:
> On 12/19/2012 07:50 AM, Antonio Terceiro wrote:
> > BTW I discovered yesterday that when reading stdin from a fifo, `read
> > -t` does not work at all, i.e. the timeout never happens.
> >
> > `read -t 1 < /tmp/fifo` will block until there is something to be read
> > in the fifo.
> >
> > This behaviour is consistent across busybox sh, bash and dash.
>
> works in my version of bash and busybox (one from
> http://busybox.net/downloads/binaries/1.20.0/):
>
> $ ./busybox-x86_64 sh
> $ read -t 3 blah || echo "timeout"
> timeout

Try this:

$ ./busybox-x86_64 sh
$ mkfifo /tmp/fifo
$ read -t 3 blah < /tmp/fifo || echo "timeout"

It doesn't work when reading stdin from a FIFO ...

--
Antonio Terceiro
Software Engineer - Linaro
http://www.linaro.org

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Antonio Terceiro <email address hidden> writes:

> On Wed, Dec 19, 2012 at 06:41:06PM -0000, Andy Doan wrote:
>> On 12/19/2012 07:50 AM, Antonio Terceiro wrote:
>> > BTW I discovered yesterday that when reading stdin from a fifo, `read
>> > -t` does not work at all, i.e. the timeout never happens.
>> >
>> > `read -t 1 < /tmp/fifo` will block until there is something to be read
>> > in the fifo.
>> >
>> > This behaviour is consistent across busybox sh, bash and dash.
>>
>> works in my version of bash and busybox (one from
>> http://busybox.net/downloads/binaries/1.20.0/):
>>
>> $ ./busybox-x86_64 sh
>> $ read -t 3 blah || echo "timeout"
>> timeout
>
> Try this:
>
> $ ./busybox-x86_64 sh
> $ mkfifo /tmp/fifo
> $ read -t 3 blah < /tmp/fifo || echo "timeout"
>
> It doesn't work when reading stdin from a FIFO ...

FWIW, I see the same.

Changed in lava-dispatcher:
status: Confirmed → Fix Committed
Changed in lava-dispatcher:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.