Tags: flox/t3
Tags
fix: add sleep to fibonacci test I hadn't added a sleep to the fibonacci test previously because the delays added by the math being performed has always been sufficient to ensure that lines sent to stdout and stderr don't arrive out of order. But apparently the hydra.nixos.org build farm has faster machines because one managed to trip the race condition: https://hydra.nixos.org/build/290187717/log Adding 10ms sleep to make it signficantly more likely that lines sent to stdout and stderr will arrive in the right order.
fix: move midline-flush.c sleep to occur between flush() invocations We were doing the sleep() invocation between writing to the stdout/err file descriptors rather than between the times we were flushing them. This update divides the time slept by 3 (bringing it to approx 3x what it was before we encountered CI failures), while moving the sleep between the two flush() invocations. It also adds an extra sleep following the second flush() invocation to make sure that the kernel has time to communicate its contents before the subsequent test.
fix: expect less of kernel, sleep longer in tests Observed repeated test failures on CI running on aarch64-linux instances: > Failed test tests/100-lines > --- tests/100-lines.log 1970-01-01 00:00:01.000000000 +0000 > +++ /build/tmp.Xnq7ZeMG7J/100-lines.log 2025-01-29 15:07:16.278776269 +0000 > @@ -49,8 +49,8 @@ > line 25 to stdout > line 25 to stderr > line 26 to stdout > -line 26 to stderr > line 27 to stdout > +line 26 to stderr > line 27 to stderr > line 28 to stdout > line 28 to stderr > make: *** [Makefile:137: tests/100-lines/log] Error 1 This occurs when the kernel _actually_ delivers messages out of order to the stdout and stderr file descriptors, which is very much possible for the Linux kernel. There's really no resolution for this apart from lowering our expectations, and this patch roughly triples the time spent sleeping between lines sent to stdout/stderr by changing `sleep 0` to `sleep 0.01`: $ time sleep 0 real 0m0.003s user 0m0.004s sys 0m0.000s $ time sleep 0.01 real 0m0.013s user 0m0.002s sys 0m0.001s
fix: handle polls with both POLLIN and POLLHUP (#9) The behaviour of poll() seems to differ between Linux and Darwin when the child process has closed the pipe and poll() returns both POLLIN and POLLHUP set on the returned events value. On Linux this is a sign that we can read from the pipe one more time, but on Darwin it seems that POLLIN remains set after the final read so we need to add extra logic to make sure to stop polling for POLLIN after a failed read in the presence of POLLHUP. Also fix minor formatting issues introduced by Devin.
fix: address flushes that happen in the middle of a line Simplify the logic around capturing output from exec'd process. Swap the use of poll() with the more straightforward read() idiom in the (relatively simpler) stdout & stderr worker processes and add support for relaying lines received across multiple read() system calls. Also add test for testing lines received across multiple read calls. Also updated ANSI color palette and default colors.