mirror of https://github.com/ARMmbed/mbed-os.git
TC and UDP client updates. Added automation information to test suite. Added new peripherial: 'ethernet'
parent
b345a189cf
commit
47a8df4b51
|
@ -14,7 +14,6 @@ int main() {
|
||||||
char out_buffer[] = "Hello World\n";
|
char out_buffer[] = "Hello World\n";
|
||||||
char out_success[] = "{{success}}\n{{end}}\n";
|
char out_success[] = "{{success}}\n{{end}}\n";
|
||||||
char out_failure[] = "{{failure}}\n{{end}}\n";
|
char out_failure[] = "{{failure}}\n{{end}}\n";
|
||||||
|
|
||||||
s_ip_address ip_addr = {0, 0, 0, 0};
|
s_ip_address ip_addr = {0, 0, 0, 0};
|
||||||
int port = 0;
|
int port = 0;
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,9 @@ int main() {
|
||||||
CHECK(rc, "connect");
|
CHECK(rc, "connect");
|
||||||
printf("IP: %s\n", eth.getIPAddress());
|
printf("IP: %s\n", eth.getIPAddress());
|
||||||
|
|
||||||
UDPSocket sock;
|
UDPSocket socket;
|
||||||
rc = sock.init();
|
rc = socket.init();
|
||||||
CHECK(rc, "sock init");
|
CHECK(rc, "socket init");
|
||||||
|
|
||||||
printf("UDPClient IP Address is %s\r\n", eth.getIPAddress());
|
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);
|
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);
|
rc = echo_server.set_address(buffer, port);
|
||||||
CHECK(rc, "set_address");
|
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");
|
CHECK(rc, "sendTo");
|
||||||
|
|
||||||
int n = sock.receiveFrom(echo_server, buffer, sizeof(buffer));
|
int n = socket.receiveFrom(echo_server, buffer, sizeof(buffer));
|
||||||
CHECK(n, "receiveFrom");
|
CHECK(n, "receiveFrom");
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
buffer[n] = '\0';
|
buffer[n] = '\0';
|
||||||
printf("%s", buffer);
|
printf("%s", buffer);
|
||||||
if (strncmp(out_buffer, buffer, sizeof(out_buffer) - 1) == 0) {
|
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();
|
eth.disconnect();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ class StdioTest(DefaultTest):
|
||||||
print "\n{%s}\n{end}" % result
|
print "\n{%s}\n{end}" % result
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
test_result = True
|
test_result = True
|
||||||
|
|
||||||
for i in range(1, 5):
|
for i in range(1, 5):
|
||||||
|
|
|
@ -267,6 +267,8 @@ TESTS = [
|
||||||
"id": "MBED_2", "description": "stdio",
|
"id": "MBED_2", "description": "stdio",
|
||||||
"source_dir": join(TEST_DIR, "mbed", "stdio"),
|
"source_dir": join(TEST_DIR, "mbed", "stdio"),
|
||||||
"dependencies": [MBED_LIBRARIES],
|
"dependencies": [MBED_LIBRARIES],
|
||||||
|
"automated": True,
|
||||||
|
"host_test": "stdio_auto"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "MBED_3", "description": "PortOut",
|
"id": "MBED_3", "description": "PortOut",
|
||||||
|
@ -537,21 +539,33 @@ TESTS = [
|
||||||
"id": "NET_3", "description": "TCP echo server",
|
"id": "NET_3", "description": "TCP echo server",
|
||||||
"source_dir": join(TEST_DIR, "net", "echo", "tcp_server"),
|
"source_dir": join(TEST_DIR, "net", "echo", "tcp_server"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
||||||
|
"automated": True,
|
||||||
|
"host_test" : "tcpecho_server_auto",
|
||||||
|
"peripherals": ["ethernet"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_4", "description": "TCP echo client",
|
"id": "NET_4", "description": "TCP echo client",
|
||||||
"source_dir": join(TEST_DIR, "net", "echo", "tcp_client"),
|
"source_dir": join(TEST_DIR, "net", "echo", "tcp_client"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
||||||
|
"automated": True,
|
||||||
|
"host_test": "tcpecho_client_auto",
|
||||||
|
"peripherals": ["ethernet"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_5", "description": "UDP echo server",
|
"id": "NET_5", "description": "UDP echo server",
|
||||||
"source_dir": join(TEST_DIR, "net", "echo", "udp_server"),
|
"source_dir": join(TEST_DIR, "net", "echo", "udp_server"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
||||||
|
"automated": True,
|
||||||
|
"host_test" : "udpecho_server_auto",
|
||||||
|
"peripherals": ["ethernet"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_6", "description": "UDP echo client",
|
"id": "NET_6", "description": "UDP echo client",
|
||||||
"source_dir": join(TEST_DIR, "net", "echo", "udp_client"),
|
"source_dir": join(TEST_DIR, "net", "echo", "udp_client"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
||||||
|
"automated": True,
|
||||||
|
"host_test" : "udpecho_client_auto",
|
||||||
|
"peripherals": ["ethernet"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_7", "description": "HTTP client",
|
"id": "NET_7", "description": "HTTP client",
|
||||||
|
|
Loading…
Reference in New Issue