Merged changes from 3.14 branch.
Up to revno 12479.
This commit is contained in:
@@ -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
|
||||
#
|
||||
|
||||
@@ -120,6 +120,9 @@ DBDDEPENDS_FILES += $(addsuffix $(DEP),$(HINC) \
|
||||
|
||||
ifndef T_A
|
||||
|
||||
DEP = .d
|
||||
TEMPLATE3+=$(addsuffix .template, $(TEMPLATE2))
|
||||
|
||||
COMMON_DIR = .
|
||||
INSTALL_DBDS =
|
||||
INSTALL_DBS =
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
#
|
||||
|
||||
@@ -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)
|
||||
|
||||
11
configure/os/CONFIG.win32-x86-static.Common
Normal file
11
configure/os/CONFIG.win32-x86-static.Common
Normal file
@@ -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
|
||||
|
||||
13
configure/os/CONFIG.win32-x86-static.win32-x86-static
Normal file
13
configure/os/CONFIG.win32-x86-static.win32-x86-static
Normal file
@@ -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
|
||||
14
configure/os/CONFIG.win32-x86.win32-x86-static
Normal file
14
configure/os/CONFIG.win32-x86.win32-x86-static
Normal file
@@ -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
|
||||
11
configure/os/CONFIG.windows-x64-static.Common
Normal file
11
configure/os/CONFIG.windows-x64-static.Common
Normal file
@@ -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
|
||||
|
||||
13
configure/os/CONFIG.windows-x64-static.windows-x64-static
Normal file
13
configure/os/CONFIG.windows-x64-static.windows-x64-static
Normal file
@@ -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
|
||||
14
configure/os/CONFIG.windows-x64.windows-x64-static
Normal file
14
configure/os/CONFIG.windows-x64.windows-x64-static
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -796,7 +796,7 @@ been done to address this issue so far).</em></p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>EPICS_CAS_BEACON_ADDR_LIST</td>
|
||||
<td>{N.N.N.NN.N.N.N:P...}</td>
|
||||
<td>{N.N.N.N N.N.N.N:P ...}</td>
|
||||
<td>EPICS_CA_ADDR_LIST<sup>1</sup></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -811,12 +811,12 @@ been done to address this issue so far).</em></p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>EPICS_CAS_INTF_ADDR_LIST</td>
|
||||
<td>{N.N.N.NN.N.N.N:P...}</td>
|
||||
<td>{N.N.N.N N.N.N.N:P ...}</td>
|
||||
<td><none></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>EPICS_CAS_IGNORE_ADDR_LIST</td>
|
||||
<td>{N.N.N.NN.N.N.N:P...}</td>
|
||||
<td>{N.N.N.N N.N.N.N:P ...}</td>
|
||||
<td><none></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -148,11 +148,11 @@ sub display {
|
||||
}
|
||||
|
||||
sub HELP_MESSAGE {
|
||||
print STDERR "\nUsage: caget [options] <PV name> ...\n",
|
||||
print STDERR "\nUsage: caget.pl [options] <PV name> ...\n",
|
||||
"\n",
|
||||
" -h: Help: Print this message\n",
|
||||
"Channel Access options:\n",
|
||||
" -w <sec>: Wait time, specifies longer CA timeout, default is $opt_w second\n",
|
||||
" -w <sec>: 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 <ofs>: Use <ofs> to separate fields on output\n",
|
||||
"\n";
|
||||
"\n",
|
||||
"Base version: ", CA->version, "\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
@@ -52,13 +52,14 @@ sub display {
|
||||
}
|
||||
|
||||
sub HELP_MESSAGE {
|
||||
print STDERR "\nUsage: cainfo [options] <PV name> ...\n",
|
||||
print STDERR "\nUsage: cainfo.pl [options] <PV name> ...\n",
|
||||
"\n",
|
||||
" -h: Help: Print this message\n",
|
||||
"Channel Access options:\n",
|
||||
" -w <sec>: 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;
|
||||
}
|
||||
|
||||
@@ -109,11 +109,11 @@ sub display {
|
||||
}
|
||||
|
||||
sub HELP_MESSAGE {
|
||||
print STDERR "\nUsage: camonitor [options] <PV name> ...\n",
|
||||
print STDERR "\nUsage: camonitor.pl [options] <PV name> ...\n",
|
||||
"\n",
|
||||
" -h: Help: Print this message\n",
|
||||
"Channel Access options:\n",
|
||||
" -w <sec>: Wait time, specifies longer CA timeout, default is $opt_w second\n",
|
||||
" -w <sec>: Wait time, specifies CA timeout, default is $opt_w second\n",
|
||||
" -m <mask>: Specify CA event mask to use, with <mask> 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;
|
||||
}
|
||||
|
||||
@@ -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 <record type>\n",
|
||||
" capr.pl [options] <record name> [<interest>]\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 <sec>: Wait time, specifies CA timeout, default is $opt_w second\n",
|
||||
"Database Definitions:\n",
|
||||
" -d <file.dbd>: 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 <record type>: 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;
|
||||
}
|
||||
|
||||
@@ -151,11 +151,11 @@ sub display {
|
||||
}
|
||||
|
||||
sub HELP_MESSAGE {
|
||||
print STDERR "\nUsage: caput [options] <PV name> <PV value> ...\n",
|
||||
print STDERR "\nUsage: caput.pl [options] <PV name> <PV value> ...\n",
|
||||
"\n",
|
||||
" -h: Help: Print this message\n",
|
||||
"Channel Access options:\n",
|
||||
" -w <sec>: Wait time, specifies longer CA timeout, default is $opt_w second\n",
|
||||
" -w <sec>: 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
\*************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user