diff --git a/configure/CONFIG_ADDONS b/configure/CONFIG_ADDONS index 5725d9701..e8ce09190 100644 --- a/configure/CONFIG_ADDONS +++ b/configure/CONFIG_ADDONS @@ -412,17 +412,6 @@ USR_LIBS += $(USR_LIBS_DEFAULT) endif endif -# -# concat specific include files -# -ifneq ($(strip $(INC_$(OS_CLASS))),) -INC += $(subst -nil-,,$(INC_$(OS_CLASS))) -else -ifdef INC_DEFAULT -INC+=$(INC_DEFAULT) -endif -endif - # # concat specific library contents (if defined) to SYS_PROD_LIBS # diff --git a/configure/RULES.Db b/configure/RULES.Db index fbd7aab72..6a01ad19b 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -120,6 +120,9 @@ DBDDEPENDS_FILES += $(addsuffix $(DEP),$(HINC) \ ifndef T_A +DEP = .d +TEMPLATE3+=$(addsuffix .template, $(TEMPLATE2)) + COMMON_DIR = . INSTALL_DBDS = INSTALL_DBS = diff --git a/configure/os/CONFIG.Common.ios-arm b/configure/os/CONFIG.Common.ios-arm index 26296a38c..cc297b627 100644 --- a/configure/os/CONFIG.Common.ios-arm +++ b/configure/os/CONFIG.Common.ios-arm @@ -11,6 +11,8 @@ IOS_PLATFORM = iPhoneOS OP_SYS_CFLAGS += -fno-inline-functions +OP_SYS_CFLAGS += -miphoneos-version-min=$(IOS_DEPLOYMENT_TARGET) +OP_SYS_LDFLAGS += -miphoneos-version-min=$(IOS_DEPLOYMENT_TARGET) # iOS optimization flags for arm architecture OPT_CFLAGS_YES = -O2 diff --git a/configure/os/CONFIG.Common.ios-x86 b/configure/os/CONFIG.Common.ios-x86 index 064319d2b..0c786653d 100644 --- a/configure/os/CONFIG.Common.ios-x86 +++ b/configure/os/CONFIG.Common.ios-x86 @@ -10,6 +10,9 @@ IOS_PLATFORM = iPhoneSimulator +OP_SYS_CFLAGS += -mios-simulator-version-min=$(IOS_DEPLOYMENT_TARGET) +OP_SYS_LDFLAGS += -mios-simulator-version-min=$(IOS_DEPLOYMENT_TARGET) + # # Architecture-specific information # diff --git a/configure/os/CONFIG.Common.iosCommon b/configure/os/CONFIG.Common.iosCommon index 2e9be3acf..05e63c504 100644 --- a/configure/os/CONFIG.Common.iosCommon +++ b/configure/os/CONFIG.Common.iosCommon @@ -40,7 +40,7 @@ ARCH_DEP_LDFLAGS += $(ARCH_DEP_FLAGS) #-------------------------------------------------- # Operating system flags -OP_SYS_CFLAGS += -isysroot $(SDK_DIR) -D__IPHONE_OS_VERSION_MIN_REQUIRED=30200 +OP_SYS_CFLAGS += -isysroot $(SDK_DIR) OP_SYS_LDFLAGS += -isysroot $(SDK_DIR) #-------------------------------------------------- @@ -109,6 +109,9 @@ HDEPENDS_METHOD = MKMF -include $(CONFIG)/os/CONFIG_SITE.$(EPICS_HOST_ARCH).iosCommon #-------------------------------------------------- -# Find the Xcode compilers for the specified SDK just once +# Find the Xcode programs for the selected SDK CC := $(shell xcrun -sdk $(XCRUN_SDK_BASE) -find $(CC_$(COMPILER))) CCC := $(shell xcrun -sdk $(XCRUN_SDK_BASE) -find $(CCC_$(COMPILER))) +AR := $(shell xcrun -sdk $(XCRUN_SDK_BASE) -find ar) -rc +LD := $(shell xcrun -sdk $(XCRUN_SDK_BASE) -find ld) -r +RANLIB := $(shell xcrun -sdk $(XCRUN_SDK_BASE) -find ranlib) diff --git a/configure/os/CONFIG.win32-x86-static.Common b/configure/os/CONFIG.win32-x86-static.Common new file mode 100644 index 000000000..7c4508ca6 --- /dev/null +++ b/configure/os/CONFIG.win32-x86-static.Common @@ -0,0 +1,11 @@ +# CONFIG.win32-x86-static.Common +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for win32-x86-static host archs +# Sites may override these definitions in CONFIG_SITE.win32-x86-static.Common +#------------------------------------------------------- + +include $(CONFIG)/os/CONFIG.win32-x86.Common + diff --git a/configure/os/CONFIG.win32-x86-static.win32-x86-static b/configure/os/CONFIG.win32-x86-static.win32-x86-static new file mode 100644 index 000000000..0bb18a6d0 --- /dev/null +++ b/configure/os/CONFIG.win32-x86-static.win32-x86-static @@ -0,0 +1,13 @@ +# CONFIG.win32-x86-static.win32-x86.static +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for win32-x86-static target archs when host arch is win32-x86-static +# Sites may override these definitions in CONFIG_SITE.win32-x86-static.win32-x86-static +#------------------------------------------------------- + +include $(CONFIG)/os/CONFIG.win32-x86.win32-x86 + +SHARED_LIBRARIES = NO +STATIC_BUILD = YES diff --git a/configure/os/CONFIG.win32-x86.win32-x86-static b/configure/os/CONFIG.win32-x86.win32-x86-static new file mode 100644 index 000000000..a23431744 --- /dev/null +++ b/configure/os/CONFIG.win32-x86.win32-x86-static @@ -0,0 +1,14 @@ +# CONFIG.win32-x86.win32-x86-static +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for win32-x86-static target archs when host arch is win32-x86 +# Sites may override these definitions in CONFIG_SITE.win32-x86.win32-x86-static +#------------------------------------------------------- + +include $(CONFIG)/os/CONFIG.win32-x86.win32-x86 + +BUILD_CLASS = HOST +SHARED_LIBRARIES = NO +STATIC_BUILD = YES diff --git a/configure/os/CONFIG.windows-x64-static.Common b/configure/os/CONFIG.windows-x64-static.Common new file mode 100644 index 000000000..be61abad0 --- /dev/null +++ b/configure/os/CONFIG.windows-x64-static.Common @@ -0,0 +1,11 @@ +# CONFIG.windows-x64-static.Common +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for windows-x64-static host archs +# Sites may override these definitions in CONFIG_SITE.windows-x64-static.Common +#------------------------------------------------------- + +include $(CONFIG)/os/CONFIG.windows-x64.Common + diff --git a/configure/os/CONFIG.windows-x64-static.windows-x64-static b/configure/os/CONFIG.windows-x64-static.windows-x64-static new file mode 100644 index 000000000..e5e152411 --- /dev/null +++ b/configure/os/CONFIG.windows-x64-static.windows-x64-static @@ -0,0 +1,13 @@ +# CONFIG.windows-x64-static.windows-x64-static +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for windows-x64-static target archs when host arch is windows-x64-static +# Sites may override these definitions in CONFIG_SITE.windows-x64-static.windows-x64-static +#------------------------------------------------------- + +include $(CONFIG)/os/CONFIG.windows-x64.windows-x64 + +SHARED_LIBRARIES = NO +STATIC_BUILD= YES diff --git a/configure/os/CONFIG.windows-x64.windows-x64-static b/configure/os/CONFIG.windows-x64.windows-x64-static new file mode 100644 index 000000000..8a6fd20f9 --- /dev/null +++ b/configure/os/CONFIG.windows-x64.windows-x64-static @@ -0,0 +1,14 @@ +# CONFIG.windows-x86.windows-x86-static +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for windows-x64-static target archs when host arch is windows-x64 +# Sites may override these definitions in CONFIG_SITE.windows-x64.windows-x64-static +#------------------------------------------------------- + +include $(CONFIG)/os/CONFIG.windows-x64.windows-x64 + +BUILD_CLASS = HOST +SHARED_LIBRARIES = NO +STATIC_BUILD = YES diff --git a/configure/os/CONFIG_SITE.Common.iosCommon b/configure/os/CONFIG_SITE.Common.iosCommon index 7c4b528aa..17055e1dd 100644 --- a/configure/os/CONFIG_SITE.Common.iosCommon +++ b/configure/os/CONFIG_SITE.Common.iosCommon @@ -5,18 +5,25 @@ # Site-specific settings for Apple iOS builds #------------------------------------------------------- -# iOS Version number +# iOS SDK Version number (not the XCode version). +# We haven't tested our current build rules on the older +# versions of either XCode or the iOS SDK, be warned! -#IOS_VERSION = 3.2 -#IOS_VERSION = 4.1 -#IOS_VERSION = 4.2 -#IOS_VERSION = 4.3 #IOS_VERSION = 5.0 #IOS_VERSION = 5.1 #IOS_VERSION = 6.0 #IOS_VERSION = 6.1 IOS_VERSION = 7.0 +# Minimum version of iOS the executables must run on. +# Earlier versions may work, if XCode supports them. + +#IOS_DEPLOYMENT_TARGET = 5.0 +#IOS_DEPLOYMENT_TARGET = 5.1 +#IOS_DEPLOYMENT_TARGET = 6.0 +#IOS_DEPLOYMENT_TARGET = 6.1 +IOS_DEPLOYMENT_TARGET = 7.0 + # Which compiler to use: # CLANG is required for Xcode 5.0 and later diff --git a/src/ca/client/CAref.html b/src/ca/client/CAref.html index 9753a151d..43a4f43fa 100644 --- a/src/ca/client/CAref.html +++ b/src/ca/client/CAref.html @@ -796,7 +796,7 @@ been done to address this issue so far).

EPICS_CAS_BEACON_ADDR_LIST - {N.N.N.NN.N.N.N:P...} + {N.N.N.N N.N.N.N:P ...} EPICS_CA_ADDR_LIST1 @@ -811,12 +811,12 @@ been done to address this issue so far).

EPICS_CAS_INTF_ADDR_LIST - {N.N.N.NN.N.N.N:P...} + {N.N.N.N N.N.N.N:P ...} <none> EPICS_CAS_IGNORE_ADDR_LIST - {N.N.N.NN.N.N.N:P...} + {N.N.N.N N.N.N.N:P ...} <none> diff --git a/src/ca/client/perl/CA.pm b/src/ca/client/perl/CA.pm index ac6542e01..31f09f9fb 100644 --- a/src/ca/client/perl/CA.pm +++ b/src/ca/client/perl/CA.pm @@ -4,7 +4,7 @@ use strict; use warnings; -my $version = '0.4'; +my $version = '0.5'; package CA; @@ -507,6 +507,11 @@ class method syntax, e.g. C<< CA->pend_io(10) >>. =over 4 +=item version + +Returns the EPICS_VERSION_STRING from the version of EPICS Base this software +was built using. + =item flush_io Flush outstanding IO requests to the server. This routine is useful for users diff --git a/src/ca/client/perl/Cap5.xs b/src/ca/client/perl/Cap5.xs index 54ce8decb..8ad55d68a 100644 --- a/src/ca/client/perl/Cap5.xs +++ b/src/ca/client/perl/Cap5.xs @@ -10,6 +10,7 @@ #include "cadef.h" #include "db_access.h" +#include "epicsVersion.h" #include "alarm.h" #include "alarmString.h" @@ -1010,6 +1011,12 @@ void CA_flush_io(const char *class) { } +/* CA::version($class) */ + +const char * CA_version(const char *class) { + return EPICS_VERSION_STRING; +} + /* CA::add_exception_event($class, \&sub) */ static @@ -1392,6 +1399,10 @@ void CA_flush_io (class) const char * class +const char * +CA_version (class) + const char * class + void CA_add_exception_event (class, sub) const char * class diff --git a/src/ca/client/perl/caget.pl b/src/ca/client/perl/caget.pl index df8cb6d25..a3fcbfe85 100644 --- a/src/ca/client/perl/caget.pl +++ b/src/ca/client/perl/caget.pl @@ -148,11 +148,11 @@ sub display { } sub HELP_MESSAGE { - print STDERR "\nUsage: caget [options] ...\n", + print STDERR "\nUsage: caget.pl [options] ...\n", "\n", " -h: Help: Print this message\n", "Channel Access options:\n", - " -w : Wait time, specifies longer CA timeout, default is $opt_w second\n", + " -w : Wait time, specifies CA timeout, default is $opt_w second\n", "Format options:\n", " -t: Terse mode - print only value, without name\n", " -a: Wide mode \"name timestamp value stat sevr\" (read PVs as DBR_TIME_xxx)\n", @@ -182,6 +182,7 @@ sub HELP_MESSAGE { " -0b: Print as binary number\n", "Set output field separator:\n", " -F : Use to separate fields on output\n", - "\n"; + "\n", + "Base version: ", CA->version, "\n"; exit 1; } diff --git a/src/ca/client/perl/cainfo.pl b/src/ca/client/perl/cainfo.pl index 2196655b1..2c08bcfe6 100644 --- a/src/ca/client/perl/cainfo.pl +++ b/src/ca/client/perl/cainfo.pl @@ -52,13 +52,14 @@ sub display { } sub HELP_MESSAGE { - print STDERR "\nUsage: cainfo [options] ...\n", + print STDERR "\nUsage: cainfo.pl [options] ...\n", "\n", " -h: Help: Print this message\n", "Channel Access options:\n", " -w : Wait time, specifies CA timeout, default is $opt_w second\n", "\n", "Example: cainfo my_channel another_channel\n", - "\n"; + "\n", + "Base version: ", CA->version, "\n"; exit 1; } diff --git a/src/ca/client/perl/camonitor.pl b/src/ca/client/perl/camonitor.pl index 4d19272b2..2a933abbe 100644 --- a/src/ca/client/perl/camonitor.pl +++ b/src/ca/client/perl/camonitor.pl @@ -109,11 +109,11 @@ sub display { } sub HELP_MESSAGE { - print STDERR "\nUsage: camonitor [options] ...\n", + print STDERR "\nUsage: camonitor.pl [options] ...\n", "\n", " -h: Help: Print this message\n", "Channel Access options:\n", - " -w : Wait time, specifies longer CA timeout, default is $opt_w second\n", + " -w : Wait time, specifies CA timeout, default is $opt_w second\n", " -m : Specify CA event mask to use, with being any combination of\n", " 'v' (value), 'a' (alarm), 'l' (log/archive), 'p' (property)", " Default: '$opt_m'\n", @@ -144,6 +144,7 @@ sub HELP_MESSAGE { "\n", "Example: camonitor -f8 my_channel another_channel\n", " (doubles are printed as %f with 8 decimal digits)\n", - "\n"; + "\n", + "Base version: ", CA->version, "\n"; exit 1; } diff --git a/src/ca/client/perl/capr.pl b/src/ca/client/perl/capr.pl index 04f1caa97..cf0c4d397 100644 --- a/src/ca/client/perl/capr.pl +++ b/src/ca/client/perl/capr.pl @@ -401,23 +401,22 @@ sub printRecordList { sub HELP_MESSAGE { print STDERR "\n", "Usage: capr.pl -h\n", - " capr.pl [-d file.dbd] [-w seconds] -r\n", - " capr.pl [-d file.dbd] [-w seconds] -f record_type\n", - " capr.pl [-d file.dbd] [-w seconds] record_name [interest]\n", - "Description:\n", - " Attempts to perform a \"dbpr\" record print via channel access for \n", - " record_name at an interest level which defaults to level 0.\n\n", - " The -r or -f options cause it to print record type or field lists.\n", + " capr.pl [options] -r\n", + " capr.pl [options] -f \n", + " capr.pl [options] []\n", "\n", - "Options:\n", - " -h Prints this help message.\n", - " -r Lists all record types in the dbd file.\n", - " -f record_type: Lists all fields plus their interest level, data type\n", - " and number base for the given record_type.\n", - " -d file.dbd: The dbd file containing record type definitions.\n", - " This can be set using the EPICS_CAPR_DBD_FILE environment variable.\n", - " Currently ", AbsPath($opt_d), "\n", - " -w seconds: CA connection timeout, currently $opt_w\n", - "\n"; + " -h Print this help message.\n", + "Channel Access options:\n", + " -w : Wait time, specifies CA timeout, default is $opt_w second\n", + "Database Definitions:\n", + " -d : The file containing record type definitions.\n", + " This can be set using the EPICS_CAPR_DBD_FILE environment variable.\n", + " Default: ", AbsPath($opt_d), "\n", + "Output Options:\n", + " -r Lists all record types in the selected dbd file.\n", + " -f : Lists all fields with their interest level, data type\n", + " and number base for the given record_type.\n", + "\n", + "Base version: ", CA->version, "\n"; exit 1; } diff --git a/src/ca/client/perl/caput.pl b/src/ca/client/perl/caput.pl index 8d2e6b4b3..69cd4b638 100644 --- a/src/ca/client/perl/caput.pl +++ b/src/ca/client/perl/caput.pl @@ -151,11 +151,11 @@ sub display { } sub HELP_MESSAGE { - print STDERR "\nUsage: caput [options] ...\n", + print STDERR "\nUsage: caput.pl [options] ...\n", "\n", " -h: Help: Print this message\n", "Channel Access options:\n", - " -w : Wait time, specifies longer CA timeout, default is $opt_w second\n", + " -w : Wait time, specifies CA timeout, default is $opt_w second\n", " -c: Use put_callback to wait for completion\n", "Format options:\n", " -t: Terse mode - print only sucessfully written value, without name\n", @@ -180,7 +180,8 @@ sub HELP_MESSAGE { "Examples:\n", " caput my_channel 1.2\n", " caput my_waveform 1.2 2.4 3.6 4.8 6.0\n", - "\n"; + "\n", + "Base version: ", CA->version, "\n"; exit 1; } diff --git a/src/libCom/misc/epicsString.c b/src/libCom/misc/epicsString.c index 9e91f6495..f5c61944d 100644 --- a/src/libCom/misc/epicsString.c +++ b/src/libCom/misc/epicsString.c @@ -174,8 +174,8 @@ int epicsStrCaseCmp(const char *s1, const char *s2) int ch1 = toupper((int) *s1); int ch2 = toupper((int) *s2); - if (ch1 == 0) return (ch2 != 0); - if (ch2 == 0) return -1; + if (ch2 == 0) return (ch1 != 0); + if (ch1 == 0) return -1; if (ch1 < ch2) return -1; if (ch1 > ch2) return 1; s1++; @@ -191,8 +191,8 @@ int epicsStrnCaseCmp(const char *s1, const char *s2, size_t len) int ch1 = toupper((int) *s1); int ch2 = toupper((int) *s2); - if (ch1 == 0) return (ch2 != 0); - if (ch2 == 0) return -1; + if (ch2 == 0) return (ch1 != 0); + if (ch1 == 0) return -1; if (ch1 < ch2) return -1; if (ch1 > ch2) return 1; s1++; diff --git a/src/libCom/osi/epicsTime.cpp b/src/libCom/osi/epicsTime.cpp index a137ebd03..4370f4a27 100644 --- a/src/libCom/osi/epicsTime.cpp +++ b/src/libCom/osi/epicsTime.cpp @@ -593,9 +593,11 @@ size_t epicsTime::strftime ( static_cast < unsigned long > ( 1e1 ), static_cast < unsigned long > ( 1e0 ) }; - // round and convert nanosecs to integer of correct range + // round without overflowing into whole seconds unsigned long frac = tmns.nSec + div[fracWid] / 2; - frac %= static_cast < unsigned long > ( 1e9 ); + if (frac >= nSecPerSec) + frac = nSecPerSec - 1; + // convert nanosecs to integer of correct range frac /= div[fracWid]; char fracFormat[32]; sprintf ( fracFormat, "%%0%lulu", fracWid ); diff --git a/src/libCom/test/blockingSockTest.cpp b/src/libCom/test/blockingSockTest.cpp index fa0a8d626..126bac160 100644 --- a/src/libCom/test/blockingSockTest.cpp +++ b/src/libCom/test/blockingSockTest.cpp @@ -8,7 +8,6 @@ \*************************************************************************/ #include -#include #include #include "osiSock.h" @@ -18,9 +17,6 @@ #include "epicsUnitTest.h" #include "testMain.h" -#define verify(exp) ((exp) ? (void)0 : \ - epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor)) - union address { struct sockaddr_in ia; struct sockaddr sa; @@ -31,7 +27,6 @@ public: circuit ( SOCKET ); void recvTest (); void shutdown (); - void signal (); void close (); bool recvWakeupDetected () const; bool sendWakeupDetected () const; @@ -64,6 +59,7 @@ public: server ( address & ); void start (); void daemon (); + void stop (); protected: SOCKET sock; epicsThreadId id; @@ -76,7 +72,7 @@ circuit::circuit ( SOCKET sockIn ) : recvWakeup ( false ), sendWakeup ( false ) { - verify ( this->sock != INVALID_SOCKET ); + testOk ( this->sock != INVALID_SOCKET, "Socket valid" ); } bool circuit::recvWakeupDetected () const @@ -92,12 +88,7 @@ bool circuit::sendWakeupDetected () const void circuit::shutdown () { int status = ::shutdown ( this->sock, SHUT_RDWR ); - verify ( status == 0 ); -} - -void circuit::signal () -{ - epicsSignalRaiseSigAlarm ( this->id ); + testOk ( status == 0, "Shutdown() returned Ok" ); } void circuit::close () @@ -107,7 +98,6 @@ void circuit::close () void circuit::recvTest () { - epicsSignalInstallSigAlarmIgnore (); char buf [1]; while ( true ) { int status = recv ( this->sock, @@ -118,13 +108,13 @@ void circuit::recvTest () break; } else if ( status > 0 ) { - testDiag ( "client received %i characters", status ); + testDiag ( "%s received %i characters", this->pName (), status ); } else { char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - testDiag ( "%s socket recv() error was \"%s\"\n", + testDiag ( "%s socket recv() error was \"%s\"", this->pName (), sockErrBuf ); this->recvWakeup = true; break; @@ -144,14 +134,14 @@ clientCircuit::clientCircuit ( const address & addrIn ) : address tmpAddr = addrIn; int status = ::connect ( this->sock, & tmpAddr.sa, sizeof ( tmpAddr ) ); - verify ( status == 0 ); + testOk ( status == 0, "Client end connected" ); circuit * pCir = this; this->id = epicsThreadCreate ( "client circuit", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), socketRecvTest, pCir ); - verify ( this->id ); + testOk ( this->id != 0, "Client thread created" ); } @@ -169,7 +159,7 @@ server::server ( address & addrIn ) : sock ( epicsSocketCreate ( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ), id ( 0 ), exit ( false ) { - verify ( this->sock != INVALID_SOCKET ); + testOk ( this->sock != INVALID_SOCKET, "Server socket valid" ); // setup server side int status = bind ( this->sock, @@ -182,7 +172,7 @@ server::server ( address & addrIn ) : testAbort ( "Failed to read socket address" ); } status = listen ( this->sock, 10 ); - verify ( status == 0 ); + testOk ( status == 0, "Server socket listening" ); } void server::start () @@ -191,7 +181,7 @@ void server::start () "server daemon", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), serverDaemon, this ); - verify ( this->id ); + testOk ( this->id != 0, "Server thread created" ); } void server::daemon () @@ -202,12 +192,20 @@ void server::daemon () osiSocklen_t addressSize = sizeof ( addr ); SOCKET ns = accept ( this->sock, & addr.sa, & addressSize ); - verify ( ns != INVALID_SOCKET ); + if ( this->exit ) + break; + testOk ( ns != INVALID_SOCKET, "Accepted socket valid" ); circuit * pCir = new serverCircuit ( ns ); - verify ( pCir ); + testOk ( pCir != 0, "Server circuit created" ); } } +void server::stop () +{ + this->exit = true; + epicsSocketDestroy ( this->sock ); +} + serverCircuit::serverCircuit ( SOCKET sockIn ) : circuit ( sockIn ) { @@ -216,7 +214,7 @@ serverCircuit::serverCircuit ( SOCKET sockIn ) : "server circuit", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), socketRecvTest, pCir ); - verify ( threadId ); + testOk ( threadId != 0, "Server circuit thread created" ); } const char * serverCircuit::pName () @@ -245,7 +243,8 @@ static const char *mechName(int mech) MAIN(blockingSockTest) { - testPlan(1); + testPlan(13); + osiSockAttach(); address addr; memset ( (char *) & addr, 0, sizeof ( addr ) ); @@ -258,35 +257,36 @@ MAIN(blockingSockTest) clientCircuit client ( addr ); epicsThreadSleep ( 1.0 ); - verify ( ! client.recvWakeupDetected () ); + testOk ( ! client.recvWakeupDetected (), "Client is asleep" ); + testDiag("Trying Shutdown mechanism"); client.shutdown (); epicsThreadSleep ( 1.0 ); int mech = -1; if ( client.recvWakeupDetected () ) { mech = esscimqi_socketBothShutdownRequired; + testDiag("Shutdown succeeded"); } else { - client.signal (); + testDiag("Trying Close mechanism"); + client.close (); epicsThreadSleep ( 1.0 ); if ( client.recvWakeupDetected () ) { - mech = esscimqi_socketSigAlarmRequired; - } - else { - client.close (); - epicsThreadSleep ( 1.0 ); - if ( client.recvWakeupDetected () ) { - mech = esscimqi_socketCloseRequired; - } + mech = esscimqi_socketCloseRequired; + testDiag("Close succeeded"); } } testDiag("This OS behaves like \"%s\".", mechName(mech)); int query = epicsSocketSystemCallInterruptMechanismQuery (); - if (! testOk(mech == query, "Socket shutdown mechanism") ) + if (! testOk(mech == query, "Declared mechanism works") ) testDiag("epicsSocketSystemCallInterruptMechanismQuery returned \"%s\"", mechName(query)); + srv.stop (); + epicsThreadSleep ( 1.0 ); + + osiSockRelease(); return testDone(); } diff --git a/src/libCom/test/epicsSockResolveTest.c b/src/libCom/test/epicsSockResolveTest.c index 166a29b90..83075d2cc 100644 --- a/src/libCom/test/epicsSockResolveTest.c +++ b/src/libCom/test/epicsSockResolveTest.c @@ -47,6 +47,7 @@ MAIN(epicsSockResolveTest) int i; testPlan(3*NELEMENTS(okdata) + NELEMENTS(baddata)); + osiSockAttach(); { struct in_addr addr; @@ -88,5 +89,6 @@ MAIN(epicsSockResolveTest) } } + osiSockRelease(); return testDone(); } diff --git a/src/libCom/test/epicsStringTest.c b/src/libCom/test/epicsStringTest.c index d7a91bcfd..5a5934f20 100644 --- a/src/libCom/test/epicsStringTest.c +++ b/src/libCom/test/epicsStringTest.c @@ -92,8 +92,8 @@ MAIN(epicsStringTest) testOk1(epicsStrnCaseCmp(empty, "", 0) == 0); testOk1(epicsStrnCaseCmp(empty, "", 1) == 0); - testOk1(epicsStrnCaseCmp(space, empty, 1) < 0); - testOk1(epicsStrnCaseCmp(empty, space, 1) > 0); + testOk1(epicsStrnCaseCmp(space, empty, 1) > 0); + testOk1(epicsStrnCaseCmp(empty, space, 1) < 0); testOk1(epicsStrnCaseCmp(a, A, 1) == 0); testOk1(epicsStrnCaseCmp(a, A, 2) == 0); testOk1(epicsStrnCaseCmp(abcd, ABCD, 2) == 0); @@ -101,17 +101,17 @@ MAIN(epicsStringTest) testOk1(epicsStrnCaseCmp(abcd, ABCD, 1000) == 0); testOk1(epicsStrnCaseCmp(abcd, ABCDE, 2) == 0); testOk1(epicsStrnCaseCmp(abcd, ABCDE, 4) == 0); - testOk1(epicsStrnCaseCmp(abcd, ABCDE, 1000)> 0); + testOk1(epicsStrnCaseCmp(abcd, ABCDE, 1000) < 0); testOk1(epicsStrnCaseCmp(abcde, ABCD, 2) == 0); testOk1(epicsStrnCaseCmp(abcde, ABCD, 4) == 0); - testOk1(epicsStrnCaseCmp(abcde, ABCD, 1000) < 0); + testOk1(epicsStrnCaseCmp(abcde, ABCD, 1000) > 0); testOk1(epicsStrCaseCmp(empty, "") == 0); testOk1(epicsStrCaseCmp(a, A) == 0); testOk1(epicsStrCaseCmp(abcd, ABCD) == 0); - testOk1(epicsStrCaseCmp(abcd, ABCDE) != 0); - testOk1(epicsStrCaseCmp(abcde, ABCD) != 0); - testOk1(epicsStrCaseCmp(abcde, "ABCDF") != 0); + testOk1(epicsStrCaseCmp(abcd, ABCDE) < 0); + testOk1(epicsStrCaseCmp(abcde, ABCD) > 0); + testOk1(epicsStrCaseCmp(abcde, "ABCDF") < 0); s = epicsStrDup(abcd); testOk(strcmp(s, abcd) == 0 && s != abcd, "epicsStrDup"); diff --git a/src/libCom/test/epicsTimeTest.cpp b/src/libCom/test/epicsTimeTest.cpp index c108eca7f..83d0a8a07 100644 --- a/src/libCom/test/epicsTimeTest.cpp +++ b/src/libCom/test/epicsTimeTest.cpp @@ -48,7 +48,7 @@ MAIN(epicsTimeTest) const int wasteTime = 100000; const int nTimes = 10; - testPlan(12 + nTimes * 18); + testPlan(15 + nTimes * 18); try { const epicsTimeStamp epochTS = {0, 0}; @@ -96,6 +96,10 @@ MAIN(epicsTimeTest) et.strftime(buf, sizeof(buf), pFormat); testOk(strcmp(buf, "1990-01-01 00.098765432") == 0, "'%s' => '%s'", pFormat, buf); + pFormat = "%S.%03f"; + et.strftime(buf, sizeof(buf), pFormat); + testOk(strcmp(buf, "00.099") == 0, "'%s' => '%s'", pFormat, buf); + pFormat = "%S.%04f"; et.strftime(buf, sizeof(buf), pFormat); testOk(strcmp(buf, "00.0988") == 0, "'%s' => '%s'", pFormat, buf); @@ -113,6 +117,14 @@ MAIN(epicsTimeTest) et.strftime(smbuf, sizeof(smbuf), pFormat); testOk(strcmp(smbuf, "00.*") == 0, "'%s' => '%s'", pFormat, smbuf); + pFormat = "%S.%03f"; + (et + 0.9).strftime(buf, sizeof(buf), pFormat); + testOk(strcmp(buf, "00.999") == 0, "0.998765 => '%s'", buf); + + pFormat = "%S.%03f"; + (et + 0.901).strftime(buf, sizeof(buf), pFormat); + testOk(strcmp(buf, "00.999") == 0, "0.999765 => '%s'", buf); + pFormat = "%%S.%%05f"; et.strftime(buf, sizeof(buf), pFormat); testOk(strcmp(buf, "%S.%05f") == 0, "'%s' => '%s'", pFormat, buf);