On Tuesday 03 December 2024 16:12:33 Martin Storsjö wrote: > On Tue, 3 Dec 2024, LIU Hao wrote: > > > 在 2024-12-03 21:52, Martin Storsjö 写道: > > > I didn't look at the added test here (and not much on the test added > > > in an earlier patch series either); I'm not familiar with how to > > > build/run those tests. Can you briefly tell me how to use them? And > > > is it possible to execute the tests e.g. wrapped in wine on linux? > > > (That obviously doesn't always correctly indicate whether the tests > > > work correctly on windows, but it can be used as a quick extra check > > > at least.) > > > > > > > For automake, the standard way to build & run tests is `make check`. > > Right.. Is there any common standard way to just compile them but not run > them?
Tests are executed by check-TESTS rule from mingw-w64-crt/Makefile. The build process of those tests is via prerequisites of that rules. I looked into the autogeneated Makefile and there seems to be no target which can just build those prerequisites. So I do not know of any way how to do it. > > I have not tried test programs in Wine; automake doc suggests it's > > possible to provide a 'test runner' for the extension `.exe`: > > https://www.gnu.org/software/automake/manual/html_node/Parallel-Test-Harness.html > > Hmm, ok, that doesn't seem very straightforward - it seems like it would > require adjustments in Makefile.am to add such a wrapper tool, while I'd > like to do e.g. "make check WRAP=wine" or something like that, or just "make > check-compile" to only test compiling but leave execution to later. > > // Martin make check directly tries to execute exe file via ./binary.exe execution. So on Linux it is just needed to instruct kernel that execve() syscall for PE executables has to be redirected to /usr/bin/wine binary instead. This is possible via binfmt-misc. See its documentation, at the end is an example how to register wine for executing any file which starts with two bytes: MZ This is not precise as it catch all other binaries (DOS, OS/2, EFI, ... everything with MZ). https://docs.kernel.org/admin-guide/binfmt-misc.html Another option without touching binfmt-misc is misuse of automake LOG_COMPILER env variable. It is prepended before spawning any test, I guess it is for logging purpose. But it can be also wine which then spawns exe binary. So for example: make check LOG_COMPILER=wine Note that for compiling tests is used the system installed copy of the mingw-w64, not the one which was compiled in-tree. _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public