Cygwin: Run testsuite against the just-built DLL

Since 4e7817498e, we're just running the tests against the installed
DLL.  We're arranging to put the build directory on the path, but since
it doesn't contain cygwin1.dll (since it's built with a different name
and renamed on installation), that doesn't have any effect.

Arrange to place the just-built DLL into a directory which the testsuite
can place on it's path (while running the test, but not while compiling
it).

Also fix any remaining references to cygwin0.dll in testsuite,
documentation and comments.

Fixes: 4e7817498e ("Cygwin: Makefile: Drop all the "test dll" considerations")
This commit is contained in:
Jon Turney 2022-12-23 13:05:34 +00:00
parent 13a7b16ea3
commit 1a9f95d894
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
7 changed files with 18 additions and 16 deletions

View File

@ -577,9 +577,9 @@ LIBSERVER = $(cygserver_blddir)/libcygserver.a
$(LIBSERVER): $(LIBSERVER):
$(MAKE) -C $(cygserver_blddir) libcygserver.a $(MAKE) -C $(cygserver_blddir) libcygserver.a
# We build as cygwin0.dll and rename at install time to overcome native # We build as new-cygwin1.dll and rename at install time to overcome native
# rebuilding issues (we don't want the build tools to see a partially built # rebuilding issues (we don't want the build tools to see a partially built
# cygwin.dll and attempt to use it instead of the old one). # cygwin1.dll and attempt to use it instead of the old one).
# linker script # linker script
LDSCRIPT=cygwin.sc LDSCRIPT=cygwin.sc
@ -601,6 +601,8 @@ $(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) $(LIBSERVER)\
$(newlib_build)/libm.a \ $(newlib_build)/libm.a \
$(newlib_build)/libc.a \ $(newlib_build)/libc.a \
-lgcc -lkernel32 -lntdll -Wl,-Map,cygwin.map -lgcc -lkernel32 -lntdll -Wl,-Map,cygwin.map
@$(MKDIR_P) ${target_builddir}/winsup/testsuite/runtime/
$(AM_V_at)$(INSTALL_PROGRAM) $(NEW_DLL_NAME) ${target_builddir}/winsup/testsuite/runtime/$(DLL_NAME)
# cygwin import library # cygwin import library
toolopts=--cpu=@target_cpu@ --ar=@AR@ --as=@AS@ --nm=@NM@ --objcopy=@OBJCOPY@ toolopts=--cpu=@target_cpu@ --ar=@AR@ --as=@AS@ --nm=@NM@ --objcopy=@OBJCOPY@
@ -712,7 +714,7 @@ install-ldif:
uninstall-hook: uninstall-headers uninstall-ldif uninstall-libs uninstall-hook: uninstall-headers uninstall-ldif uninstall-libs
uninstall-libs: uninstall-libs:
rm -f $(DESTDIR)$(bindir)/cygwin1.dll rm -f $(DESTDIR)$(bindir)/$(DLL_NAME)
rm -f $(DESTDIR)$(toollibdir)/libg.a rm -f $(DESTDIR)$(toollibdir)/libg.a
uninstall-headers: uninstall-headers:

View File

@ -9,7 +9,7 @@
# This will do a crude test to see if the (NO)?SIGFE stuff is used properly # This will do a crude test to see if the (NO)?SIGFE stuff is used properly
# in cygwin.din. It is not perfect so do not use it to do a wholesale replacement. # in cygwin.din. It is not perfect so do not use it to do a wholesale replacement.
# #
# Input is the output of 'objdump --disassemble --demangle cygwin0.dll'. # Input is the output of 'objdump --disassemble --demangle new-cygwin1.dll'.
# #
use strict; use strict;
use vars qw'$v'; use vars qw'$v';

View File

@ -45,7 +45,8 @@ testdll_tmpdir = $(shell cygpath -ma $(tmpdir) | sed -e 's#^\([A-Z]\):#/cygdrive
site-extra.exp: ../config.status Makefile site-extra.exp: ../config.status Makefile
@rm -f ./tmp0 @rm -f ./tmp0
@echo "set runtime_root \"`pwd`/../cygwin\"" >> ./tmp0 @echo "set runtime_root \"`pwd`/runtime\"" >> ./tmp0
@echo "set libdir \"`pwd`/../cygwin\"" >> ./tmp0
@echo "set CC \"$(CC)\"" >> ./tmp0 @echo "set CC \"$(CC)\"" >> ./tmp0
@echo "set CFLAGS \"\"" >> ./tmp0 @echo "set CFLAGS \"\"" >> ./tmp0
@echo "set MINGW_CXX \"$(MINGW_CXX)\"" >> ./tmp0 @echo "set MINGW_CXX \"$(MINGW_CXX)\"" >> ./tmp0

View File

@ -2,10 +2,9 @@
Here are some notes about adding and using this testsuite. Here are some notes about adding and using this testsuite.
First, all the programs are linked with libcygwin0.a, which is just The testsuite adds a directory containing the just built cygwin1.dll to the PATH
like libcygwin.a, except that it wants cygwin0.dll, not (during the run step) so that it can be found by the Windows loader during
cygwin1.dll. The testsuite adds the winsup build directory to the testing.
PATH so that cygwin0.dll can be found by windows during testing.
Because we'll probably run into complaints about using two DLLs, we Because we'll probably run into complaints about using two DLLs, we
run cygrun.exe for each test. All this does is run the test with run cygrun.exe for each test. All this does is run the test with
@ -36,5 +35,3 @@ Cross-checking is not supported.
To test a subset of the test-suite, use To test a subset of the test-suite, use
$ make check CYGWIN_TESTSUITE_TESTS=regexp $ make check CYGWIN_TESTSUITE_TESTS=regexp

View File

@ -1,7 +1,7 @@
proc winsup_version {} { proc winsup_version {} {
global env global env
global runtime_root global runtime_root
clone_output "\n[exec grep -a ^%%% $runtime_root/cygwin0.dll]\n" clone_output "\n[exec grep -a ^%%% $runtime_root/cygwin1.dll]\n"
if { [info exists env(CYGWIN)] } { if { [info exists env(CYGWIN)] } {
clone_output "CYGWIN=$env(CYGWIN)\n" clone_output "CYGWIN=$env(CYGWIN)\n"
} else { } else {

View File

@ -32,7 +32,7 @@ if { $rv != {0 {}} } {
set redirect_output /dev/null set redirect_output /dev/null
} }
set windows_runtime_root [exec cygpath -m $runtime_root] set windows_runtime_root [exec cygpath -m $runtime_root]
ws_spawn "./mingw-cygload.exe -cygwin $windows_runtime_root/cygwin0.dll > $redirect_output" ws_spawn "./mingw-cygload.exe -cygwin $windows_runtime_root/cygwin1.dll > $redirect_output"
if { $rv != {0 {}} } { if { $rv != {0 {}} } {
verbose -log "cygload: $rv" verbose -log "cygload: $rv"
fail "cygload (execute)" fail "cygload (execute)"

View File

@ -14,9 +14,9 @@ set ltp_libs "$ltp_libs"
set add_includes $ltp_includes set add_includes $ltp_includes
set add_libs $ltp_libs set add_libs $ltp_libs
set test_filter "" set orig_path "$env(PATH)"
set env(PATH) "$runtime_root:$env(PATH)" set test_filter ""
if { [info exists env(CYGWIN_TESTSUITE_TESTS)] } { if { [info exists env(CYGWIN_TESTSUITE_TESTS)] } {
set test_filter "$env(CYGWIN_TESTSUITE_TESTS)" set test_filter "$env(CYGWIN_TESTSUITE_TESTS)"
@ -61,7 +61,7 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.{cc
if [ file exists "$srcdir/$subdir/$basename.exp" ] then { if [ file exists "$srcdir/$subdir/$basename.exp" ] then {
source "$srcdir/$subdir/$basename.exp" source "$srcdir/$subdir/$basename.exp"
} else { } else {
ws_spawn "$CC -nodefaultlibs -mwin32 $CFLAGS $src $add_includes $add_libs $runtime_root/binmode.o -lgcc $runtime_root/libcygwin.a -lkernel32 -luser32 -o $base.exe" ws_spawn "$CC -nodefaultlibs -mwin32 $CFLAGS $src $add_includes $add_libs $libdir/binmode.o -lgcc $libdir/libcygwin.a -lkernel32 -luser32 -o $base.exe"
if { $rv } { if { $rv } {
fail "$testcase (compile)" fail "$testcase (compile)"
} else { } else {
@ -71,8 +71,10 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.{cc
set redirect_output /dev/null set redirect_output /dev/null
} }
file mkdir $tmpdir/$base file mkdir $tmpdir/$base
set env(PATH) "$runtime_root:$env(PATH)"
ws_spawn "$cygrun ./$base.exe $testdll_tmpdir/$base > $redirect_output" ws_spawn "$cygrun ./$base.exe $testdll_tmpdir/$base > $redirect_output"
file delete -force $tmpdir/$base file delete -force $tmpdir/$base
set env(PATH) "$orig_path"
if { $rv } { if { $rv } {
fail "$testcase (execute)" fail "$testcase (execute)"
if { $xfail_expected } { if { $xfail_expected } {