ndt-dev - [ndt-dev] [ndt] r945 committed - Merged Issue123 branch to resolve Issue 123.
Subject: NDT-DEV email list created
List archive
- From:
- To:
- Subject: [ndt-dev] [ndt] r945 committed - Merged Issue123 branch to resolve Issue 123.
- Date: Thu, 20 Feb 2014 20:09:03 +0000
Revision: 945
Author:
Date: Thu Feb 20 20:08:46 2014 UTC
Log: Merged Issue123 branch to resolve Issue 123.
http://code.google.com/p/ndt/source/detail?r=945
Modified:
/trunk
/trunk/flash-client/src/Main.as
/trunk/flash-client/src/NDTPController.as
/trunk/flash-client/src/NDTUtils.as
/trunk/flash-client/src/TestMETA.as
/trunk/src/protocol.h
/trunk/src/testoptions.c
/trunk/src/web100srv.c
=======================================
--- /trunk/flash-client/src/Main.as Sun Feb 2 19:14:17 2014 UTC
+++ /trunk/flash-client/src/Main.as Thu Feb 20 20:08:46 2014 UTC
@@ -26,6 +26,7 @@
public static var locale:String = CONFIG::defaultLocale;
public static var gui:GUI;
public static var server_hostname:String = NDTConstants.SERVER_HOSTNAME;
+ public static var client_application:String = NDTConstants.CLIENT_ID;
public function Main():void {
if (stage)
@@ -45,7 +46,8 @@
// Set the properties of the SWF from HTML tags.
NDTUtils.initializeFromHTML(this.root.loaderInfo.parameters);
- var frame:NDTPController = new NDTPController(server_hostname);
+ var frame:NDTPController = new NDTPController(server_hostname,
+ client_application);
stage.showDefaultContextMenu = false;
if (guiEnabled) {
=======================================
--- /trunk/flash-client/src/NDTPController.as Sun Feb 2 19:14:17 2014 UTC
+++ /trunk/flash-client/src/NDTPController.as Thu Feb 20 20:08:46 2014 UTC
@@ -42,9 +42,11 @@
private var _remoteTestResults:String;
private var _testsToRun:Array;
private var _testStage:int;
+ private var _clientApplication:String;
- public function NDTPController(hostname:String) {
+ public function NDTPController(hostname:String, clientApplication:String) {
_hostname = hostname;
+ _clientApplication = clientApplication;
_remoteTestResults = ""
}
@@ -125,7 +127,9 @@
s2c.run();
break;
case TestType.META:
- var meta:TestMETA = new TestMETA(_ctlSocket, this);
+ var meta:TestMETA = new TestMETA(_ctlSocket,
+ _clientApplication,
+ this);
meta.run();
break;
default:
=======================================
--- /trunk/flash-client/src/NDTUtils.as Fri Feb 14 16:55:41 2014 UTC
+++ /trunk/flash-client/src/NDTUtils.as Thu Feb 20 20:08:46 2014 UTC
@@ -91,6 +91,20 @@
"Initialized server from JavaScript. Server hostname:"
+ Main.server_hostname);
}
+ } catch(e:Error) {
+ TestResults.appendDebugMsg("Bad Flash permissions: No "
+ + "access to javascript.");
+ }
+ try {
+ var js_client_application:String =
+ ExternalInterface.call("getClientApplication");
+ if (js_client_application) {
+ Main.client_application = js_client_application;
+ TestResults.appendDebugMsg(
+ "Initialized client application from JavaScript. " +
+ "Client application: "
+ + Main.client_application);
+ }
} catch(e:Error) {
TestResults.appendDebugMsg("Bad Flash permissions: No "
+ "access to javascript.");
=======================================
--- /trunk/flash-client/src/TestMETA.as Sun Feb 2 19:14:17 2014 UTC
+++ /trunk/flash-client/src/TestMETA.as Thu Feb 20 20:08:46 2014 UTC
@@ -37,10 +37,14 @@
private var _metaTestSuccess:Boolean;
private var _msg:Message;
private var _testStage:int;
+ private var _clientApplication:String;
- public function TestMETA(ctlSocket:Socket, callerObject:NDTPController) {
+ public function TestMETA(ctlSocket:Socket,
+ clientApplication:String,
+ callerObject:NDTPController) {
_callerObj = callerObject;
_ctlSocket = ctlSocket;
+ _clientApplication = clientApplication;
_metaTestSuccess = true; // Initially the test has not failed.
}
@@ -192,7 +196,13 @@
bodyToSend.clear();
bodyToSend.writeUTFBytes(new String(
- NDTConstants.META_CLIENT_APPLICATION + ":" + NDTConstants.CLIENT_ID));
+ NDTConstants.META_CLIENT_APPLICATION + ":" + _clientApplication));
+ _msg = new Message(MessageType.TEST_MSG, bodyToSend);
+ if (!_msg.sendMessage(_ctlSocket)) {
+ _metaTestSuccess = false;
+ endTest();
+ return;
+ }
// Client can send any number of such meta data in a TEST_MSG format and
// signal the send of the transmission using an empty TEST_MSG.
=======================================
--- /trunk/src/protocol.h Thu Nov 15 21:34:19 2012 UTC
+++ /trunk/src/protocol.h Thu Feb 20 20:08:46 2014 UTC
@@ -25,10 +25,24 @@
#define MSG_WAITING 10
#define SRV_QUEUE_TEST_STARTS_NOW 0
+#define SRV_QUEUE_TEST_STARTS_NOW_STR "0"
+#define SRV_QUEUE_TEST_STARTS_NOW_STR_LN 4
+
#define SRV_QUEUE_SERVER_FAULT 9977
+#define SRV_QUEUE_SERVER_FAULT_STR "9977"
+#define SRV_QUEUE_SERVER_FAULT_STR_LN 4
+
#define SRV_QUEUE_SERVER_BUSY 9988
+#define SRV_QUEUE_SERVER_BUSY_STR "9988"
+#define SRV_QUEUE_SERVER_BUSY_STR_LN 4
+
#define SRV_QUEUE_HEARTBEAT 9990
+#define SRV_QUEUE_HEARTBEAT_STR "9990"
+#define SRV_QUEUE_HEARTBEAT_STR_LN 4
+
#define SRV_QUEUE_SERVER_BUSY_60s 9999
+#define SRV_QUEUE_SERVER_BUSY_60s_STR "9999"
+#define SRV_QUEUE_SERVER_BUSY_60s_STR_LN 4
/*
#define TEST_NONE 0
=======================================
--- /trunk/src/testoptions.c Mon Oct 14 13:20:21 2013 UTC
+++ /trunk/src/testoptions.c Thu Feb 20 20:08:46 2014 UTC
@@ -210,6 +210,10 @@
int msgType;
int msgLen = 1;
int first = 1;
+ char *invalid_test_suite = "Invalid test suite request.";
+ char *client_timeout = "Client timeout.";
+ char *invalid_test = "Invalid test request.";
+
// char remhostarr[256], protologlocalarr[256];
// char *remhost_ptr = get_remotehost();
@@ -218,8 +222,8 @@
// read the test suite request
if (recv_msg(ctlsockfd, &msgType, &useropt, &msgLen)) {
- snprintf(buff, buff_strlen, "Invalid test suite request");
- send_msg(ctlsockfd, MSG_ERROR, buff, strlen(buff));
+ send_msg(ctlsockfd, MSG_ERROR, invalid_test_suite,
+ strlen(invalid_test_suite));
return (-1);
}
if (msgLen == -1) {
@@ -228,8 +232,7 @@
}
// Expecting a MSG_LOGIN with payload byte indicating tests to be run
if ((msgType != MSG_LOGIN) || (msgLen != 1)) {
- snprintf(buff, buff_strlen, "Invalid test request");
- send_msg(ctlsockfd, MSG_ERROR, buff, strlen(buff));
+ send_msg(ctlsockfd, MSG_ERROR, invalid_test, strlen(invalid_test));
return (-2);
}
// client connect received correctly. Logging activity
@@ -244,8 +247,8 @@
& (TEST_MID | TEST_C2S | TEST_S2C | TEST_SFW | TEST_STATUS
| TEST_META))) {
// message received does not indicate a valid test!
- snprintf(buff, buff_strlen, "Invalid test suite request");
- send_msg(ctlsockfd, MSG_ERROR, buff, strlen(buff));
+ send_msg(ctlsockfd, MSG_ERROR, invalid_test_suite,
+ strlen(invalid_test_suite));
return (-3);
}
// construct test suite request based on user options received
=======================================
--- /trunk/src/web100srv.c Fri Feb 14 16:47:01 2014 UTC
+++ /trunk/src/web100srv.c Thu Feb 20 20:08:46 2014 UTC
@@ -748,7 +748,7 @@
int i = 0, retcode;
struct timeval sel_tv;
fd_set rfd;
- char tmpstr[8], buff[32];
+ char buff[32];
int msgType, msgLen = 1;
tmp_ptr = (struct ndtchild *) head_ptr;
@@ -763,7 +763,6 @@
pre_ptr = tmp_ptr;
tmp_ptr = tmp_ptr->next;
}
- snprintf(tmpstr, sizeof(tmpstr), "9990");
i = 0;
while (tmp_ptr != NULL) {
if (tmp_ptr->oldclient == 0) {
@@ -779,8 +778,9 @@
tmp_ptr->pid);
// send "keep-alive" SRV_QUEUE message to client and expect a response
- retcode = send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE, tmpstr,
- strlen(tmpstr));
+ retcode = send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_HEARTBEAT_STR,
+ SRV_QUEUE_HEARTBEAT_STR_LN);
log_println(6,
"send_msg() returned %d during zombie check on client %d",
retcode, tmp_ptr->pid);
@@ -2018,7 +2018,9 @@
while (head_ptr != NULL) {
/* send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9933", 4); */
// indicate server waiting in queue
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9988", 4);
+ send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_SERVER_BUSY_STR,
+ SRV_QUEUE_SERVER_BUSY_STR_LN);
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2037,7 +2039,9 @@
"clients", head_ptr->pid);
while (head_ptr != NULL) {
/* send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9977", 4); */
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9988", 4);
+ send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_SERVER_BUSY_STR,
+ SRV_QUEUE_SERVER_BUSY_STR_LN);
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2071,7 +2075,9 @@
head_ptr->pipe, head_ptr->running, head_ptr->ctlsockfd,
head_ptr->oldclient, head_ptr->tests);
// boot the client
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9988", 4);
+ send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_SERVER_BUSY_STR,
+ SRV_QUEUE_SERVER_BUSY_STR_LN);
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2278,9 +2284,9 @@
0,
"Too many clients/mclients (%d) waiting to be served, "
"Please try again later.", chld_pid);
- // 9988 = server_BUSY_OR_ERROR
- snprintf(tmpstr, sizeof(tmpstr), "9988");
- send_msg(ctlsockfd, SRV_QUEUE, tmpstr, strlen(tmpstr));
+ send_msg(ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_SERVER_BUSY_STR,
+ SRV_QUEUE_SERVER_BUSY_STR_LN);
close(chld_pipe[0]);
close(chld_pipe[1]);
shutdown(ctlsockfd, SHUT_WR);
@@ -2297,18 +2303,16 @@
t_opts = initialize_tests(ctlsockfd, &testopt, test_suite,
sizeof(test_suite));
if (t_opts < 1) { // some error in initialization routines
- log_println(
- 3,
- "Invalid test suite string '%s' received, terminate child",
- test_suite);
+ log_println(3, "Invalid test suite received, terminate child");
close(chld_pipe[0]);
close(chld_pipe[1]);
shutdown(ctlsockfd, SHUT_WR);
close(ctlsockfd);
kill(chld_pid, SIGTERM);
if (new_child != NULL) {
- log_println(6, "invalid test suite, freeing new_child=0x%x",
- new_child);
+ log_println(6, "Freeing new_child=0x%x because of "
+ "invalid test suite",
+ new_child);
free(new_child);
}
continue;
@@ -2342,7 +2346,7 @@
else
new_child->oldclient = 0;
memset(new_child->tests, 0, sizeof(test_suite));
- memcpy(new_child->tests, test_suite, strlen(test_suite));
+ memcpy(new_child->tests, test_suite, sizeof(test_suite));
new_child->next = NULL;
/* sigprocmask(SIG_SETMASK, &oldmask, NULL); */
sem_post(&ndtq);
@@ -2363,7 +2367,9 @@
3,
"queuing disabled and testing in progress, tell client no");
/* send_msg(new_child->ctlsockfd, SRV_QUEUE, "9944", 4); */
- send_msg(new_child->ctlsockfd, SRV_QUEUE, "9988", 4);
+ send_msg(new_child->ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_SERVER_BUSY_STR,
+ SRV_QUEUE_SERVER_BUSY_STR_LN);
close(chld_pipe[1]);
shutdown(new_child->ctlsockfd, SHUT_WR);
close(new_child->ctlsockfd);
- [ndt-dev] [ndt] r945 committed - Merged Issue123 branch to resolve Issue 123., ndt, 02/20/2014
Archive powered by MHonArc 2.6.16.