diff options
author | Stefan Fritsch <sf@sfritsch.de> | 2011-12-27 19:42:53 +0100 |
---|---|---|
committer | Stefan Fritsch <sf@sfritsch.de> | 2011-12-27 19:42:53 +0100 |
commit | db26b587c04799e75b6dd0fcd4b46aaa168f9161 (patch) | |
tree | 127af2f77fd3eddb75604ebecedeeea163325078 /srclib/apr/test | |
parent | d9f98b967bedecc0bffe82682d1ed4e06c9df687 (diff) | |
download | apache2-db26b587c04799e75b6dd0fcd4b46aaa168f9161.tar.gz |
Upstream tarball 2.2.15upstream/2.2.15
Diffstat (limited to 'srclib/apr/test')
26 files changed, 964 insertions, 189 deletions
diff --git a/srclib/apr/test/Makefile.win b/srclib/apr/test/Makefile.win index 9274dcd1..2e7842f1 100644 --- a/srclib/apr/test/Makefile.win +++ b/srclib/apr/test/Makefile.win @@ -123,11 +123,11 @@ LD = link.exe !IF "$(MODEL)" == "static" LOCAL_LIB= ..\$(OUTDIR)\apr-1.lib -APP_LIB= ..\build\$(OUTDIR)\apr_app-1.lib +APP_LIB= ..\$(OUTDIR)\aprapp-1.lib STATIC_CFLAGS = /D APR_DECLARE_STATIC !ELSE LOCAL_LIB= ..\$(OUTDIR)\libapr-1.lib -APP_LIB= ..\build\$(OUTDIR)\libapr_app-1.lib +APP_LIB= ..\$(OUTDIR)\libaprapp-1.lib STATIC_CFLAGS = !ENDIF diff --git a/srclib/apr/test/NWGNUaprtest b/srclib/apr/test/NWGNUaprtest index 56228e43..0c7f8c75 100644 --- a/srclib/apr/test/NWGNUaprtest +++ b/srclib/apr/test/NWGNUaprtest @@ -89,30 +89,30 @@ endif # This is used by the link 'name' directive to name the nlm. If left blank # TARGET_nlm (see below) will be used. # -NLM_NAME = aprtest +NLM_NAME =aprtest # # This is used by the link '-desc ' directive. # If left blank, NLM_NAME will be used. # -NLM_DESCRIPTION = NLM is to test the apr layer +NLM_DESCRIPTION = NLM is to test the apr layer # # This is used by the '-threadname' directive. If left blank, # NLM_NAME Thread will be used. # -NLM_THREAD_NAME = $(NLM_NAME) +NLM_THREAD_NAME = aprtest # # This is used by the '-screenname' directive. If left blank, # 'Apache for NetWare' Thread will be used. # -NLM_SCREEN_NAME = $(NLM_NAME) +NLM_SCREEN_NAME = aprtest # # If this is specified, it will override VERSION value in # $(APR_WORK)\build\NWGNUenvironment.inc # -NLM_VERSION = +NLM_VERSION = 1,0,0 # # If this is specified, it will override the default of 64K @@ -137,14 +137,14 @@ NLM_CHECK_SYM = # # If this is specified it will be used by the link '-flags' directive # -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION # # If this is specified it will be linked in with the XDCData option in the def # file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can # be disabled by setting APACHE_UNIPROC in the environment # -XDCDATA = +XDCDATA = # # Declare all target files (you must add your files here) @@ -154,7 +154,7 @@ XDCDATA = # If there is an NLM target, put it here # TARGET_nlm = \ - $(OBJDIR)/$(NLM_NAME).nlm \ + $(OBJDIR)/aprtest.nlm \ $(EOLIST) # @@ -254,9 +254,8 @@ FILE_nlm_copyright = # Any additional imports go here # FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ @libc.imp \ - @netware.imp \ + @$(APR)/aprlib.imp \ $(EOLIST) # @@ -264,7 +263,7 @@ FILES_nlm_Ximports = \ # FILES_nlm_exports = \ $(EOLIST) - + # # These are the OBJ files needed to create the LIB target above. # Paths must all use the '/' character diff --git a/srclib/apr/test/NWGNUechod b/srclib/apr/test/NWGNUechod new file mode 100644 index 00000000..45b00c77 --- /dev/null +++ b/srclib/apr/test/NWGNUechod @@ -0,0 +1,253 @@ +# +# Make sure all needed macro's are defined +# + +# +# Get the 'head' of the build environment if necessary. This includes default +# targets and paths to tools +# + +ifndef EnvironmentDefined +include $(APR_WORK)/build/NWGNUhead.inc +endif + +# +# These directories will be at the beginning of the include list, followed by +# INCDIRS +# +XINCDIRS += \ + $(APR)/include \ + $(APR)/include/arch/NetWare \ + $(EOLIST) + +# +# These flags will come after CFLAGS +# +XCFLAGS += \ + $(EOLIST) + +# +# These defines will come after DEFINES +# +XDEFINES += \ + $(EOLIST) + +# +# These flags will be added to the link.opt file +# +XLFLAGS += \ + $(EOLIST) + +# +# These values will be appended to the correct variables based on the value of +# RELEASE +# +ifeq "$(RELEASE)" "debug" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +ifeq "$(RELEASE)" "noopt" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +ifeq "$(RELEASE)" "release" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +# +# These are used by the link target if an NLM is being generated +# This is used by the link 'name' directive to name the nlm. If left blank +# TARGET_nlm (see below) will be used. +# +NLM_NAME = echod + +# +# This is used by the link '-desc ' directive. +# If left blank, NLM_NAME will be used. +# +NLM_DESCRIPTION = Echo Daemon NLM to test socket performance + +# +# This is used by the '-threadname' directive. If left blank, +# NLM_NAME Thread will be used. +# +NLM_THREAD_NAME = $(NLM_NAME) + +# +# This is used by the '-screenname' directive. If left blank, +# 'Apache for NetWare' Thread will be used. +# +NLM_SCREEN_NAME = $(NLM_NAME) + +# +# If this is specified, it will override VERSION value in +# $(APR_WORK)/build/NWGNUenvironment.inc +# +NLM_VERSION = + +# +# If this is specified, it will override the default of 64K +# +NLM_STACK_SIZE = + +# +# If this is specified it will be used by the link '-entry' directive +# +NLM_ENTRY_SYM = _LibCPrelude + +# +# If this is specified it will be used by the link '-exit' directive +# +NLM_EXIT_SYM = _LibCPostlude + +# +# If this is specified it will be used by the link '-check' directive +# +NLM_CHECK_SYM = + +# +# If this is specified it will be used by the link '-flags' directive +# +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE + +# +# If this is specified it will be linked in with the XDCData option in the def +# file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can +# be disabled by setting APACHE_UNIPROC in the environment +# +XDCDATA = + +# +# Declare all target files (you must add your files here) +# + +# +# If there is an NLM target, put it here +# +TARGET_nlm = \ + $(OBJDIR)/$(NLM_NAME).nlm \ + $(EOLIST) + +# +# If there is an LIB target, put it here +# +TARGET_lib = \ + $(EOLIST) + +# +# These are the OBJ files needed to create the NLM target above. +# Paths must all use the '/' character +# +FILES_nlm_objs = \ + $(OBJDIR)/$(NLM_NAME).o \ + $(OBJDIR)/nw_misc.o \ + $(EOLIST) + +# +# These are the LIB files needed to create the NLM target above. +# These will be added as a library command in the link.opt file. +# +FILES_nlm_libs = \ + libcpre.o \ + $(EOLIST) + +# +# These are the modules that the above NLM target depends on to load. +# These will be added as a module command in the link.opt file. +# +FILES_nlm_modules = \ + aprlib \ + Libc \ + $(EOLIST) + +# +# If the nlm has a msg file, put it's path here +# +FILE_nlm_msg = + +# +# If the nlm has a hlp file put it's path here +# +FILE_nlm_hlp = + +# +# If this is specified, it will override the default copyright. +# +FILE_nlm_copyright = + +# +# Any additional imports go here +# +FILES_nlm_Ximports = \ + @$(APR)/aprlib.imp \ + @libc.imp \ + $(EOLIST) + +# +# Any symbols exported to here +# +FILES_nlm_exports = \ + $(EOLIST) + +# +# These are the OBJ files needed to create the LIB target above. +# Paths must all use the '/' character +# +FILES_lib_objs = \ + $(EOLIST) + +# +# implement targets and dependancies (leave this section alone) +# + +libs :: $(OBJDIR) $(TARGET_lib) + +nlms :: libs $(TARGET_nlm) + +# +# Updated this target to create necessary directories and copy files to the +# correct place. (See $(APR_WORK)/build/NWGNUhead.inc for examples) +# +install :: nlms FORCE + +# +# Any specialized rules here +# + +# +# Include the 'tail' makefile that has targets that depend on variables defined +# in this makefile +# + +include $(APR_WORK)/build/NWGNUtail.inc + diff --git a/srclib/apr/test/NWGNUglobalmutexchild b/srclib/apr/test/NWGNUglobalmutexchild index 06f586d9..3d683bab 100644 --- a/srclib/apr/test/NWGNUglobalmutexchild +++ b/srclib/apr/test/NWGNUglobalmutexchild @@ -54,6 +54,7 @@ XDEFINES += \ XLFLAGS += \ $(EOLIST) + endif ifeq "$(RELEASE)" "noopt" @@ -91,19 +92,19 @@ endif # This is used by the link 'name' directive to name the nlm. If left blank # TARGET_nlm (see below) will be used. # -NLM_NAME = globalmutexchild +NLM_NAME = globalmutexchild # # This is used by the link '-desc ' directive. # If left blank, NLM_NAME will be used. # -NLM_DESCRIPTION = child NLM to test the global Mutex layer +NLM_DESCRIPTION = child NLM to test the global Mutex layer # # This is used by the '-threadname' directive. If left blank, # NLM_NAME Thread will be used. # -NLM_THREAD_NAME = $(NLM_NAME) +NLM_THREAD_NAME = globalmutexchild # # This is used by the '-screenname' directive. If left blank, @@ -115,7 +116,7 @@ NLM_SCREEN_NAME = DEFAULT # If this is specified, it will override VERSION value in # $(APR_WORK)\build\NWGNUenvironment.inc # -NLM_VERSION = +NLM_VERSION = 1,0,0 # # If this is specified, it will override the default of 64K @@ -140,7 +141,7 @@ NLM_CHECK_SYM = # # If this is specified it will be used by the link '-flags' directive # -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE # # If this is specified it will be linked in with the XDCData option in the def @@ -157,7 +158,7 @@ XDCDATA = # If there is an NLM target, put it here # TARGET_nlm = \ - $(OBJDIR)/$(NLM_NAME).nlm \ + $(OBJDIR)/globalmutexchild.nlm \ $(EOLIST) # @@ -171,7 +172,7 @@ TARGET_lib = \ # Paths must all use the '/' character # FILES_nlm_objs = \ - $(OBJDIR)/$(NLM_NAME).o \ + $(OBJDIR)/globalmutexchild.o \ $(EOLIST) # @@ -219,7 +220,7 @@ FILES_nlm_Ximports = \ # FILES_nlm_exports = \ $(EOLIST) - + # # These are the OBJ files needed to create the LIB target above. # Paths must all use the '/' character diff --git a/srclib/apr/test/NWGNUmakefile b/srclib/apr/test/NWGNUmakefile index fac4aaa4..d2f8b0ce 100644 --- a/srclib/apr/test/NWGNUmakefile +++ b/srclib/apr/test/NWGNUmakefile @@ -20,13 +20,15 @@ include $(APR_WORK)\build\NWGNUhead.inc # TARGET_nlm = \ $(OBJDIR)/aprtest.nlm \ + $(OBJDIR)/echod.nlm \ + $(OBJDIR)/globalmutexchild.nlm \ $(OBJDIR)/mod_test.nlm \ $(OBJDIR)/proc_child.nlm \ $(OBJDIR)/readchild.nlm \ - $(OBJDIR)/globalmutexchild.nlm \ $(OBJDIR)/sockchild.nlm \ - $(OBJDIR)/tryread.nlm \ + $(OBJDIR)/sockperf.nlm \ $(OBJDIR)/testatmc.nlm \ + $(OBJDIR)/tryread.nlm \ $(EOLIST) # diff --git a/srclib/apr/test/NWGNUmod_test b/srclib/apr/test/NWGNUmod_test index ae52bce5..3dfa6df4 100644 --- a/srclib/apr/test/NWGNUmod_test +++ b/srclib/apr/test/NWGNUmod_test @@ -54,6 +54,7 @@ XDEFINES += \ XLFLAGS += \ $(EOLIST) + endif ifeq "$(RELEASE)" "noopt" @@ -91,19 +92,19 @@ endif # This is used by the link 'name' directive to name the nlm. If left blank # TARGET_nlm (see below) will be used. # -NLM_NAME = mod_test +NLM_NAME = mod_test # # This is used by the link '-desc ' directive. # If left blank, NLM_NAME will be used. # -NLM_DESCRIPTION = DSO NLM to test the apr DSO loading layer +NLM_DESCRIPTION = DSO NLM to test the apr DSO loading layer # # This is used by the '-threadname' directive. If left blank, # NLM_NAME Thread will be used. # -NLM_THREAD_NAME = $(NLM_NAME) +NLM_THREAD_NAME = mod_test # # This is used by the '-screenname' directive. If left blank, @@ -115,7 +116,7 @@ NLM_SCREEN_NAME = DEFAULT # If this is specified, it will override VERSION value in # $(APR_WORK)\build\NWGNUenvironment.inc # -NLM_VERSION = +NLM_VERSION = 1,0,0 # # If this is specified, it will override the default of 64K @@ -140,14 +141,14 @@ NLM_CHECK_SYM = # # If this is specified it will be used by the link '-flags' directive # -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION # # If this is specified it will be linked in with the XDCData option in the def # file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can # be disabled by setting APACHE_UNIPROC in the environment # -XDCDATA = +XDCDATA = # # Declare all target files (you must add your files here) @@ -157,7 +158,7 @@ XDCDATA = # If there is an NLM target, put it here # TARGET_nlm = \ - $(OBJDIR)/$(NLM_NAME).nlm \ + $(OBJDIR)/mod_test.nlm \ $(EOLIST) # @@ -171,7 +172,7 @@ TARGET_lib = \ # Paths must all use the '/' character # FILES_nlm_objs = \ - $(OBJDIR)/$(NLM_NAME).o \ + $(OBJDIR)/mod_test.o \ $(EOLIST) # @@ -221,7 +222,7 @@ FILES_nlm_exports = \ print_hello \ count_reps \ $(EOLIST) - + # # These are the OBJ files needed to create the LIB target above. # Paths must all use the '/' character diff --git a/srclib/apr/test/NWGNUproc_child b/srclib/apr/test/NWGNUproc_child index 174ad5e0..49c1fab6 100644 --- a/srclib/apr/test/NWGNUproc_child +++ b/srclib/apr/test/NWGNUproc_child @@ -54,6 +54,7 @@ XDEFINES += \ XLFLAGS += \ $(EOLIST) + endif ifeq "$(RELEASE)" "noopt" @@ -91,19 +92,19 @@ endif # This is used by the link 'name' directive to name the nlm. If left blank # TARGET_nlm (see below) will be used. # -NLM_NAME = proc_child +NLM_NAME = proc_child # # This is used by the link '-desc ' directive. # If left blank, NLM_NAME will be used. # -NLM_DESCRIPTION = child NLM to test the proc layer +NLM_DESCRIPTION = child NLM to test the proc layer # # This is used by the '-threadname' directive. If left blank, # NLM_NAME Thread will be used. # -NLM_THREAD_NAME = $(NLM_NAME) +NLM_THREAD_NAME = proc_child # # This is used by the '-screenname' directive. If left blank, @@ -115,7 +116,7 @@ NLM_SCREEN_NAME = DEFAULT # If this is specified, it will override VERSION value in # $(APR_WORK)\build\NWGNUenvironment.inc # -NLM_VERSION = +NLM_VERSION = 1,0,0 # # If this is specified, it will override the default of 64K @@ -140,14 +141,14 @@ NLM_CHECK_SYM = # # If this is specified it will be used by the link '-flags' directive # -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE # # If this is specified it will be linked in with the XDCData option in the def # file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can # be disabled by setting APACHE_UNIPROC in the environment # -XDCDATA = +XDCDATA = # # Declare all target files (you must add your files here) @@ -157,7 +158,7 @@ XDCDATA = # If there is an NLM target, put it here # TARGET_nlm = \ - $(OBJDIR)/$(NLM_NAME).nlm \ + $(OBJDIR)/proc_child.nlm \ $(EOLIST) # @@ -171,7 +172,7 @@ TARGET_lib = \ # Paths must all use the '/' character # FILES_nlm_objs = \ - $(OBJDIR)/$(NLM_NAME).o \ + $(OBJDIR)/proc_child.o \ $(EOLIST) # @@ -219,7 +220,7 @@ FILES_nlm_Ximports = \ # FILES_nlm_exports = \ $(EOLIST) - + # # These are the OBJ files needed to create the LIB target above. # Paths must all use the '/' character diff --git a/srclib/apr/test/NWGNUreadchild b/srclib/apr/test/NWGNUreadchild index 7c4b9a6f..0fd984da 100644 --- a/srclib/apr/test/NWGNUreadchild +++ b/srclib/apr/test/NWGNUreadchild @@ -54,6 +54,7 @@ XDEFINES += \ XLFLAGS += \ $(EOLIST) + endif ifeq "$(RELEASE)" "noopt" @@ -91,19 +92,19 @@ endif # This is used by the link 'name' directive to name the nlm. If left blank # TARGET_nlm (see below) will be used. # -NLM_NAME = readchild +NLM_NAME = readchild # # This is used by the link '-desc ' directive. # If left blank, NLM_NAME will be used. # -NLM_DESCRIPTION = child NLM to test the pipe layer +NLM_DESCRIPTION = child NLM to test the pipe layer # # This is used by the '-threadname' directive. If left blank, # NLM_NAME Thread will be used. # -NLM_THREAD_NAME = $(NLM_NAME) +NLM_THREAD_NAME = readchild # # This is used by the '-screenname' directive. If left blank, @@ -115,7 +116,7 @@ NLM_SCREEN_NAME = DEFAULT # If this is specified, it will override VERSION value in # $(APR_WORK)\build\NWGNUenvironment.inc # -NLM_VERSION = +NLM_VERSION = 1,0,0 # # If this is specified, it will override the default of 64K @@ -140,14 +141,14 @@ NLM_CHECK_SYM = # # If this is specified it will be used by the link '-flags' directive # -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE # # If this is specified it will be linked in with the XDCData option in the def # file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can # be disabled by setting APACHE_UNIPROC in the environment # -XDCDATA = +XDCDATA = # # Declare all target files (you must add your files here) @@ -157,7 +158,7 @@ XDCDATA = # If there is an NLM target, put it here # TARGET_nlm = \ - $(OBJDIR)/$(NLM_NAME).nlm \ + $(OBJDIR)/readchild.nlm \ $(EOLIST) # @@ -171,7 +172,7 @@ TARGET_lib = \ # Paths must all use the '/' character # FILES_nlm_objs = \ - $(OBJDIR)/$(NLM_NAME).o \ + $(OBJDIR)/readchild.o \ $(EOLIST) # @@ -219,7 +220,7 @@ FILES_nlm_Ximports = \ # FILES_nlm_exports = \ $(EOLIST) - + # # These are the OBJ files needed to create the LIB target above. # Paths must all use the '/' character diff --git a/srclib/apr/test/NWGNUsockchild b/srclib/apr/test/NWGNUsockchild index d0a97cbe..16dac9e4 100644 --- a/srclib/apr/test/NWGNUsockchild +++ b/srclib/apr/test/NWGNUsockchild @@ -54,6 +54,7 @@ XDEFINES += \ XLFLAGS += \ $(EOLIST) + endif ifeq "$(RELEASE)" "noopt" @@ -91,19 +92,19 @@ endif # This is used by the link 'name' directive to name the nlm. If left blank # TARGET_nlm (see below) will be used. # -NLM_NAME = sockchild +NLM_NAME = sockchild # # This is used by the link '-desc ' directive. # If left blank, NLM_NAME will be used. # -NLM_DESCRIPTION = socket NLM to test sockets +NLM_DESCRIPTION = socket NLM to test sockets # # This is used by the '-threadname' directive. If left blank, # NLM_NAME Thread will be used. # -NLM_THREAD_NAME = $(NLM_NAME) +NLM_THREAD_NAME = sockchild # # This is used by the '-screenname' directive. If left blank, @@ -115,7 +116,7 @@ NLM_SCREEN_NAME = DEFAULT # If this is specified, it will override VERSION value in # $(APR_WORK)\build\NWGNUenvironment.inc # -NLM_VERSION = +NLM_VERSION = 1,0,0 # # If this is specified, it will override the default of 64K @@ -140,14 +141,14 @@ NLM_CHECK_SYM = # # If this is specified it will be used by the link '-flags' directive # -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE # # If this is specified it will be linked in with the XDCData option in the def # file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can # be disabled by setting APACHE_UNIPROC in the environment # -XDCDATA = +XDCDATA = # # Declare all target files (you must add your files here) @@ -157,7 +158,7 @@ XDCDATA = # If there is an NLM target, put it here # TARGET_nlm = \ - $(OBJDIR)/$(NLM_NAME).nlm \ + $(OBJDIR)/sockchild.nlm \ $(EOLIST) # @@ -171,7 +172,7 @@ TARGET_lib = \ # Paths must all use the '/' character # FILES_nlm_objs = \ - $(OBJDIR)/$(NLM_NAME).o \ + $(OBJDIR)/sockchild.o \ $(EOLIST) # @@ -219,7 +220,7 @@ FILES_nlm_Ximports = \ # FILES_nlm_exports = \ $(EOLIST) - + # # These are the OBJ files needed to create the LIB target above. # Paths must all use the '/' character diff --git a/srclib/apr/test/NWGNUsockperf b/srclib/apr/test/NWGNUsockperf new file mode 100644 index 00000000..c2d5f7d8 --- /dev/null +++ b/srclib/apr/test/NWGNUsockperf @@ -0,0 +1,253 @@ +# +# Make sure all needed macro's are defined +# + +# +# Get the 'head' of the build environment if necessary. This includes default +# targets and paths to tools +# + +ifndef EnvironmentDefined +include $(APR_WORK)/build/NWGNUhead.inc +endif + +# +# These directories will be at the beginning of the include list, followed by +# INCDIRS +# +XINCDIRS += \ + $(APR)/include \ + $(APR)/include/arch/NetWare \ + $(EOLIST) + +# +# These flags will come after CFLAGS +# +XCFLAGS += \ + $(EOLIST) + +# +# These defines will come after DEFINES +# +XDEFINES += \ + $(EOLIST) + +# +# These flags will be added to the link.opt file +# +XLFLAGS += \ + $(EOLIST) + +# +# These values will be appended to the correct variables based on the value of +# RELEASE +# +ifeq "$(RELEASE)" "debug" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +ifeq "$(RELEASE)" "noopt" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +ifeq "$(RELEASE)" "release" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +# +# These are used by the link target if an NLM is being generated +# This is used by the link 'name' directive to name the nlm. If left blank +# TARGET_nlm (see below) will be used. +# +NLM_NAME = sockperf + +# +# This is used by the link '-desc ' directive. +# If left blank, NLM_NAME will be used. +# +NLM_DESCRIPTION = socket NLM to test socket performance + +# +# This is used by the '-threadname' directive. If left blank, +# NLM_NAME Thread will be used. +# +NLM_THREAD_NAME = $(NLM_NAME) + +# +# This is used by the '-screenname' directive. If left blank, +# 'Apache for NetWare' Thread will be used. +# +NLM_SCREEN_NAME = $(NLM_NAME) + +# +# If this is specified, it will override VERSION value in +# $(APR_WORK)/build/NWGNUenvironment.inc +# +NLM_VERSION = + +# +# If this is specified, it will override the default of 64K +# +NLM_STACK_SIZE = + +# +# If this is specified it will be used by the link '-entry' directive +# +NLM_ENTRY_SYM = _LibCPrelude + +# +# If this is specified it will be used by the link '-exit' directive +# +NLM_EXIT_SYM = _LibCPostlude + +# +# If this is specified it will be used by the link '-check' directive +# +NLM_CHECK_SYM = + +# +# If this is specified it will be used by the link '-flags' directive +# +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE + +# +# If this is specified it will be linked in with the XDCData option in the def +# file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can +# be disabled by setting APACHE_UNIPROC in the environment +# +XDCDATA = + +# +# Declare all target files (you must add your files here) +# + +# +# If there is an NLM target, put it here +# +TARGET_nlm = \ + $(OBJDIR)/$(NLM_NAME).nlm \ + $(EOLIST) + +# +# If there is an LIB target, put it here +# +TARGET_lib = \ + $(EOLIST) + +# +# These are the OBJ files needed to create the NLM target above. +# Paths must all use the '/' character +# +FILES_nlm_objs = \ + $(OBJDIR)/$(NLM_NAME).o \ + $(OBJDIR)/nw_misc.o \ + $(EOLIST) + +# +# These are the LIB files needed to create the NLM target above. +# These will be added as a library command in the link.opt file. +# +FILES_nlm_libs = \ + libcpre.o \ + $(EOLIST) + +# +# These are the modules that the above NLM target depends on to load. +# These will be added as a module command in the link.opt file. +# +FILES_nlm_modules = \ + aprlib \ + Libc \ + $(EOLIST) + +# +# If the nlm has a msg file, put it's path here +# +FILE_nlm_msg = + +# +# If the nlm has a hlp file put it's path here +# +FILE_nlm_hlp = + +# +# If this is specified, it will override the default copyright. +# +FILE_nlm_copyright = + +# +# Any additional imports go here +# +FILES_nlm_Ximports = \ + @$(APR)/aprlib.imp \ + @libc.imp \ + $(EOLIST) + +# +# Any symbols exported to here +# +FILES_nlm_exports = \ + $(EOLIST) + +# +# These are the OBJ files needed to create the LIB target above. +# Paths must all use the '/' character +# +FILES_lib_objs = \ + $(EOLIST) + +# +# implement targets and dependancies (leave this section alone) +# + +libs :: $(OBJDIR) $(TARGET_lib) + +nlms :: libs $(TARGET_nlm) + +# +# Updated this target to create necessary directories and copy files to the +# correct place. (See $(APR_WORK)/build/NWGNUhead.inc for examples) +# +install :: nlms FORCE + +# +# Any specialized rules here +# + +# +# Include the 'tail' makefile that has targets that depend on variables defined +# in this makefile +# + +include $(APR_WORK)/build/NWGNUtail.inc + diff --git a/srclib/apr/test/NWGNUtestatmc b/srclib/apr/test/NWGNUtestatmc index 10782fda..dbbe4250 100644 --- a/srclib/apr/test/NWGNUtestatmc +++ b/srclib/apr/test/NWGNUtestatmc @@ -89,30 +89,30 @@ endif # This is used by the link 'name' directive to name the nlm. If left blank # TARGET_nlm (see below) will be used. # -NLM_NAME = testatmc +NLM_NAME =testatmc # # This is used by the link '-desc ' directive. # If left blank, NLM_NAME will be used. # -NLM_DESCRIPTION = NLM is to test the atomic functions +NLM_DESCRIPTION = NLM is to test the atomic functions # # This is used by the '-threadname' directive. If left blank, # NLM_NAME Thread will be used. # -NLM_THREAD_NAME = $(NLM_NAME) +NLM_THREAD_NAME = testatmc # # This is used by the '-screenname' directive. If left blank, # 'Apache for NetWare' Thread will be used. # -NLM_SCREEN_NAME = $(NLM_NAME) +NLM_SCREEN_NAME = testatmc # # If this is specified, it will override VERSION value in # $(APR_WORK)\build\NWGNUenvironment.inc # -NLM_VERSION = +NLM_VERSION = 1,0,0 # # If this is specified, it will override the default of 64K @@ -137,14 +137,14 @@ NLM_CHECK_SYM = # # If this is specified it will be used by the link '-flags' directive # -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION # # If this is specified it will be linked in with the XDCData option in the def # file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can # be disabled by setting APACHE_UNIPROC in the environment # -XDCDATA = +XDCDATA = # # Declare all target files (you must add your files here) @@ -154,7 +154,7 @@ XDCDATA = # If there is an NLM target, put it here # TARGET_nlm = \ - $(OBJDIR)/$(NLM_NAME).nlm \ + $(OBJDIR)/testatmc.nlm \ $(EOLIST) # @@ -172,6 +172,8 @@ FILES_nlm_objs = \ $(OBJDIR)/nw_misc.o \ $(EOLIST) +# Pending tests + # # These are the LIB files needed to create the NLM target above. # These will be added as a library command in the link.opt file. @@ -208,9 +210,8 @@ FILE_nlm_copyright = # Any additional imports go here # FILES_nlm_Ximports = \ - @$(APR)/aprlib.imp \ @libc.imp \ - @netware.imp \ + @$(APR)/aprlib.imp \ $(EOLIST) # @@ -218,7 +219,7 @@ FILES_nlm_Ximports = \ # FILES_nlm_exports = \ $(EOLIST) - + # # These are the OBJ files needed to create the LIB target above. # Paths must all use the '/' character diff --git a/srclib/apr/test/NWGNUtryread b/srclib/apr/test/NWGNUtryread index 12cdac3b..cc4aee02 100644 --- a/srclib/apr/test/NWGNUtryread +++ b/srclib/apr/test/NWGNUtryread @@ -54,6 +54,7 @@ XDEFINES += \ XLFLAGS += \ $(EOLIST) + endif ifeq "$(RELEASE)" "noopt" @@ -91,13 +92,13 @@ endif # This is used by the link 'name' directive to name the nlm. If left blank # TARGET_nlm (see below) will be used. # -NLM_NAME = tryread +NLM_NAME = tryread # # This is used by the link '-desc ' directive. # If left blank, NLM_NAME will be used. # -NLM_DESCRIPTION = reader NLM to test flock +NLM_DESCRIPTION = reader NLM to test flock # # This is used by the '-threadname' directive. If left blank, @@ -115,7 +116,7 @@ NLM_SCREEN_NAME = DEFAULT # If this is specified, it will override VERSION value in # $(APR_WORK)\build\NWGNUenvironment.inc # -NLM_VERSION = +NLM_VERSION = 1,0,0 # # If this is specified, it will override the default of 64K @@ -140,14 +141,14 @@ NLM_CHECK_SYM = # # If this is specified it will be used by the link '-flags' directive # -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE # # If this is specified it will be linked in with the XDCData option in the def # file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can # be disabled by setting APACHE_UNIPROC in the environment # -XDCDATA = +XDCDATA = # # Declare all target files (you must add your files here) @@ -157,7 +158,7 @@ XDCDATA = # If there is an NLM target, put it here # TARGET_nlm = \ - $(OBJDIR)/$(NLM_NAME).nlm \ + $(OBJDIR)/tryread.nlm \ $(EOLIST) # @@ -171,7 +172,7 @@ TARGET_lib = \ # Paths must all use the '/' character # FILES_nlm_objs = \ - $(OBJDIR)/$(NLM_NAME).o \ + $(OBJDIR)/tryread.o \ $(EOLIST) # @@ -219,7 +220,7 @@ FILES_nlm_Ximports = \ # FILES_nlm_exports = \ $(EOLIST) - + # # These are the OBJ files needed to create the LIB target above. # Paths must all use the '/' character diff --git a/srclib/apr/test/README b/srclib/apr/test/README index d1c4feab..408a6a22 100644 --- a/srclib/apr/test/README +++ b/srclib/apr/test/README @@ -53,7 +53,7 @@ Building the full driver All you need to do to build the full driver is run: - make testall + make To run it, run: diff --git a/srclib/apr/test/abts.c b/srclib/apr/test/abts.c index d23eefa9..500d7bab 100644 --- a/srclib/apr/test/abts.c +++ b/srclib/apr/test/abts.c @@ -306,7 +306,7 @@ void abts_ptr_notnull(abts_case *tc, const void *ptr, int lineno) tc->failed = TRUE; if (verbose) { - fprintf(stderr, "Line %d: Expected NULL, but saw <%p>\n", lineno, ptr); + fprintf(stderr, "Line %d: expected non-NULL, but saw NULL\n", lineno); fflush(stderr); } } diff --git a/srclib/apr/test/internal/Makefile.win b/srclib/apr/test/internal/Makefile.win index 9832b682..a881f078 100644 --- a/srclib/apr/test/internal/Makefile.win +++ b/srclib/apr/test/internal/Makefile.win @@ -44,7 +44,7 @@ INTDIR=$(OUTDIR) NONPORTABLE = \ $(OUTDIR)\testucs.exe -CLEAN_BUILDDIRS = Release Debug NT x64 +CLEAN_BUILDDIRS = Release Debug 9x x64 PROGRAMS = diff --git a/srclib/apr/test/internal/testucs.c b/srclib/apr/test/internal/testucs.c index abfa2121..4dc74dae 100644 --- a/srclib/apr/test/internal/testucs.c +++ b/srclib/apr/test/internal/testucs.c @@ -22,11 +22,56 @@ struct testval { unsigned char n[8]; - wchar_t w[4]; int nl; + wchar_t w[4]; int wl; }; +/* For reference; a table of invalid utf-8 encoded ucs-2/ucs-4 sequences. + * The table consists of start, end pairs for all invalid ranges. + * NO_UCS2_PAIRS will pass the reservered D800-DFFF values, halting at FFFF + * FULL_UCS4_MAPPER represents all 31 bit values to 7FFF FFFF + * + * We already tested these, because we ensure there is a 1:1 mapping across + * the entire range of byte values in each position of 1 to 6 byte sequences. + */ +struct testval malformed[] = [ + [[0x80,], 1,], /* 10000000 64 invalid leading continuation values */ + [[0xBF,], 1,], /* 10111111 64 invalid leading continuation values */ + [[0xC0,0x80], 2,], /* overshort mapping of 0000 */ + [[0xC1,0xBF], 2,], /* overshort mapping of 007F */ + [[0xE0,0x80,0x80,], 3,], /* overshort mapping of 0000 */ + [[0xE0,0x9F,0xBF,], 3,], /* overshort mapping of 07FF */ +#ifndef NO_UCS2_PAIRS + [[0xED,0xA0,0x80,], 3,], /* unexpected mapping of UCS-2 literal D800 */ + [[0xED,0xBF,0xBF,], 3,], /* unexpected mapping of UCS-2 literal DFFF */ +#endif + [[0xF0,0x80,0x80,0x80,], 4,], /* overshort mapping of 0000 */ + [[0xF0,0x8F,0xBF,0xBF,], 4,], /* overshort mapping of FFFF */ +#ifdef NO_UCS2_PAIRS + [[0xF0,0x90,0x80,0x80,], 4,], /* invalid too large value 0001 0000 */ + [[0xF4,0x8F,0xBF,0xBF,], 4,], /* invalid too large value 0010 FFFF */ +#endif +#ifndef FULL_UCS4_MAPPER + [[0xF4,0x90,0x80,0x80,], 4,], /* invalid too large value 0011 0000 */ + [[0xF7,0xBF,0xBF,0xBF,], 4,], /* invalid too large value 001F FFFF */ +#endif + [[0xF8,0x80,0x80,0x80,0x80,], 5,], /* overshort mapping of 0000 0000 */ + [[0xF8,0x87,0xBF,0xBF,0xBF,], 5,], /* overshort mapping of 001F FFFF */ +#ifndef FULL_UCS4_MAPPER + [[0xF8,0x88,0x80,0x80,0x80,], 5,], /* invalid too large value 0020 0000 */ + [[0xFB,0xBF,0xBF,0xBF,0xBF,], 5,], /* invalid too large value 03FF FFFF */ +#endif + [[0xFC,0x80,0x80,0x80,0x80,0x80,], 6,], /* overshort mapping 0000 0000 */ + [[0xFC,0x83,0xBF,0xBF,0xBF,0xBF,], 6,], /* overshort mapping 03FF FFFF */ +#ifndef FULL_UCS4_MAPPER + [[0xFC,0x84,0x80,0x80,0x80,0x80,], 6,], /* overshort mapping 0400 0000 */ + [[0xFD,0xBF,0xBF,0xBF,0xBF,0xBF,], 6,], /* overshort mapping 7FFF FFFF */ +#endif + [[0xFE,], 1,], /* 11111110 invalid "too large" value, no 7 byte seq */ + [[0xFF,], 1,], /* 11111111 invalid "too large" value, no 8 byte seq */ +]; + void displaynw(struct testval *f, struct testval *l) { char x[80], *t = x; diff --git a/srclib/apr/test/nw_misc.c b/srclib/apr/test/nw_misc.c index d00ef0e0..2c1e5e2b 100644 --- a/srclib/apr/test/nw_misc.c +++ b/srclib/apr/test/nw_misc.c @@ -1,6 +1,4 @@ #include <stdlib.h> -#include <netware.h> -#include <screen.h> /* #include "testutil.h" */ @@ -8,12 +6,7 @@ /* function to keep the screen open if not launched from bash */ void _NonAppStop( void ) { - if (getenv("_IN_NETWARE_BASH_") == NULL) { - uint16_t row, col; - - GetScreenSize(&row, &col); - gotorowcol(row-1, 0); - printf("<Press any key to close screen> "); + printf("\r\n<Press any key to close screen> "); getcharacter(); } } diff --git a/srclib/apr/test/sendfile.c b/srclib/apr/test/sendfile.c index 8e540985..488d2648 100644 --- a/srclib/apr/test/sendfile.c +++ b/srclib/apr/test/sendfile.c @@ -27,7 +27,7 @@ #if !APR_HAS_SENDFILE int main(void) { - fprintf(stderr, + fprintf(stderr, "This program won't work on this platform because there is no " "support for sendfile().\n"); return 0; @@ -108,7 +108,7 @@ static void create_testfile(apr_pool_t *p, const char *fname) apr_finfo_t finfo; printf("Creating a test file...\n"); - rv = apr_file_open(&f, fname, + rv = apr_file_open(&f, fname, APR_CREATE | APR_WRITE | APR_TRUNCATE | APR_BUFFERED, APR_UREAD | APR_UWRITE, p); if (rv) { @@ -116,7 +116,7 @@ static void create_testfile(apr_pool_t *p, const char *fname) rv, apr_strerror(rv, buf, sizeof buf)); exit(1); } - + buf[0] = FILE_DATA_CHAR; buf[1] = '\0'; for (i = 0; i < FILE_LENGTH; i++) { @@ -154,7 +154,7 @@ static void create_testfile(apr_pool_t *p, const char *fname) } if (finfo.size != FILE_LENGTH) { - fprintf(stderr, + fprintf(stderr, "test file %s should be %ld-bytes long\n" "instead it is %ld-bytes long\n", fname, @@ -209,9 +209,9 @@ static int client(client_socket_mode_t socket_mode, char *host) rv = apr_socket_connect(sock, destsa); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_connect()->%d/%s\n", + fprintf(stderr, "apr_socket_connect()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -223,7 +223,7 @@ static int client(client_socket_mode_t socket_mode, char *host) /* set it non-blocking */ rv = apr_socket_opt_set(sock, APR_SO_NONBLOCK, 1); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_opt_set(APR_SO_NONBLOCK)->%d/%s\n", + fprintf(stderr, "apr_socket_opt_set(APR_SO_NONBLOCK)->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -233,7 +233,7 @@ static int client(client_socket_mode_t socket_mode, char *host) /* set a timeout */ rv = apr_socket_timeout_set(sock, 100 * APR_USEC_PER_SEC); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_opt_set(APR_SO_NONBLOCK)->%d/%s\n", + fprintf(stderr, "apr_socket_opt_set(APR_SO_NONBLOCK)->%d/%s\n", rv, apr_strerror(rv, buf, sizeof buf)); exit(1); @@ -267,11 +267,11 @@ static int client(client_socket_mode_t socket_mode, char *host) assert(hdtr.trailers[2].iov_base); hdtr.trailers[2].iov_len = TRL3_LEN; - expected_len = + expected_len = strlen(HDR1) + strlen(HDR2) + HDR3_LEN + strlen(TRL1) + strlen(TRL2) + TRL3_LEN + FILE_LENGTH; - + if (socket_mode == BLK) { current_file_offset = 0; len = FILE_LENGTH; @@ -282,13 +282,13 @@ static int client(client_socket_mode_t socket_mode, char *host) apr_strerror(rv, buf, sizeof buf)); exit(1); } - + printf("apr_socket_sendfile() updated offset with %ld\n", (long int)current_file_offset); - + printf("apr_socket_sendfile() updated len with %ld\n", (long int)len); - + printf("bytes really sent: %" APR_SIZE_T_FMT "\n", expected_len); @@ -313,7 +313,7 @@ static int client(client_socket_mode_t socket_mode, char *host) pfd.desc.s = sock; pfd.client_data = NULL; - rv = apr_pollset_add(pset, &pfd); + rv = apr_pollset_add(pset, &pfd); assert(!rv); total_bytes_sent = 0; @@ -368,8 +368,8 @@ static int client(client_socket_mode_t socket_mode, char *host) } else { hdtr.headers[0].iov_len -= tmplen; - hdtr.headers[0].iov_base = - (char*) hdtr.headers[0].iov_base + tmplen; + hdtr.headers[0].iov_base = + (char*) hdtr.headers[0].iov_base + tmplen; tmplen = 0; } } @@ -401,14 +401,14 @@ static int client(client_socket_mode_t socket_mode, char *host) } else { hdtr.trailers[0].iov_len -= tmplen; - hdtr.trailers[0].iov_base = - (char *)hdtr.trailers[0].iov_base + tmplen; + hdtr.trailers[0].iov_base = + (char *)hdtr.trailers[0].iov_base + tmplen; tmplen = 0; } } } while (total_bytes_sent < expected_len && - (rv == APR_SUCCESS || + (rv == APR_SUCCESS || (APR_STATUS_IS_EAGAIN(rv) && socket_mode != TIMEOUT))); if (total_bytes_sent != expected_len) { fprintf(stderr, @@ -424,13 +424,13 @@ static int client(client_socket_mode_t socket_mode, char *host) exit(1); } } - + current_file_offset = 0; rv = apr_file_seek(f, APR_CUR, ¤t_file_offset); if (rv != APR_SUCCESS) { fprintf(stderr, "apr_file_seek()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -442,7 +442,7 @@ static int client(client_socket_mode_t socket_mode, char *host) if (rv != APR_SUCCESS) { fprintf(stderr, "apr_socket_shutdown()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -453,16 +453,16 @@ static int client(client_socket_mode_t socket_mode, char *host) if (rv != APR_SUCCESS) { fprintf(stderr, "apr_socket_timeout_set()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } - + bytes_read = 1; rv = apr_socket_recv(sock, buf, &bytes_read); if (rv != APR_EOF) { fprintf(stderr, "apr_socket_recv()->%d/%s (expected APR_EOF)\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != 0) { @@ -478,7 +478,7 @@ static int client(client_socket_mode_t socket_mode, char *host) if (rv != APR_SUCCESS) { fprintf(stderr, "apr_file_remove()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -504,7 +504,7 @@ static int server(void) if (rv != APR_SUCCESS) { fprintf(stderr, "apr_socket_opt_set()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -512,7 +512,7 @@ static int server(void) if (rv != APR_SUCCESS) { fprintf(stderr, "apr_sockaddr_info_get()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -520,7 +520,7 @@ static int server(void) if (rv != APR_SUCCESS) { fprintf(stderr, "apr_socket_bind()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -528,7 +528,7 @@ static int server(void) if (rv != APR_SUCCESS) { fprintf(stderr, "apr_socket_listen()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -538,7 +538,7 @@ static int server(void) if (rv != APR_SUCCESS) { fprintf(stderr, "apr_socket_accept()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -550,7 +550,7 @@ static int server(void) if (rv != APR_SUCCESS) { fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != strlen(HDR1)) { @@ -563,14 +563,14 @@ static int server(void) (int)bytes_read, buf, HDR1); exit(1); } - + assert(sizeof buf > strlen(HDR2)); bytes_read = strlen(HDR2); rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != strlen(HDR2)) { @@ -608,7 +608,7 @@ static int server(void) exit(1); } } - + for (i = 0; i < FILE_LENGTH; i++) { bytes_read = 1; rv = apr_socket_recv(newsock, buf, &bytes_read); @@ -633,14 +633,14 @@ static int server(void) exit(1); } } - + assert(sizeof buf > strlen(TRL1)); bytes_read = strlen(TRL1); rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != strlen(TRL1)) { @@ -653,14 +653,14 @@ static int server(void) (int)bytes_read, buf, TRL1); exit(1); } - + assert(sizeof buf > strlen(TRL2)); bytes_read = strlen(TRL2); rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { fprintf(stderr, "apr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != strlen(TRL2)) { @@ -698,13 +698,13 @@ static int server(void) exit(1); } } - + bytes_read = 1; rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_EOF) { fprintf(stderr, "apr_socket_recv()->%d/%s (expected APR_EOF)\n", rv, - apr_strerror(rv, buf, sizeof buf)); + apr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != 0) { @@ -725,14 +725,14 @@ int main(int argc, char *argv[]) signal(SIGPIPE, SIG_IGN); #endif - /* Gee whiz this is goofy logic but I wanna drive sendfile right now, + /* Gee whiz this is goofy logic but I wanna drive sendfile right now, * not dork around with the command line! */ if (argc >= 3 && !strcmp(argv[1], "client")) { char *host = 0; if (argv[3]) { host = argv[3]; - } + } if (!strcmp(argv[2], "blocking")) { return client(BLK, host); } @@ -747,7 +747,7 @@ int main(int argc, char *argv[]) return server(); } - fprintf(stderr, + fprintf(stderr, "Usage: %s client {blocking|nonblocking|timeout}\n" " %s server\n", argv[0], argv[0]); diff --git a/srclib/apr/test/sockchild.c b/srclib/apr/test/sockchild.c index 3803d00a..ec7ffb85 100644 --- a/srclib/apr/test/sockchild.c +++ b/srclib/apr/test/sockchild.c @@ -76,5 +76,9 @@ int main(int argc, char *argv[]) apr_socket_close(sock); exit((int)length); } + else if (!strcmp("close", argv[1])) { + apr_socket_close(sock); + exit(0); + } exit(-1); } diff --git a/srclib/apr/test/testall.dsw b/srclib/apr/test/testall.dsw index f9abcbc5..c56452a0 100644 --- a/srclib/apr/test/testall.dsw +++ b/srclib/apr/test/testall.dsw @@ -15,7 +15,7 @@ Package=<4> ############################################################################### -Project: "apr_app"="..\build\apr_app.dsp" - Package Owner=<4> +Project: "aprapp"="..\build\aprapp.dsp" - Package Owner=<4> Package=<5> {{{ @@ -24,7 +24,7 @@ Package=<5> Package=<4> {{{ Begin Project Dependency - Project_Dep_Name apr + Project_Dep_Name preaprapp End Project Dependency }}} @@ -42,7 +42,37 @@ Package=<4> ############################################################################### -Project: "libapr_app"="..\build\libapr_app.dsp" - Package Owner=<4> +Project: "libaprapp"="..\build\libaprapp.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name prelibaprapp + End Project Dependency +}}} + +############################################################################### + +Project: "preaprapp"="..\build\preaprapp.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name apr + End Project Dependency +}}} + +############################################################################### + +Project: "prelibaprapp"="..\build\prelibaprapp.dsp" - Package Owner=<4> Package=<5> {{{ @@ -69,7 +99,7 @@ Package=<4> Project_Dep_Name libapr End Project Dependency Begin Project Dependency - Project_Dep_Name libapr_app + Project_Dep_Name libaprapp End Project Dependency }}} @@ -87,7 +117,7 @@ Package=<4> Project_Dep_Name apr End Project Dependency Begin Project Dependency - Project_Dep_Name apr_app + Project_Dep_Name aprapp End Project Dependency }}} diff --git a/srclib/apr/test/testdll.dsp b/srclib/apr/test/testdll.dsp index 6c2c945e..9736fc9b 100644 --- a/srclib/apr/test/testdll.dsp +++ b/srclib/apr/test/testdll.dsp @@ -19,8 +19,8 @@ CFG=testdll - Win32 Release !MESSAGE !MESSAGE "testdll - Win32 Release" (based on "Win32 (x86) External Target") !MESSAGE "testdll - Win32 Debug" (based on "Win32 (x86) External Target") -!MESSAGE "testdll - Win32 ReleaseNT" (based on "Win32 (x86) External Target") -!MESSAGE "testdll - Win32 DebugNT" (based on "Win32 (x86) External Target") +!MESSAGE "testdll - Win32 Release9x" (based on "Win32 (x86) External Target") +!MESSAGE "testdll - Win32 Debug9x" (based on "Win32 (x86) External Target") !MESSAGE "testdll - x64 Release" (based on "Win32 (x86) External Target") !MESSAGE "testdll - x64 Debug" (based on "Win32 (x86) External Target") !MESSAGE @@ -72,45 +72,45 @@ CFG=testdll - Win32 Release # PROP Bsc_Name "" # PROP Target_Dir "" -!ELSEIF "$(CFG)" == "testdll - Win32 ReleaseNT" +!ELSEIF "$(CFG)" == "testdll - Win32 Release9x" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "" # PROP BASE Intermediate_Dir "" -# PROP BASE Cmd_Line "NMAKE /f Makefile.win INTDIR=NT\Release OUTDIR=NT\Release MODEL=dynamic all check" +# PROP BASE Cmd_Line "NMAKE /f Makefile.win INTDIR=9x\Release OUTDIR=9x\Release MODEL=dynamic all check" # PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "NT\Release\testall.exe" +# PROP BASE Target_File "9x\Release\testall.exe" # PROP BASE Bsc_Name "" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "" # PROP Intermediate_Dir "" -# PROP Cmd_Line "NMAKE /f Makefile.win INTDIR=NT\Release OUTDIR=NT\Release MODEL=dynamic all check" +# PROP Cmd_Line "NMAKE /f Makefile.win INTDIR=9x\Release OUTDIR=9x\Release MODEL=dynamic all check" # PROP Rebuild_Opt "/a" -# PROP Target_File "NT\Release\testall.exe" +# PROP Target_File "9x\Release\testall.exe" # PROP Bsc_Name "" # PROP Target_Dir "" -!ELSEIF "$(CFG)" == "testdll - Win32 DebugNT" +!ELSEIF "$(CFG)" == "testdll - Win32 Debug9x" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "" # PROP BASE Intermediate_Dir "" -# PROP BASE Cmd_Line "NMAKE /f Makefile.win INTDIR=NT\Debug OUTDIR=NT\Debug MODEL=dynamic _DEBUG=1 all check" +# PROP BASE Cmd_Line "NMAKE /f Makefile.win INTDIR=9x\Debug OUTDIR=9x\Debug MODEL=dynamic _DEBUG=1 all check" # PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "NT\Debug\testall.exe" +# PROP BASE Target_File "9x\Debug\testall.exe" # PROP BASE Bsc_Name "" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "" # PROP Intermediate_Dir "" -# PROP Cmd_Line "NMAKE /f Makefile.win INTDIR=NT\Debug OUTDIR=NT\Debug MODEL=dynamic _DEBUG=1 all check" +# PROP Cmd_Line "NMAKE /f Makefile.win INTDIR=9x\Debug OUTDIR=9x\Debug MODEL=dynamic _DEBUG=1 all check" # PROP Rebuild_Opt "/a" -# PROP Target_File "NT\Debug\testall.exe" +# PROP Target_File "9x\Debug\testall.exe" # PROP Bsc_Name "" # PROP Target_Dir "" @@ -162,8 +162,8 @@ CFG=testdll - Win32 Release # Name "testdll - Win32 Release" # Name "testdll - Win32 Debug" -# Name "testdll - Win32 ReleaseNT" -# Name "testdll - Win32 DebugNT" +# Name "testdll - Win32 Release9x" +# Name "testdll - Win32 Debug9x" # Name "testdll - x64 Release" # Name "testdll - x64 Debug" # Begin Group "testall Source Files" diff --git a/srclib/apr/test/testdso.c b/srclib/apr/test/testdso.c index 6ab94010..0d9f27bb 100644 --- a/srclib/apr/test/testdso.c +++ b/srclib/apr/test/testdso.c @@ -38,7 +38,7 @@ #elif defined(DARWIN) # define MOD_NAME ".libs/mod_test.so" # define LIB_NAME ".libs/libmod_test.dylib" -#elif defined(__hpux__) || defined(__hpux) +#elif (defined(__hpux__) || defined(__hpux)) && !defined(__ia64) # define MOD_NAME ".libs/mod_test.sl" # define LIB_NAME ".libs/libmod_test.sl" #elif defined(_AIX) || defined(__bsdi__) diff --git a/srclib/apr/test/testfile.c b/srclib/apr/test/testfile.c index dd1d277b..49d9a3ac 100644 --- a/srclib/apr/test/testfile.c +++ b/srclib/apr/test/testfile.c @@ -71,6 +71,23 @@ static void test_open_read(abts_case *tc, void *data) apr_file_close(filetest); } +static void link_existing(abts_case *tc, void *data) +{ + apr_status_t rv; + + rv = apr_file_link("data/file_datafile.txt", "data/file_datafile2.txt"); + apr_file_remove("data/file_datafile2.txt", p); + ABTS_ASSERT(tc, "Couldn't create hardlink to file", rv == APR_SUCCESS); +} + +static void link_nonexisting(abts_case *tc, void *data) +{ + apr_status_t rv; + + rv = apr_file_link("data/does_not_exist.txt", "data/fake.txt"); + ABTS_ASSERT(tc, "", rv != APR_SUCCESS); +} + static void test_read(abts_case *tc, void *data) { apr_status_t rv; @@ -960,6 +977,8 @@ abts_suite *testfile(abts_suite *suite) abts_run_test(suite, test_open_excl, NULL); abts_run_test(suite, test_open_read, NULL); abts_run_test(suite, test_open_readwrite, NULL); + abts_run_test(suite, link_existing, NULL); + abts_run_test(suite, link_nonexisting, NULL); abts_run_test(suite, test_read, NULL); abts_run_test(suite, test_readzero, NULL); abts_run_test(suite, test_seek, NULL); diff --git a/srclib/apr/test/testlib.dsp b/srclib/apr/test/testlib.dsp index 5ad91ba8..d3ab7aaf 100644 --- a/srclib/apr/test/testlib.dsp +++ b/srclib/apr/test/testlib.dsp @@ -19,8 +19,8 @@ CFG=testlib - Win32 Release !MESSAGE !MESSAGE "testlib - Win32 Release" (based on "Win32 (x86) External Target") !MESSAGE "testlib - Win32 Debug" (based on "Win32 (x86) External Target") -!MESSAGE "testlib - Win32 ReleaseNT" (based on "Win32 (x86) External Target") -!MESSAGE "testlib - Win32 DebugNT" (based on "Win32 (x86) External Target") +!MESSAGE "testlib - Win32 Release9x" (based on "Win32 (x86) External Target") +!MESSAGE "testlib - Win32 Debug9x" (based on "Win32 (x86) External Target") !MESSAGE "testlib - x64 Release" (based on "Win32 (x86) External Target") !MESSAGE "testlib - x64 Debug" (based on "Win32 (x86) External Target") !MESSAGE @@ -72,45 +72,45 @@ CFG=testlib - Win32 Release # PROP Bsc_Name "" # PROP Target_Dir "" -!ELSEIF "$(CFG)" == "testlib - Win32 ReleaseNT" +!ELSEIF "$(CFG)" == "testlib - Win32 Release9x" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "" # PROP BASE Intermediate_Dir "" -# PROP BASE Cmd_Line "NMAKE /f Makefile.win INTDIR=NT\LibR OUTDIR=NT\LibR MODEL=static all check" +# PROP BASE Cmd_Line "NMAKE /f Makefile.win INTDIR=9x\LibR OUTDIR=9x\LibR MODEL=static all check" # PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "NT\LibR\testall.exe" +# PROP BASE Target_File "9x\LibR\testall.exe" # PROP BASE Bsc_Name "" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "" # PROP Intermediate_Dir "" -# PROP Cmd_Line "NMAKE /f Makefile.win INTDIR=NT\LibR OUTDIR=NT\LibR MODEL=static all check" +# PROP Cmd_Line "NMAKE /f Makefile.win INTDIR=9x\LibR OUTDIR=9x\LibR MODEL=static all check" # PROP Rebuild_Opt "/a" -# PROP Target_File "NT\LibR\testall.exe" +# PROP Target_File "9x\LibR\testall.exe" # PROP Bsc_Name "" # PROP Target_Dir "" -!ELSEIF "$(CFG)" == "testlib - Win32 DebugNT" +!ELSEIF "$(CFG)" == "testlib - Win32 Debug9x" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "" # PROP BASE Intermediate_Dir "" -# PROP BASE Cmd_Line "NMAKE /f Makefile.win INTDIR=NT\LibD OUTDIR=NT\LibD MODEL=static _DEBUG=1 all check" +# PROP BASE Cmd_Line "NMAKE /f Makefile.win INTDIR=9x\LibD OUTDIR=9x\LibD MODEL=static _DEBUG=1 all check" # PROP BASE Rebuild_Opt "/a" -# PROP BASE Target_File "NT\LibD\testall.exe" +# PROP BASE Target_File "9x\LibD\testall.exe" # PROP BASE Bsc_Name "" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "" # PROP Intermediate_Dir "" -# PROP Cmd_Line "NMAKE /f Makefile.win INTDIR=NT\LibD OUTDIR=NT\LibD MODEL=static _DEBUG=1 all check" +# PROP Cmd_Line "NMAKE /f Makefile.win INTDIR=9x\LibD OUTDIR=9x\LibD MODEL=static _DEBUG=1 all check" # PROP Rebuild_Opt "/a" -# PROP Target_File "NT\LibD\testall.exe" +# PROP Target_File "9x\LibD\testall.exe" # PROP Bsc_Name "" # PROP Target_Dir "" @@ -162,8 +162,8 @@ CFG=testlib - Win32 Release # Name "testlib - Win32 Release" # Name "testlib - Win32 Debug" -# Name "testlib - Win32 ReleaseNT" -# Name "testlib - Win32 DebugNT" +# Name "testlib - Win32 Release9x" +# Name "testlib - Win32 Debug9x" # Name "testlib - x64 Release" # Name "testlib - x64 Debug" # Begin Group "testall Source Files" diff --git a/srclib/apr/test/testpoll.c b/srclib/apr/test/testpoll.c index e7792c2f..b298c916 100644 --- a/srclib/apr/test/testpoll.c +++ b/srclib/apr/test/testpoll.c @@ -53,7 +53,7 @@ static void make_socket(apr_socket_t **sock, apr_sockaddr_t **sa, rv = apr_socket_create(sock, (*sa)->family, SOCK_DGRAM, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv =apr_socket_bind((*sock), (*sa)); + rv = apr_socket_bind((*sock), (*sa)); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } @@ -308,12 +308,14 @@ static void multi_event_pollset(abts_case *tc, void *data) send_msg(s, sa, 0, tc); - rv = apr_pollset_poll(pollset, 0, &lrv, &descs); - ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv)); + rv = apr_pollset_poll(pollset, -1, &lrv, &descs); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); if (lrv == 1) { + int ev = descs[0].rtnevents; ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s); - ABTS_INT_EQUAL(tc, APR_POLLIN | APR_POLLOUT, descs[0].rtnevents); ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data); + ABTS_ASSERT(tc, "either or both of APR_POLLIN, APR_POLLOUT returned", + ((ev & APR_POLLIN) != 0) || ((ev & APR_POLLOUT) != 0)); } else if (lrv == 2) { ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s); @@ -379,15 +381,15 @@ static void send0_pollset(abts_case *tc, void *data) apr_status_t rv; const apr_pollfd_t *descs = NULL; int num; - + send_msg(s, sa, 0, tc); - rv = apr_pollset_poll(pollset, 0, &num, &descs); + rv = apr_pollset_poll(pollset, -1, &num, &descs); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, num); ABTS_PTR_NOTNULL(tc, descs); ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s); - ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data); + ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data); } static void recv0_pollset(abts_case *tc, void *data) @@ -411,14 +413,19 @@ static void send_middle_pollset(abts_case *tc, void *data) send_msg(s, sa, 2, tc); send_msg(s, sa, 5, tc); - rv = apr_pollset_poll(pollset, 0, &num, &descs); + rv = apr_pollset_poll(pollset, -1, &num, &descs); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - ABTS_INT_EQUAL(tc, 2, num); ABTS_PTR_NOTNULL(tc, descs); - - ABTS_ASSERT(tc, "Incorrect socket in result set", - ((descs[0].desc.s == s[2]) && (descs[1].desc.s == s[5])) || - ((descs[0].desc.s == s[5]) && (descs[1].desc.s == s[2]))); + ABTS_ASSERT(tc, "either one or two events returned", + num == 1 || num == 2); + + /* The poll might only see the first sent message, in which + * case we just don't bother checking this assertion */ + if (num == 2) { + ABTS_ASSERT(tc, "Incorrect socket in result set", + ((descs[0].desc.s == s[2]) && (descs[1].desc.s == s[5])) || + ((descs[0].desc.s == s[5]) && (descs[1].desc.s == s[2]))); + } } static void clear_middle_pollset(abts_case *tc, void *data) @@ -443,13 +450,13 @@ static void send_last_pollset(abts_case *tc, void *data) int num; send_msg(s, sa, LARGE_NUM_SOCKETS - 1, tc); - rv = apr_pollset_poll(pollset, 0, &num, &descs); + rv = apr_pollset_poll(pollset, -1, &num, &descs); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, num); ABTS_PTR_NOTNULL(tc, descs); ABTS_PTR_EQUAL(tc, s[LARGE_NUM_SOCKETS - 1], descs[0].desc.s); - ABTS_PTR_EQUAL(tc, s[LARGE_NUM_SOCKETS - 1], descs[0].client_data); + ABTS_PTR_EQUAL(tc, s[LARGE_NUM_SOCKETS - 1], descs[0].client_data); } static void clear_last_pollset(abts_case *tc, void *data) @@ -607,8 +614,8 @@ static void trigger_pollcb(abts_case *tc, void *data) send_msg(s, sa, 0, tc); pcb.tc = tc; pcb.count = 0; - rv = apr_pollcb_poll(pollcb, 0, trigger_pollcb_cb, &pcb); - ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv)); + rv = apr_pollcb_poll(pollcb, -1, trigger_pollcb_cb, &pcb); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, pcb.count); rv = apr_pollcb_remove(pollcb, &socket_pollfd); @@ -659,6 +666,109 @@ static void timeout_pollin_pollcb(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } +static void pollset_default(abts_case *tc, void *data) +{ + apr_status_t rv1, rv2; + apr_pollset_t *pollset; + + /* verify that APR will successfully create a pollset if an invalid method + * is specified as long as APR_POLLSET_NODEFAULT isn't specified + * (no platform has both APR_POLLSET_PORT and APR_POLLSET_KQUEUE, so at + * least one create call will succeed after having to switch to the default + * type) + */ + rv1 = apr_pollset_create_ex(&pollset, 1, p, 0, APR_POLLSET_PORT); + + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv1); + ABTS_PTR_NOTNULL(tc, pollset); + + rv1 = apr_pollset_create_ex(&pollset, 1, p, 0, APR_POLLSET_KQUEUE); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv1); + ABTS_PTR_NOTNULL(tc, pollset); + + /* verify that APR will fail to create a pollset if an invalid method is + * specified along with APR_POLLSET_NODEFAULT + * (no platform has both APR_POLLSET_PORT and APR_POLLSET_KQUEUE, so at + * least one create call will fail since it can't switch to the default + * type) + */ + rv1 = apr_pollset_create_ex(&pollset, 1, p, APR_POLLSET_NODEFAULT, + APR_POLLSET_PORT); + + if (rv1 == APR_SUCCESS) { + ABTS_PTR_NOTNULL(tc, pollset); + } + + rv2 = apr_pollset_create_ex(&pollset, 1, p, APR_POLLSET_NODEFAULT, + APR_POLLSET_KQUEUE); + if (rv2 == APR_SUCCESS) { + ABTS_PTR_NOTNULL(tc, pollset); + } + + ABTS_ASSERT(tc, + "failure using APR_POLLSET_NODEFAULT with unsupported method", + rv1 != APR_SUCCESS || rv2 != APR_SUCCESS); +} + +static void pollcb_default(abts_case *tc, void *data) +{ + apr_status_t rv1, rv2; + apr_pollcb_t *pollcb; + + /* verify that APR will successfully create a pollcb if an invalid method + * is specified as long as APR_POLLSET_NODEFAULT isn't specified + * (no platform has both APR_POLLSET_PORT and APR_POLLSET_KQUEUE, so at + * least one create call will succeed after having to switch to the default + * type) + */ + rv1 = apr_pollcb_create_ex(&pollcb, 1, p, 0, APR_POLLSET_PORT); + if (rv1 == APR_ENOTIMPL) { + ABTS_NOT_IMPL(tc, "pollcb interface not supported"); + return; + } + + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv1); + ABTS_PTR_NOTNULL(tc, pollcb); + + rv1 = apr_pollcb_create_ex(&pollcb, 1, p, 0, APR_POLLSET_KQUEUE); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv1); + ABTS_PTR_NOTNULL(tc, pollcb); + + /* verify that APR will fail to create a pollcb if an invalid method is + * specified along with APR_POLLSET_NODEFAULT + * (no platform has both APR_POLLSET_PORT and APR_POLLSET_KQUEUE, so at + * least one create call will fail since it can't switch to the default + * type) + */ + rv1 = apr_pollcb_create_ex(&pollcb, 1, p, APR_POLLSET_NODEFAULT, + APR_POLLSET_PORT); + + if (rv1 == APR_SUCCESS) { + ABTS_PTR_NOTNULL(tc, pollcb); + } + + rv2 = apr_pollcb_create_ex(&pollcb, 1, p, APR_POLLSET_NODEFAULT, + APR_POLLSET_KQUEUE); + if (rv2 == APR_SUCCESS) { + ABTS_PTR_NOTNULL(tc, pollcb); + } + + ABTS_ASSERT(tc, + "failure using APR_POLLSET_NODEFAULT with unsupported method", + rv1 != APR_SUCCESS || rv2 != APR_SUCCESS); + + + /* verify basic behavior for another method fallback case (this caused + * APR to crash before r834029) + */ + + rv1 = apr_pollcb_create_ex(&pollcb, 1, p, 0, APR_POLLSET_POLL); + if (rv1 != APR_ENOTIMPL) { + ABTS_INT_EQUAL(tc, rv1, APR_SUCCESS); + ABTS_PTR_NOTNULL(tc, pollcb); + } +} + abts_suite *testpoll(abts_suite *suite) { suite = ADD_SUITE(suite) @@ -688,18 +798,16 @@ abts_suite *testpoll(abts_suite *suite) abts_run_test(suite, clear_middle_pollset, NULL); abts_run_test(suite, send_last_pollset, NULL); abts_run_test(suite, clear_last_pollset, NULL); - abts_run_test(suite, pollset_remove, NULL); - abts_run_test(suite, close_all_sockets, NULL); - abts_run_test(suite, create_all_sockets, NULL); abts_run_test(suite, setup_pollcb, NULL); abts_run_test(suite, trigger_pollcb, NULL); abts_run_test(suite, timeout_pollcb, NULL); abts_run_test(suite, timeout_pollin_pollcb, NULL); abts_run_test(suite, close_all_sockets, NULL); - + abts_run_test(suite, pollset_default, NULL); + abts_run_test(suite, pollcb_default, NULL); return suite; } diff --git a/srclib/apr/test/testsock.c b/srclib/apr/test/testsock.c index 50aef5c2..b1115fd4 100644 --- a/srclib/apr/test/testsock.c +++ b/srclib/apr/test/testsock.c @@ -198,6 +198,67 @@ static void test_recv(abts_case *tc, void *data) APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv); } +static void test_atreadeof(abts_case *tc, void *data) +{ + apr_status_t rv; + apr_socket_t *sock; + apr_socket_t *sock2; + apr_proc_t proc; + apr_size_t length = STRLEN; + char datastr[STRLEN]; + int atreadeof = -1; + + sock = setup_socket(tc); + if (!sock) return; + + launch_child(tc, &proc, "write", p); + + rv = apr_socket_accept(&sock2, sock, p); + APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv); + + /* Check that the remote socket is still open */ + rv = apr_socket_atreadeof(sock2, &atreadeof); + APR_ASSERT_SUCCESS(tc, "Determine whether at EOF, #1", rv); + ABTS_INT_EQUAL(tc, 0, atreadeof); + + memset(datastr, 0, STRLEN); + apr_socket_recv(sock2, datastr, &length); + + /* Make sure that the server received the data we sent */ + ABTS_STR_EQUAL(tc, DATASTR, datastr); + ABTS_SIZE_EQUAL(tc, strlen(datastr), wait_child(tc, &proc)); + + /* The child is dead, so should be the remote socket */ + rv = apr_socket_atreadeof(sock2, &atreadeof); + APR_ASSERT_SUCCESS(tc, "Determine whether at EOF, #2", rv); + ABTS_INT_EQUAL(tc, 1, atreadeof); + + rv = apr_socket_close(sock2); + APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv); + + launch_child(tc, &proc, "close", p); + + rv = apr_socket_accept(&sock2, sock, p); + APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv); + + /* The child closed the socket as soon as it could... */ + rv = apr_socket_atreadeof(sock2, &atreadeof); + APR_ASSERT_SUCCESS(tc, "Determine whether at EOF, #3", rv); + if (!atreadeof) { /* ... but perhaps not yet; wait a moment */ + apr_sleep(apr_time_from_msec(5)); + rv = apr_socket_atreadeof(sock2, &atreadeof); + APR_ASSERT_SUCCESS(tc, "Determine whether at EOF, #4", rv); + } + ABTS_INT_EQUAL(tc, 1, atreadeof); + wait_child(tc, &proc); + + rv = apr_socket_close(sock2); + APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv); + + rv = apr_socket_close(sock); + APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv); +} + static void test_timeout(abts_case *tc, void *data) { apr_status_t rv; @@ -345,6 +406,7 @@ abts_suite *testsock(abts_suite *suite) abts_run_test(suite, test_create_bind_listen, NULL); abts_run_test(suite, test_send, NULL); abts_run_test(suite, test_recv, NULL); + abts_run_test(suite, test_atreadeof, NULL); abts_run_test(suite, test_timeout, NULL); abts_run_test(suite, test_print_addr, NULL); abts_run_test(suite, test_get_addr, NULL); |