TC and UDP client updates. Added automation information to test suite. Added new peripherial: 'ethernet'

pull/216/head
Przemek Wirkus 2014-03-17 17:39:24 +00:00
parent b345a189cf
commit 47a8df4b51
4 changed files with 46 additions and 34 deletions

View File

@ -14,7 +14,6 @@ int main() {
char out_buffer[] = "Hello World\n";
char out_success[] = "{{success}}\n{{end}}\n";
char out_failure[] = "{{failure}}\n{{end}}\n";
s_ip_address ip_addr = {0, 0, 0, 0};
int port = 0;

View File

@ -32,9 +32,9 @@ int main() {
CHECK(rc, "connect");
printf("IP: %s\n", eth.getIPAddress());
UDPSocket sock;
rc = sock.init();
CHECK(rc, "sock init");
UDPSocket socket;
rc = socket.init();
CHECK(rc, "socket init");
printf("UDPClient IP Address is %s\r\n", eth.getIPAddress());
sprintf(buffer, "%d.%d.%d.%d", ip_addr.ip_1, ip_addr.ip_2, ip_addr.ip_3, ip_addr.ip_4);
@ -43,23 +43,23 @@ int main() {
rc = echo_server.set_address(buffer, port);
CHECK(rc, "set_address");
rc = sock.sendTo(echo_server, out_buffer, sizeof(out_buffer));
rc = socket.sendTo(echo_server, out_buffer, sizeof(out_buffer));
CHECK(rc, "sendTo");
int n = sock.receiveFrom(echo_server, buffer, sizeof(buffer));
int n = socket.receiveFrom(echo_server, buffer, sizeof(buffer));
CHECK(n, "receiveFrom");
if (n > 0)
{
buffer[n] = '\0';
printf("%s", buffer);
if (strncmp(out_buffer, buffer, sizeof(out_buffer) - 1) == 0) {
sock.sendTo(echo_server, out_success, sizeof(out_success) - 1);
socket.sendTo(echo_server, out_success, sizeof(out_success) - 1);
}
}
sock.sendTo(echo_server, out_failure, sizeof(out_failure) - 1);
socket.sendTo(echo_server, out_failure, sizeof(out_failure) - 1);
sock.close();
socket.close();
eth.disconnect();
return 0;
}

View File

@ -30,7 +30,6 @@ class StdioTest(DefaultTest):
print "\n{%s}\n{end}" % result
def run(self):
test_result = True
for i in range(1, 5):

View File

@ -267,6 +267,8 @@ TESTS = [
"id": "MBED_2", "description": "stdio",
"source_dir": join(TEST_DIR, "mbed", "stdio"),
"dependencies": [MBED_LIBRARIES],
"automated": True,
"host_test": "stdio_auto"
},
{
"id": "MBED_3", "description": "PortOut",
@ -537,21 +539,33 @@ TESTS = [
"id": "NET_3", "description": "TCP echo server",
"source_dir": join(TEST_DIR, "net", "echo", "tcp_server"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"automated": True,
"host_test" : "tcpecho_server_auto",
"peripherals": ["ethernet"]
},
{
"id": "NET_4", "description": "TCP echo client",
"source_dir": join(TEST_DIR, "net", "echo", "tcp_client"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"automated": True,
"host_test": "tcpecho_client_auto",
"peripherals": ["ethernet"]
},
{
"id": "NET_5", "description": "UDP echo server",
"source_dir": join(TEST_DIR, "net", "echo", "udp_server"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"automated": True,
"host_test" : "udpecho_server_auto",
"peripherals": ["ethernet"]
},
{
"id": "NET_6", "description": "UDP echo client",
"source_dir": join(TEST_DIR, "net", "echo", "udp_client"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
"automated": True,
"host_test" : "udpecho_client_auto",
"peripherals": ["ethernet"]
},
{
"id": "NET_7", "description": "HTTP client",