Closed dmik closed 5 years ago
While doing this, I found a couple of LIBC problems, see https://github.com/bitwiseworks/libc/issues/44 and https://github.com/bitwiseworks/libc/issues/46.
Also, our LIBC lacks pselect
. For now I just replaced it with select
but there is a chance that we will miss some child signals and need to emulate pselect by calling setmask
before and after select
in an atomic manner, see e.g. https://linux.die.net/man/2/pselect.
Ninja now compiles (bootstraps) and then can even rebuild itself sccessfully using its own build.ninja
recipe. Very good.
However, I spotted a bunch of tests in the package, built them and here is the result:
[223/249] SubprocessTest.BadCommandStderr
*** Failure in D:/Coding/qt5/qt5/qtwebengine/src/3rdparty/ninja/src/subprocess_test.cc:52
"" != subproc->GetOutput()
[226/249] SubprocessTest.InterruptParent
*** Failure in D:/Coding/qt5/qt5/qtwebengine/src/3rdparty/ninja/src/subprocess_test.cc:96
"We should have been interrupted"
[228/249] SubprocessTest.InterruptParentWithSigTerm
*** Failure in D:/Coding/qt5/qt5/qtwebengine/src/3rdparty/ninja/src/subprocess_test.cc:120
"We should have been interrupted"
[230/249] SubprocessTest.InterruptParentWithSigHup
*** Failure in D:/Coding/qt5/qt5/qtwebengine/src/3rdparty/ninja/src/subprocess_test.cc:144
"We should have been interrupted"
[249/249] ElideMiddle.ElideInTheMiddle
failed
As I predicted above, we have a couple of failures de to our "naive" pselect
workaround. I will look closer and those failures to see if they can be postponed for later. Other than that, the test result is very good too.
Ok, I've played around with failing tests quite a bit and here are the results.
This first failure is because the BadCommandStderr
test tries to run cmd.exe
and capture its otuput. However, this doesn't work because cmd.exe
is not a kLIBC-based process. In ninja we have to use socketpair
instead of pipe
for grabbing child process output because kLIBC select
only supports sockets and pipe
creates native pipes. kLIBC-based child processes recognize that a file descriptor is a socket and use recv/send
respectively to communicate through it. However, normal OS/2 executables know nothing about sockets (passed around as regular file handles) and therefore can't write to them. There are two solutions to this problem:
subprocess
implementation from scratch that will use native pipes and respective DosWaitNPipe
calls. (Now we use subprocess-posix.cc
with just a few minor changes one of which is changing pipe
to socketpair
and the other one is pselect
-> select
).select
. This is a long waiting task (https://github.com/bitwiseworks/libcx/issues/34), it's even more complex (with an advantage that many apps will benefit from that, not just one).Both tasks require at least several days to complete. Given that it's unlikely that we will face any issues w/o being able to grab non-kLIBC process output while building Chromium, I see no point in spending time on that now.
The rest of failures relates is due to this dash
ticket https://github.com/bitwiseworks/dash-os2/issues/1 (ninja
always uses the shell (sh -c
) to start processes which is dash
in or RPM environment). Once this issue is fixed, these three failing tests should start working. Since it's unlikely that this will give us any trouble with Chromium, it's postponed as well.
Other than that, we're good.
This build tool is used by the Chromium source tree.
Needed for #1.