Cygwin: Test failure - winsup.api /semtest.c
Description
-
In the semtest, the failure occurs because the
make_requestfunction in sem.cc returns-1. Initially, we couldn’t step into the cygserver code, but after adding the-g -Ogflags to the cygserver Makefile, we were able to trace into the failingmake_requestcall. -
Inside
make_request,cygserver_runningis set toCYGSERVER_UNAVAIL, causing the function to return -1. This value is assigned incygserver_initdue to a request failure incygserver_available. Thecygserver_availablecheck fails becausetransport->connectfails, which in turn is caused byCreateFileWreturning INVALID_HANDLE_VALUE in transport_pipes.cc file when the pipe file is not created properly. -
When cygserver is started manually in the test directory,
semtest,msgtest, andshmtestpass since they depend on cygserver. Even after placing cygserver in the same directory (winsup.api) as the tests, the testsuite still fails. In the testsuite run, failures appear with exit code 124 (timeout) though all cases pass except for one mismatch related to file mode which is similar to umask where mode support is missing. This shows SIGCHLD is not being delivered or handled so the parent never detects the child’s exit and times out. In both x86 native and cross builds, all three tests pass which confirms the issue is due to missing signal implementation and should be resolved once signals are implemented.
Acceptance criteria
-
winsup.api/semtestshould pass in aarch64 cygwin build.
In the semtest, the failure occurs because the make_request function in sem.cc returns -1. Initially, we couldn’t step into the cygserver code, but after adding the -g -Og flags to the cygserver Makefile, we were able to trace into the failing make_request call.
Inside make_request, cygserver_running is set to CYGSERVER_UNAVAIL, causing the function to return -1. This value is assigned in cygserver_init due to a request failure in cygserver_available. The cygserver_available check fails because transport->connect fails, which in turn is caused by CreateFileW returning INVALID_HANDLE_VALUE in transport_pipes.cc file when the pipe file is not created properly.
When cygserver is started manually in the same directory where the test files reside, the tests pass successfully. In this setup, semtest, msgtest, and shmtest all pass since they depend on cygserver. However, when run through the testsuite, the test fails. This indicates that the issue lies in the testing method rather than the functionality itself.