Ejemplo n.º 1
0
///////////////////////////////////////////////////
// TEST: (valid) testFederationRestoreComplete() //
///////////////////////////////////////////////////
void FederationRestoreTest::testFederationRestoreComplete()
{
	defaultFederate->quickRestoreRequest( SAVE_LABEL );
	defaultFederate->fedamb->waitForRestoreRequestSuccess( SAVE_LABEL );
	defaultFederate->fedamb->waitForFederationRestoreBegun();
	secondFederate->fedamb->waitForFederationRestoreBegun();
	defaultFederate->fedamb->waitForFederateRestoreInitiated( SAVE_LABEL );
	secondFederate->fedamb->waitForFederateRestoreInitiated( SAVE_LABEL );
	
	try
	{
		defaultFederate->rtiamb->federateRestoreComplete();
		secondFederate->rtiamb->federateRestoreComplete();
	}
	catch( RTI::Exception& e )
	{
		failTest( "Informing the RTI that federate has completed restoring: %s", e._reason );
	}

	defaultFederate->fedamb->waitForFederationRestored();
	secondFederate->fedamb->waitForFederationRestored();
}
//////////////////////////////////////////////////////
// TEST: (valid) testFederationRestoreNotComplete() //
//////////////////////////////////////////////////////
void FederationRestoreTest::testFederationRestoreNotComplete()
{
	defaultFederate->quickRestoreRequest( saveLabel );
	defaultFederate->fedamb->waitForRestoreRequestSuccess( saveLabel );
	defaultFederate->fedamb->waitForFederationRestoreBegun();
	secondFederate->fedamb->waitForFederationRestoreBegun();
	defaultFederate->fedamb->waitForFederateRestoreInitiated( saveLabel );
	secondFederate->fedamb->waitForFederateRestoreInitiated( saveLabel );
	defaultFederate->quickRestoreComplete();
	
	try
	{
		secondFederate->rtiamb->federateRestoreNotComplete();
	}
	catch( RTI::Exception& e )
	{
		failTest( "Informing the RTI that federate has unsuccessfully completed restoring: %s", e._reason );
	}

	defaultFederate->fedamb->waitForFederationNotRestored();
	secondFederate->fedamb->waitForFederationNotRestored();
}
/////////////////////////////////////////
// TEST: (valid) testGetValuePointer() //
/////////////////////////////////////////
void AttributeHandleValuePairSetTest::testGetValuePointer()
{
	const char *aaValue = "one";
	const char *abValue = "two";
	const char *acValue = "three";
	this->theSet->add( 501, aaValue, 4 );
	this->theSet->add( 502, abValue, 4 );
	this->theSet->add( 503, acValue, 6 );

	// Test valid getValuePointer scenarios
	try
	{
		// check aa
		char *value = NULL;
		RTI::ULong valueSize;
		int equals = 1;
		
		value = theSet->getValuePointer( 0, valueSize );
		CPPUNIT_ASSERT_EQUAL( (RTI::ULong)4, valueSize );
		equals = strcmp( aaValue,value );
		CPPUNIT_ASSERT_EQUAL( 0, equals );
		
		// check ab
		value = theSet->getValuePointer( 1, valueSize );
		CPPUNIT_ASSERT_EQUAL( (RTI::ULong)4, valueSize );
		equals = strcmp( abValue,value );
		CPPUNIT_ASSERT_EQUAL( 0, equals );
		
		// check ac
		value = theSet->getValuePointer( 2, valueSize );
		CPPUNIT_ASSERT_EQUAL( (RTI::ULong)6, valueSize );
		equals = strcmp( acValue,value );
		CPPUNIT_ASSERT_EQUAL( 0, equals );
	}
	catch ( RTI::Exception& e )
	{
		failTest( "Unexpected exception during getValuePointer(): %s", e._reason );
	}
}
Ejemplo n.º 4
0
////////////////////////////////////////////////
// TEST: (valid) testCancelNegotiatedDivest() //
////////////////////////////////////////////////
void DivestOwnershipTest::testCancelNegotiatedDivest()
{
	// kick off a divest
	defaultFederate->quickNegotiatedRelease( theObject, 3, aa, ab, ac );
	secondFederate->fedamb->waitForOwnershipOffered( theObject, 3, aa, ab, ac );

	try
	{
		this->ahs = defaultFederate->populatedAHS( 3, aa, ab, ac );
		defaultFederate->rtiamb->cancelNegotiatedAttributeOwnershipDivestiture( theObject, *ahs );
	}
	catch( RTI::Exception& e )
	{
		failTest( "Unexpected exception while cancelling negotiated ownership release: %s",
		          e._reason );
	}

	// try and obtain the attributes in the second federate
	secondFederate->quickAcquireRequest( theObject, 3, aa, ab, ac );
	// if the divest was outstanding, defaultFederate would hand it off right away, but
	// as it isn't, this request should cause a callback requesting the default fed to release
	defaultFederate->fedamb->waitForOwnershipRequest( theObject, 3, aa, ab, ac );
}
Ejemplo n.º 5
0
void MockCheckedActualCall::finalizeOutputParameters(MockCheckedExpectedCall* expectedCall)
{
    for (MockOutputParametersListNode* p = outputParameterExpectations_; p; p = p->next_)
    {
        MockNamedValue outputParameter = expectedCall->getOutputParameter(p->name_);
        MockNamedValueCopier* copier = outputParameter.getCopier();
        if (copier)
        {
            copier->copy(p->ptr_, outputParameter.getObjectPointer());
        }
        else if ((outputParameter.getType() == "const void*") && (p->type_ == "void*"))
        {
            const void* data = outputParameter.getConstPointerValue();
            size_t size = outputParameter.getSize();
            PlatformSpecificMemCpy(p->ptr_, data, size);
        }
        else if (outputParameter.getName() != "")
        {
            SimpleString type = expectedCall->getOutputParameter(p->name_).getType();
            MockNoWayToCopyCustomTypeFailure failure(getTest(), type);
            failTest(failure);
        }
    }
}
Ejemplo n.º 6
0
static int test_001(TestState *state)
{
    TestState state2;
    int listener1, listener2, connection1, count, result;
    char response[1024];

    initState(&state2, "  Subtest", state);

    if (startTest(&state2, "LISTEN")) {
        if (serialRequest(&state2, "LISTEN:HTTP,/robot*"))
            checkSerialResponse(&state2, "=S,^i", &listener1);
    }

    beginGroup(&state2);

    if (startTest(&state2, "PATH of a listener")) {
        if (!skipTest(&state2) && serialRequest(&state2, "PATH:%d", listener1))
            checkSerialResponse(&state2, "=S,/robot*");
    }

    if (startTest(&state2, "Send request to WX module")) {
        if (!skipTest(&state2)) {
            if (sendRequest(&state->moduleAddr, "POST", "/robot?gto=f", "") >= 0)
                passTest(&state2, "");
            else
                failTest(&state2, "");
        }
    }

    beginGroup(&state2);

    if (startTest(&state2, "POLL for incoming POST request")) {
        if (!skipTest(&state2)) {
            do {
                if (!serialRequest(&state2, "POLL"))
                    break;
            } while (!waitAndCheckSerialResponse(&state2, "=N,0,0", "=P,^i,^i", &connection1, &listener2));
        }
    }

    beginGroup(&state2);

    if (startTest(&state2, "listener handle returned by POLL")) {
        if (listener1 == listener2)
            passTest(&state2, "");
        else
            failTest(&state2, ": got %d", listener2);
    }

    if (startTest(&state2, "PATH of a connection")) {
        if (!skipTest(&state2) && serialRequest(&state2, "PATH:%d", connection1))
            checkSerialResponse(&state2, "=S,/robot");
    }

    if (startTest(&state2, "ARG")) {
        if (!skipTest(&state2) && serialRequest(&state2, "ARG:%d,gto", connection1))
            checkSerialResponse(&state2, "=S,f");
    }

    if (startTest(&state2, "REPLY")) {
        if (!skipTest(&state2) && serialRequest(&state2, "REPLY:%d,200", connection1))
            checkSerialResponse(&state2, "=S,^i", &count);
    }

    if (startTest(&state2, "POLL for send complete")) {
        if (!skipTest(&state2)) {
            do {
                if (!serialRequest(&state2, "POLL"))
                    break;
            } while (!waitAndCheckSerialResponse(&state2, "=N,0,0", "=S,^i,0", &count, &listener2));
        }
    }

    if (startTest(&state2, "Receive response from WX")) {
        if (!skipTest(&state2)) {
            if (receiveResponse((uint8_t *)response, sizeof(response), &result) >= 0)
                passTest(&state2, "");
            else
                failTest(&state2, "");
        }
    }

    if (startTest(&state2, "CLOSE")) {
        if (!skipTest(&state2) && serialRequest(&state2, "CLOSE:%d", listener1))
            checkSerialResponse(&state2, "=S,0");
    }

    testResults(&state2);

    return state2.testPassed;
}
Ejemplo n.º 7
0
void run_tests(TestState *parent, int selectedTest)
{
    TestState state;

    initState(&state, "Test", parent);
    state.selectedTest = selectedTest;

    if (startTest(&state, "the empty command")) {
        if (serialRequest(&state, ""))
            checkSerialResponse(&state, "=S,0");
    }

    if (startTest(&state, "an invalid command")) {
        if (serialRequest(&state, "FOO"))
            checkSerialResponse(&state, "=E,1");
    }

#ifdef DO_BLINK_TEST
    if (startTest(&state, "Blink LEDs on GPIO13 and GPIO15")) {
        if (test_blink(&state))
            passTest(&state, "");
        else
            failTest(&state, "");
    }
#endif

    if (state.ssid) {
        if (startTest(&state, "switch to STA+AP mode")) {
            if (serialRequest(&state, "SET:wifi-mode,3"))
                checkSerialResponse(&state, "=S,0");
        }
        if (startTest(&state, "JOIN")) {
            if (serialRequest(&state, "JOIN:%s,%s", state.ssid, state.passwd))
                checkSerialResponse(&state, "=S,0");
            if (state.testPassed)
                msleep(10000); // wait for WX to disconnect. It has a .5 second delay
        }
        beginGroup(&state);
        if (startTest(&state, "CHECK:station-ipaddr")) {
            if (!skipTest(&state)) {
                char ipaddr[32];
                do {
                    if (!serialRequest(&state, "CHECK:station-ipaddr"))
                        break;
                } while (!waitAndCheckSerialResponse(&state, "=S,0.0.0.0", "=S,^s", ipaddr, sizeof(ipaddr)));
                if (state.testPassed) {
                    infoTest(&state, "got '%s'", ipaddr);
                    if (GetInternetAddress(ipaddr, 80, &state.moduleAddr) != 0)
                        infoTest(&state, "error: failed to parse IP address '%s'", ipaddr);
                }
            }
        }
    }

    if (startTest(&state, "simple transaction")) {
        if (test_001(&state))
            passTest(&state, "");
        else
            failTest(&state, "");
    }

    testResults(&state);
}
Ejemplo n.º 8
0
 /** Test that is guaranteed to fail.
  * Leave this in until the complete CLASSNAME class has tests.
  */
 void fail()
 {
     failTest("No unit tests for class CLASSNAME!");
 }
Ejemplo n.º 9
0
void server_test_stream(void)
{
#define MAX_REC_SIZE  256

	struct sockaddr_tipc server_addr;     /* address for socket */
	int listener_sd;		      /* socket to listen on */
	int peer_sd;			      /* socket to receive on */
	int rec_num;			      /* current record number being processed */
	char inbuf[MAX_REC_SIZE];	      /* buffer to receive data into */
	char outbuf = 'X';		      /* buffer to send as an acknowledgement */
	char failMsg[50];		      /* string for failure return code */

	info("****** TIPC stream test server started ******\n\n");

	listener_sd = createSocketTIPC (SOCK_STREAM);

	setServerAddrTo(&server_addr, TIPC_ADDR_NAMESEQ, TS_TEST_TYPE,
	                TS_TEST_INST, TS_TEST_INST);

	server_addr.scope = TS_SCOPE;

	bindSocketTIPC(listener_sd, &server_addr);

	listenSocketTIPC(listener_sd);

	/* now sync with the client */

	sendSyncTIPC(TS_SYNC_ID_1);

	peer_sd = acceptSocketTIPC(listener_sd);


	rec_num = 0;
	while (1) {
		int msg_size;
		int rec_size;

		msg_size = recv(peer_sd, inbuf, 4, MSG_WAITALL);
		if (msg_size == 0) {
			debug("Server: client terminated normally\n");
			break;
		}
		if (msg_size < 0) {
			failTest("Server: client terminated abnormally\n");
		}

		rec_num++;

		rec_size = *(__u32 *)inbuf;
		rec_size = ntohl(rec_size);

		debug("Server: receiving record %d of %u bytes\n",
		      rec_num, rec_size);

		msg_size = recv(peer_sd, inbuf, rec_size, MSG_WAITALL);

		if (msg_size != rec_size) {
			sprintf(failMsg,"Server: receive error, got %d bytes\n",
			        msg_size);
			failTest(failMsg);
		}
		while (msg_size > 0) {
			if ((unsigned char)inbuf[--msg_size] != rec_size) {
				failTest("Server: record content error\n");
			}
		}
		debug("Server: record %d received\n", rec_num);

		/* Send 1 byte acknowledgement (value is irrelevant) */

		if (0 >= send(peer_sd, &outbuf, 1, 0)) {
			failTest("Server: failed to send response\n");
		}
		debug("Server: record %d acknowledged\n", rec_num);
	}

	closeSocketTIPC(peer_sd);
	closeSocketTIPC(listener_sd);
	recvSyncTIPC(TS_SYNC_ID_2);
	info("****** TIPC stream test server finished ******\n");
}
Ejemplo n.º 10
0
void server_mcast
(
        int *sd,		 /* array of sockets */
        fd_set *readfds,	 /* file descriptor for all the sockets */
        int numSubTest				 /* subtest currently being run */
)
{
	static int expected[TIPC_MCAST_SUBTESTS][TIPC_MCAST_SOCKETS] = {
		{1,1,1,0,0},
		{0,0,1,1,0},
		{0,0,0,1,1},
		{1,1,1,1,1}
	};

	fd_set fds;
	struct timeval timeout;	/* timeout structure for select */
	int num_ready;
	int i;					 /* loop variable */
	int gotMsg;
	char buf[100];				/* buffer to receive into */

	recvSyncTIPC (TS_SYNC_ID_3);	/* wait for client to finish sending messages */

	fds = *readfds;
	timeout.tv_sec  = 0;
	timeout.tv_usec = 0;
	num_ready = select(FD_SETSIZE, &fds, NULL, NULL, &timeout);

	if (num_ready < 0)
		failTest("select() returned error");

	/* Handle special case of inter-cluster multicasting */

	if (!client_in_same_cluster) {
		if (num_ready > 0)
			failTest("unexpected multicast messages received");
		else
			goto exit;
	}

	/* Handle normal case of intra-cluster multicasting */

	for (i = 0; i < TIPC_MCAST_SOCKETS; i++) {
		gotMsg = !!FD_ISSET(sd[i], &fds);

		if (gotMsg != expected[numSubTest][i]) {
			printf("multicast subtest %d index %d expected %d got %d\n",numSubTest, i, expected[numSubTest][i], gotMsg);
			failTest("unexpected multicast result");
		}

		if (gotMsg && recvfrom(sd[i], buf, sizeof(buf), MSG_DONTWAIT,
		                       NULL, NULL) < 0) {
			failTest("multicast message not received");
		}

		if (recvfrom(sd[i], buf, sizeof(buf), MSG_DONTWAIT,
		                NULL, NULL) >= 0) {
			failTest("second multicast message received");
		}
	}

exit:
	debug ("Just finished SubTest %d\n", numSubTest + 1);
	sendSyncTIPC (TS_SYNC_ID_4);	/* tell client to continue */
}
Ejemplo n.º 11
0
void server_test_anc_connectionless(void)
{

	int sos;	  /* socket to send/receive on */
	int anc_data[3];  /* array for received anc data */

	char buf[TS_ANCBUFSZ];		    /* buffer for the message */
	char failStr[50];		    /* string for the failure return codes */
	char str[16];			    /* another string for the return codes */
	char ancSpace[CMSG_SPACE(12)];		/* 12 bytes to retrieve the name used by the client */

	struct sockaddr_tipc saddr;				/* address for the socket */
	struct msghdr ctrlbuf;					/* control buffer structure */
	struct cmsghdr * anc = (struct cmsghdr *)ancSpace;	/* pointer to the anc data */
	struct iovec iov[1];				    /* array of iov structures */

	iov[0].iov_base = buf;
	iov[0].iov_len = TS_ANCBUFSZ;

	ctrlbuf.msg_name = NULL;
	ctrlbuf.msg_namelen = 0;
	ctrlbuf.msg_controllen = (CMSG_SPACE(12));  /* see above */
	ctrlbuf.msg_control = (void*)anc;
	ctrlbuf.msg_iov = iov;
	ctrlbuf.msg_iovlen = 1;



	setServerAddrTo(&saddr, TIPC_ADDR_NAMESEQ, TS_TEST_TYPE, TS_LOWER, TS_UPPER);
	saddr.scope = TS_SCOPE;


	sos = createSocketTIPC (SOCK_RDM);

	bindSocketTIPC (sos ,&saddr);

	/* now sync with the client */
	sendSyncTIPC(TS_SYNC_ID_1);

	/* the client will now send 2 messages
	and the server has to wait for them to be sent before continuing
	without this resync the server can close the socket too quickly and then the ANC data
	would have the error of TIPC_ERR_NO_NAME instead of TIPC_ERR_NO_PORT when client
	and server are not on the same node */
	recvSyncTIPC(TS_SYNC_ID_2);

	ctrlbuf.msg_controllen = CMSG_SPACE(12);
	if (0 > recvmsg (sos, &ctrlbuf, 0)) {
		failTest ("recvmsg");

	}

	anc = CMSG_FIRSTHDR(&ctrlbuf);

	if (anc == NULL)
		failTest ("FAILED (server) anc is NULL");

	if (TIPC_DESTNAME != anc->cmsg_type) {
		anc_data_type(str, anc->cmsg_type);
		sprintf (failStr,"bad anc data type = %d = %s",
		         anc->cmsg_type, str);
		failTest (failStr);
	}


	anc_data[0] = *((unsigned int*)(CMSG_DATA(anc) + 0));
	anc_data[1] = *((unsigned int*)(CMSG_DATA(anc) + 4));
	anc_data[2] = *((unsigned int*)(CMSG_DATA(anc) + 8));

	if (TS_TEST_TYPE != anc_data[0]) {
		sprintf (failStr,"wrong name %x ",anc_data[2]);
		failTest(failStr);
	}

	if (TS_TEST_INST != anc_data[1]) {
		sprintf (failStr,"wrong instance %x",anc_data[1]);
		failTest(failStr);
	}

	if (TS_TEST_INST != anc_data[2]) {
		sprintf (failStr,"wrong instance %x",anc_data[2]);
		failTest(failStr);
	}

	sleep (1);				/* may be able to replace the sleep with another sync message */
	closeSocketTIPC (sos);

	recvSyncTIPC (TS_SYNC_ID_3);

}
Ejemplo n.º 12
0
void server_test_anc_connection(void)
{
	int sol;			   /* socket to listen on */
	int sos;	       /* socket to receive on */
	int ii;				   /* loop counter */
	int anc_data[3];	   /* array for received data */

	char buf[TS_ANCBUFSZ];	       /* buffer to receive into */
	char failStr[50];	       /* string for failure return codes */
	char str[16];		       /* another string for return codes */
	char ancSpace[CMSG_SPACE(12)]; /* 12 bytes to retrieve the name used by the client */

	struct sockaddr_tipc saddr;			   /* address for the sending socket */
	struct msghdr ctrlbuf;				   /* the control buffer structure */
	struct cmsghdr * anc = (struct cmsghdr *)ancSpace; /* pointer to the anc data */
	struct iovec iov[1];				   /* array of iov structures */

	iov[0].iov_base = buf;
	iov[0].iov_len = TS_ANCBUFSZ;

	ctrlbuf.msg_name = NULL;
	ctrlbuf.msg_namelen = 0;
	ctrlbuf.msg_controllen = (CMSG_SPACE(12));  /* see above */
	ctrlbuf.msg_control = (void*)anc;
	ctrlbuf.msg_iov = iov;
	ctrlbuf.msg_iovlen = 1;



	setServerAddrTo(&saddr, TIPC_ADDR_NAMESEQ, TS_TEST_TYPE, TS_LOWER, TS_UPPER);
	saddr.scope = TS_SCOPE;

	sol = createSocketTIPC (SOCK_SEQPACKET);

	listenSocketTIPC (sol);	/*  was passing 20 to listen*/

	bindSocketTIPC(sol, &saddr);

	/* now sync with the client */

	sendSyncTIPC(TS_SYNC_ID_1);

	sos = acceptSocketTIPC(sol);

	if (0 > recvmsg (sos, &ctrlbuf, 0))
		failTest ("FAILED (server) bad recvmsg return code");



	/* retrieving the name used by the client; could be a name sequence (12 bytes) */
	anc = CMSG_FIRSTHDR(&ctrlbuf);

	if (anc == NULL)
		failTest ("FAILED (server) anc is NULL");

	if (TIPC_DESTNAME != anc->cmsg_type) {
		anc_data_type(str, anc->cmsg_type);
		sprintf (failStr,"bad anc data type = %d = %s",
		         anc->cmsg_type, str);
		failTest (failStr);
	}

	anc_data[0] = *((unsigned int*)(CMSG_DATA(anc) + 0));
	anc_data[1] = *((unsigned int*)(CMSG_DATA(anc) + 4));
	anc_data[2] = *((unsigned int*)(CMSG_DATA(anc) + 8));

	if (TS_TEST_TYPE != anc_data[0]) {
		sprintf (failStr,"FAILED (server) wrong name %d \n", anc_data[0]);
		failTest (failStr);
	}
	if (TS_TEST_INST != anc_data[1]) {
		sprintf (failStr,"FAILED (server) wrong instance %x\n", anc_data[1]);
		failTest (failStr);
	}
	if (TS_TEST_INST != anc_data[2]) {
		sprintf (failStr,"FAILED (server) wrong instance %x\n", anc_data[2]);
		failTest (failStr);
	}

	debug ("server_test_anc : anc data : %x %x %x\n"
	       ,(*(unsigned int*)(CMSG_DATA(anc) + 0))
	       ,(*(unsigned int*)(CMSG_DATA(anc) + 4))
	       ,(*(unsigned int*)(CMSG_DATA(anc) + 8))
	      );

	debug ("server_test_anc : msg with name used: '%s'\n" ,buf);


	/* exchange a couple of messages for the fun of it */
	for (ii = 0; ii < 3; ii++) {
		sendSocketBuffTIPC(sos, "ONE", 1, 4, 0);

		if (0 > recv (sos ,buf ,TS_ANCBUFSZ ,0))
			failTest ("server_test_anc: (recv)");


		debug ("server_test_anc : received '%s'\n" ,buf);
	}

	debug ("server_test_anc : closing socket: \n"
	       "peer will get errcode through anc data\n");

	sendSocketBuffTIPC (sos, "OMEGA", 1, 6, 0); /* 'OMEGA' message will cause client to quit its loop */

	sleep (1);  /* wait for the client to send back a 'END' message so that it get rejected */

	closeSocketTIPC (sos);
	closeSocketTIPC (sol);

	recvSyncTIPC (TS_SYNC_ID_2);

}
Ejemplo n.º 13
0
void tipcTestServer(void)
{
	int test;	    /* this is the test passed from the Test Client process */
	int testIndex;	/* this is the index used to find the actual test we want to run*/
	int ntimes;	/* this is the number of times a test will be run */

	int res;	/* the return code from the recv() */
	int msgSize;	/* the size of the message */

	int sockfd_S;	/* the socket used to receive the test from the client */
	struct sockaddr_tipc addr; /* the TIPC address data structure */
	struct sockaddr_tipc from; /* the address data structure for the client */
	struct sockaddr_tipc self; /* the TIPC address data structure */
	socklen_t fromLen = sizeof(struct sockaddr_tipc); /* the length of the return address */
	socklen_t selfLen = sizeof(struct sockaddr_tipc); /* the length of the return address */
	__u32 domain;
	__u32 client_domain;

	debug("Starting Server\n");

	setServerAddr (&addr);
	msgSize = sizeof(test);

	while (1) {
		fflush (stdout);
		ntimes = TS_NUMTIMES;

		/* Get test identifier from client */

		sockfd_S = createSocketTIPC (SOCK_RDM);
		bindSocketTIPC (sockfd_S, &addr);
		sendSyncTIPC (TS_SYNC_WAITING_FOR_TEST_ID);
		res = recvfrom (sockfd_S, (char *)&test, msgSize, 0, (struct sockaddr *) &from, &fromLen);
		if (res > 0)
			test = (int)ntohl(test);
		else
			test = TS_INVALID_TEST;

		if (getsockname (sockfd_S, (struct sockaddr *) &self, &selfLen) != 0)
			failTest ("getsockname() error");
		domain = self.addr.id.node;
		client_domain= from.addr.id.node;
		client_in_same_cluster =
		        ((tipc_zone(domain) == tipc_zone(client_domain))
		         && (tipc_cluster(domain) == tipc_cluster(client_domain)));

		closeSocketTIPC (sockfd_S);

		/* Validate test identifier */

		if (test == TS_KILL_SERVER) {
			break;
		}
		if ((test >= ts_lastStressTest)
		                || ((test >= ts_lastSanityTest) && (test <TS_FIRST_STRESS_TEST))) {
			printf("TIPC Server: Invalid test number (%d)\n", test);
			killme(1);
		}

		/* Run the specified test */

		info("Server says test # %d\n", test);

		recvSyncTIPC (TS_SYNC_FINISHED_TEST_ID);

		for (testIndex = 0; testIndex <= TS_NUMBER_OF_TESTS; testIndex++) {
			if (serverList[testIndex].testNum == test)
				do {
					info("TIPC Server %s test...STARTED!\n",testName(test));
					serverList[testIndex].test();
					info("TIPC Server %s test...PASSED!\n\n",testName(test));
				} while ( --ntimes > 0 );
		}
	}

	printf("TIPC Server: Client told us to quit\n");
}