On Tue, Oct 10, 2023 at 11:28 AM Colin Cross <ccr...@google.com> wrote:
>
> The pidof tests try to block a subprocess forever by reading from
> stdout via /proc/self/fd/1.  This works for most stdout fds, but
> fails if stdout is a socket, which happens when running the tests
> in a sandbox in the Android build.  Create a named fifo and read
> on that instead.
> ---
>  tests/pidof.test | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

I forgot to include, this can be reproduced outside the sandbox by
using socat to make stdout a socket:

$ socat - EXEC:"scripts/test.sh pidof"
pidof:generated/{flags.h}
Compile generated/testdir/pidof
.....
./pidof-639615.test: line 2: /proc/self/fd/1: No such device or address
PASS: pidof short argv[1]
FAIL: pidof short argv[1] -x
echo -ne '' | 
"/usr/local/google/home/ccross/ssd/aosp/external/toybox/generated/testdir/pidof"
-x pidof-639615.test
--- expected 2023-10-10 11:29:58.370076418 -0700
+++ actual 2023-10-10 11:29:58.370076418 -0700
@@ -1 +0,0 @@
-639770
2023/10/10 11:29:58 socat[639614] E waitpid(): child 639615 exited with status 1
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to