[yocto] [ptest-runner] Run ptests via stdbuf configured to line-buffering

Richard Purdie richard.purdie at linuxfoundation.org
Thu Apr 4 14:48:17 PDT 2019


On Thu, 2019-04-04 at 18:00 +0200, Alexander Kanavin wrote:
> As ptest-runner communicates with child processes via pipe2(),
> the corresponding channels are not attached to a pty. In that
> situation stdio facilities like printf() or fwrite() are fully
> buffered. If a ptest would use them, without bothering
> to fflush() the output, ptest-runner will only receive what
> was written by the child ptest process after a buffer gets filled.
> If the unit tests are proceeding slowly, this may mean that
> ptest-runner will erroneously timeout due to an apparent lack of
> 'signs of life' from the child process.
> 
> stdbuf utility from coreutils adjusts the buffering to a line-
> buffered
> one, and so ptest-runner will get the lines as soon as they are
> written.
> 
> Signed-off-by: Alexander Kanavin <alex.kanavin at gmail.com>
> ---
>  utils.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

I'm a little torn on this. I noticed some of the run-ptest scripts use
"| sed -u" whilst the one you were seeing problems with uses "| sed"
without -u.

We may want to consider strongly recommending -u. I'm testing a patch
with some tweaks like that in it...

Cheers,

Richard



More information about the yocto mailing list