diff options
Diffstat (limited to 'srclib/apr/test/Makefile.win')
-rw-r--r-- | srclib/apr/test/Makefile.win | 284 |
1 files changed, 211 insertions, 73 deletions
diff --git a/srclib/apr/test/Makefile.win b/srclib/apr/test/Makefile.win index 0594694d..019124fb 100644 --- a/srclib/apr/test/Makefile.win +++ b/srclib/apr/test/Makefile.win @@ -1,22 +1,113 @@ # PROGRAMS includes all test programs built on this platform. # STDTEST_PORTABLE # test programs invoked via standard user interface, run on all platforms +# TESTS +# test modules invoked through the abts suite (./testall) # STDTEST_NONPORTABLE # test programs invoked via standard user interface, not portable # OTHER_PROGRAMS # programs such as sendfile, that have to be invoked in a special sequence # or with special parameters +# TESTALL_COMPONENTS +# programs such as globalmutexchild which the various TESTS will invoke +# to validate process creation, pipes, dso mechansims and so forth + +# Windows Specific; +# MODEL +# dynamic or static - refers to which set of bindings are desired +# and controls which libraries (apr-1 or libapr-1) will be linked. +# OUTDIR +# the library path of the libraries, and also the path within test/ +# where all of the tests for that library will be built + +!IFNDEF MODEL +MODEL=dynamic +!ENDIF + +INCDIR=../include + +!IFNDEF OUTDIR +!IF "$(MODEL)" == "static" +OUTDIR=LibR +!ELSE +OUTDIR=Release +!ENDIF + +!IF [$(COMSPEC) /c cl /nologo /? | find "x64" >NUL ] == 0 +OUTDIR=x64\$(OUTDIR) +!ENDIF +!ENDIF + +!IF !EXIST("$(OUTDIR)\.") +!IF ([$(COMSPEC) /C mkdir $(OUTDIR)] == 0) +!ENDIF +!ENDIF + +!IFNDEF INTDIR +INTDIR=$(OUTDIR) +!ELSE +!IF !EXIST("$(INTDIR)\.") +!IF ([$(COMSPEC) /C mkdir $(INTDIR)] == 0) +!ENDIF +!ENDIF +!ENDIF + +!MESSAGE Building tests into $(OUTDIR) for $(MODEL) STDTEST_PORTABLE = \ - testlockperf.exe \ - testshmproducer.exe \ - testshmconsumer.exe \ - testmutexscope.exe \ - testall.exe + $(OUTDIR)\testapp.exe \ + $(OUTDIR)\testall.exe \ + $(OUTDIR)\testlockperf.exe \ + $(OUTDIR)\testmutexscope.exe + +OTHER_PROGRAMS = \ + $(OUTDIR)\sendfile.exe + +TESTALL_COMPONENTS = \ + $(OUTDIR)\mod_test.dll \ + $(OUTDIR)\occhild.exe \ + $(OUTDIR)\readchild.exe \ + $(OUTDIR)\proc_child.exe \ + $(OUTDIR)\tryread.exe \ + $(OUTDIR)\sockchild.exe \ + $(OUTDIR)\testshmproducer.exe \ + $(OUTDIR)\testshmconsumer.exe \ + $(OUTDIR)\globalmutexchild.exe + +ALL_TESTS = $(INTDIR)\testutil.obj $(INTDIR)\testtime.obj \ + $(INTDIR)\teststr.obj $(INTDIR)\testvsn.obj \ + $(INTDIR)\testipsub.obj $(INTDIR)\testmmap.obj \ + $(INTDIR)\testud.obj $(INTDIR)\testtable.obj \ + $(INTDIR)\testsleep.obj $(INTDIR)\testpools.obj \ + $(INTDIR)\testfmt.obj $(INTDIR)\testfile.obj \ + $(INTDIR)\testdir.obj $(INTDIR)\testfileinfo.obj \ + $(INTDIR)\testrand.obj $(INTDIR)\testdso.obj \ + $(INTDIR)\testoc.obj $(INTDIR)\testdup.obj \ + $(INTDIR)\testsockets.obj $(INTDIR)\testproc.obj \ + $(INTDIR)\testpoll.obj $(INTDIR)\testlock.obj \ + $(INTDIR)\testsockopt.obj $(INTDIR)\testpipe.obj \ + $(INTDIR)\testthread.obj $(INTDIR)\testhash.obj \ + $(INTDIR)\testargs.obj $(INTDIR)\testnames.obj \ + $(INTDIR)\testuser.obj $(INTDIR)\testpath.obj \ + $(INTDIR)\testenv.obj $(INTDIR)\testprocmutex.obj \ + $(INTDIR)\testfnmatch.obj $(INTDIR)\testatomic.obj \ + $(INTDIR)\testflock.obj $(INTDIR)\testshm.obj \ + $(INTDIR)\testsock.obj $(INTDIR)\testglobalmutex.obj \ + $(INTDIR)\teststrnatcmp.obj $(INTDIR)\testfilecopy.obj \ + $(INTDIR)\testtemp.obj $(INTDIR)\testlfs.obj \ + $(INTDIR)\testrand2.obj + +CLEAN_DATA = testfile.tmp lfstests\large.bin \ + data\testputs.txt data\testbigfprintf.dat \ + data\testwritev.txt data\testwritev_full.txt \ + data\testflush.dat data\testxthread.dat \ + data\apr.testshm.shm -OTHER_PROGRAMS = sendfile.exe +CLEAN_BUILDDIRS = Debug Release LibD LibR 9x x64 -PROGRAMS = $(STDTEST_PORTABLE) $(STDTEST_NONPORTABLE) $(OTHER_PROGRAMS) +TEST_SUBDIRS = internal + +PROGRAMS = $(TESTALL_COMPONENTS) $(STDTEST_PORTABLE) $(STDTEST_NONPORTABLE) $(OTHER_PROGRAMS) TARGETS = $(PROGRAMS) @@ -24,95 +115,142 @@ TARGETS = $(PROGRAMS) ALL: $(TARGETS) CL = cl.exe +LD = link.exe -CFLAGS = /nologo /c /MDd /W3 /Gm /EHsc /Zi /Od /D _DEBUG /D WIN32 /D APR_DECLARE_STATIC /FD +!IF "$(MODEL)" == "static" +LOCAL_LIB= ..\$(OUTDIR)\apr-1.lib +APP_LIB= ..\build\$(OUTDIR)\apr_app-1.lib +STATIC_CFLAGS = /D APR_DECLARE_STATIC +!ELSE +LOCAL_LIB= ..\$(OUTDIR)\libapr-1.lib +APP_LIB= ..\build\$(OUTDIR)\libapr_app-1.lib +STATIC_CFLAGS = +!ENDIF -.c.obj:: - $(CL) -c $< $(CFLAGS) $(INCLUDES) +!IFDEF _DEBUG +DEBUG_CFLAGS = /MDd +!ELSE +DEBUG_CFLAGS = /MD +!ENDIF -LOCAL_LIBS= ../LibD/apr-1.lib -ALL_LIBS= kernel32.lib user32.lib advapi32.lib Rpcrt4.lib ws2_32.lib wsock32.lib ole32.lib +INCLUDES=/I "$(INCDIR)" +CFLAGS = /nologo /c /W3 /Gm /EHsc /Zi /Od $(INCLUDES) \ + $(STATIC_CFLAGS) $(DEBUG_CFLAGS) /D "BINPATH=$(OUTDIR:\=/)" \ + /D _DEBUG /D WIN32 /Fo"$(INTDIR)/" /FD -CLEAN_TARGETS = testfile.tmp mod_test.dll proc_child.exe occhild.exe \ - readchild.exe tryread.exe sockchild.exe \ - globalmutexchild.exe lfstests/large.bin \ - data/testputs.txt data/testbigfprintf.dat data/testwritev.txt \ - data/testwritev_full.txt -CLEAN_SUBDIRS = internal +LD_LIBS = kernel32.lib advapi32.lib ws2_32.lib wsock32.lib \ + ole32.lib shell32.lib rpcrt4.lib -INCDIR=../include -INCLUDES=/I "$(INCDIR)" +LDFLAGS = /nologo /debug /subsystem:console /incremental:no +SHLDFLAGS = /nologo /dll /debug /subsystem:windows /incremental:no + +.c{$(INTDIR)}.obj:: + $(CL) $(CFLAGS) -c $< -Fd$(INTDIR)\ $(INCLUDES) + +# STDTEST_PORTABLE; + +$(OUTDIR)\testall.exe: $(ALL_TESTS) $(INTDIR)\abts.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 + +$(OUTDIR)\testapp.exe: $(INTDIR)/testapp.obj $(LOCAL_LIB) $(APP_LIB) + $(LD) $(LDFLAGS) /entry:wmainCRTStartup /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;2 + +$(OUTDIR)\testlockperf.exe: $(INTDIR)\testlockperf.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 + +$(OUTDIR)\testmutexscope.exe: $(INTDIR)\testmutexscope.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 + +# OTHER_PROGRAMS; + +$(OUTDIR)\sendfile.exe: $(INTDIR)\sendfile.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 -# link programs using -no-install to get real executables not -# libtool wrapper scripts which link an executable when first run. -LINK_PROG = link.exe /nologo /debug /subsystem:console /incremental:no -LINK_LIB = link.exe /nologo /dll /debug /subsystem:windows /incremental:no +# TESTALL_COMPONENTS; -check: $(STDTEST_PORTABLE) $(STDTEST_NONPORTABLE) - for prog in $(STDTEST_PORTABLE) $(STDTEST_NONPORTABLE); do \ - ./$$prog; \ - if test $$? = 255; then \ - echo "$$prog failed"; \ - break; \ - fi; \ - done +$(OUTDIR)\globalmutexchild.exe: $(INTDIR)\globalmutexchild.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 -occhild.exe: occhild.obj $(LOCAL_LIBS) - $(LINK_PROG) occhild.obj $(LOCAL_LIBS) $(ALL_LIBS) +$(OUTDIR)\mod_test.dll: $(INTDIR)/mod_test.obj $(LOCAL_LIB) + $(LD) $(SHLDFLAGS) /out:"$@" $** \ + /export:print_hello /export:count_reps $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;2 -sockchild.exe: sockchild.obj $(LOCAL_LIBS) - $(LINK_PROG) sockchild.obj $(LOCAL_LIBS) $(ALL_LIBS) +$(OUTDIR)\occhild.exe: $(INTDIR)\occhild.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 -readchild.exe: readchild.obj $(LOCAL_LIBS) - $(LINK_PROG) readchild.obj $(LOCAL_LIBS) $(ALL_LIBS) +$(OUTDIR)\proc_child.exe: $(INTDIR)\proc_child.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 -globalmutexchild.exe: globalmutexchild.obj $(LOCAL_LIBS) - $(LINK_PROG) globalmutexchild.obj $(LOCAL_LIBS) $(ALL_LIBS) +$(OUTDIR)\readchild.exe: $(INTDIR)\readchild.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 -tryread.exe: tryread.obj $(LOCAL_LIBS) - $(LINK_PROG) tryread.obj $(LOCAL_LIBS) $(ALL_LIBS) +$(OUTDIR)\sockchild.exe: $(INTDIR)\sockchild.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 -proc_child.exe: proc_child.obj $(LOCAL_LIBS) - $(LINK_PROG) proc_child.obj $(LOCAL_LIBS) $(ALL_LIBS) +$(OUTDIR)\testshmconsumer.exe: $(INTDIR)\testshmconsumer.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 -# FIXME: -prefer-pic is only supported with libtool-1.4+ -mod_test.dll: mod_test.obj - $(LINK_LIB) mod_test.obj /export:print_hello /export:count_reps $(LOCAL_LIBS) $(ALL_LIBS) +$(OUTDIR)\testshmproducer.exe: $(INTDIR)\testshmproducer.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 -testlockperf.exe: testlockperf.obj $(LOCAL_LIBS) - $(LINK_PROG) testlockperf.obj $(LOCAL_LIBS) $(ALL_LIBS) +$(OUTDIR)\tryread.exe: $(INTDIR)\tryread.obj $(LOCAL_LIB) + $(LD) $(LDFLAGS) /out:"$@" $** $(LD_LIBS) + @if exist "$@.manifest" \ + mt.exe -manifest "$@.manifest" -outputresource:$@;1 -sendfile.exe: sendfile.obj $(LOCAL_LIBS) - $(LINK_PROG) sendfile.obj $(LOCAL_LIBS) $(ALL_LIBS) -testshmproducer.exe: testshmproducer.obj $(LOCAL_LIBS) - $(LINK_PROG) testshmproducer.obj $(LOCAL_LIBS) $(ALL_LIBS) +cleandata: + @for %f in ($(CLEAN_DATA)) do @if EXIST %f del /f %f -testshmconsumer.exe: testshmconsumer.obj $(LOCAL_LIBS) - $(LINK_PROG) testshmconsumer.obj $(LOCAL_LIBS) $(ALL_LIBS) +clean: cleandata + @if EXIST $(INTDIR)\. rmdir /s /q $(INTDIR) + @if EXIST $(OUTDIR)\. rmdir /s /q $(OUTDIR) + @for %d in ($(TEST_SUBDIRS)) do \ + %COMSPEC% /c "cd %%d && $(MAKE) -f Makefile.win clean" \ -testprocmutex.exe: testprocmutex.obj $(LOCAL_LIBS) - $(LINK_PROG) testprocmutex.obj $(LOCAL_LIBS) $(ALL_LIBS) +cleanall: + @for %d in ($(CLEAN_BUILDDIRS) $(INTDIR) $(OUTDIR)) do \ + @if EXIST %d\. rmdir /s /q %d + @for %d in ($(TEST_SUBDIRS)) do \ + %COMSPEC% /c "cd %%d & $(MAKE) -f Makefile.win cleanall" \ -testmutexscope.exe: testmutexscope.obj $(LOCAL_LIBS) - $(LINK_PROG) testmutexscope.obj $(LOCAL_LIBS) $(ALL_LIBS) -TESTS = testutil.obj testtime.obj teststr.obj testvsn.obj testipsub.obj \ - testmmap.obj testud.obj testtable.obj testsleep.obj testpools.obj \ - testfmt.obj testfile.obj testdir.obj testfileinfo.obj testrand.obj \ - testdso.obj testoc.obj testdup.obj testsockets.obj testproc.obj \ - testpoll.obj testlock.obj testsockopt.obj testpipe.obj testthread.obj \ - testhash.obj testargs.obj testnames.obj testuser.obj testpath.obj \ - testenv.obj testprocmutex.obj testrand2.obj testfnmatch.obj \ - testatomic.obj testflock.obj testshm.obj testsock.obj testglobalmutex.obj \ - teststrnatcmp.obj testfilecopy.obj testtemp.obj testlfs.obj +PATH=$(OUTDIR);..\$(OUTDIR);$(PATH) -testall.exe: $(TESTS) mod_test.dll occhild.exe \ - readchild.exe abts.obj proc_child.exe \ - tryread.exe sockchild.exe globalmutexchild.exe \ - $(LOCAL_LIBS) - $(LINK_PROG) /out:testall.exe $(TESTS) abts.obj $(LOCAL_LIBS) $(ALL_LIBS) +check: $(TESTALL_COMPONENTS) $(STDTEST_PORTABLE) $(STDTEST_NONPORTABLE) + @for %p in ($(STDTEST_PORTABLE) $(STDTEST_NONPORTABLE)) do @( \ + echo Testing %p && %p -v || echo %p failed \ + ) +checkall: check + @for %d in ($(TEST_SUBDIRS)) do \ + %COMSPEC% /c "cd %%d && $(MAKE) -f Makefile.win check" \ # DO NOT REMOVE |