lwip: Migrated to utest framework

per @bridadan
pull/4369/head
Christopher Haster 2017-05-03 16:20:39 -05:00 committed by Martin Kojtal
parent 0887683a13
commit 467eb342f0
12 changed files with 243 additions and 80 deletions

View File

@ -56,8 +56,8 @@ utest::v1::status_t test_setup(const size_t number_of_cases) {
} }
Case cases[] = { Case cases[] = {
Case("Testing bringing the network up and down", test_bring_up_down<1>), Case("Bringing the network up and down", test_bring_up_down<1>),
Case("Testing bringing the network up and down twice", test_bring_up_down<2>), Case("Bringing the network up and down twice", test_bring_up_down<2>),
}; };
Specification specification(test_setup, cases); Specification specification(test_setup, cases);

View File

@ -97,10 +97,10 @@ utest::v1::status_t test_setup(const size_t number_of_cases) {
} }
Case cases[] = { Case cases[] = {
Case("Testing DNS query", test_dns_query), Case("DNS query", test_dns_query),
Case("Testing DNS preference query", test_dns_query_pref), Case("DNS preference query", test_dns_query_pref),
Case("Testing DNS literal", test_dns_literal), Case("DNS literal", test_dns_literal),
Case("Testing DNS preference literal", test_dns_literal_pref), Case("DNS preference literal", test_dns_literal_pref),
}; };
Specification specification(test_setup, cases); Specification specification(test_setup, cases);

View File

@ -10,6 +10,9 @@
#include "TCPSocket.h" #include "TCPSocket.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h"
using namespace utest::v1;
#ifndef MBED_CFG_TCP_CLIENT_ECHO_BUFFER_SIZE #ifndef MBED_CFG_TCP_CLIENT_ECHO_BUFFER_SIZE
@ -28,14 +31,13 @@ void prep_buffer(char *tx_buffer, size_t tx_size) {
} }
} }
int main() { void test_tcp_echo() {
GREENTEA_SETUP(120, "tcp_echo");
EthernetInterface eth; EthernetInterface eth;
int err = eth.connect(); int err = eth.connect();
if (err) { if (err) {
printf("MBED: failed to connect with an error of %d\r\n", err); printf("MBED: failed to connect with an error of %d\r\n", err);
GREENTEA_TESTSUITE_RESULT(false); TEST_ASSERT_EQUAL(0, err);
} }
printf("MBED: TCPClient IP address is '%s'\n", eth.get_ip_address()); printf("MBED: TCPClient IP address is '%s'\n", eth.get_ip_address());
@ -80,5 +82,22 @@ int main() {
sock.close(); sock.close();
eth.disconnect(); eth.disconnect();
GREENTEA_TESTSUITE_RESULT(result); TEST_ASSERT_EQUAL(true, result);
}
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(120, "tcp_echo");
return verbose_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("TCP echo", test_tcp_echo),
};
Specification specification(test_setup, cases);
int main() {
return !Harness::run(specification);
} }

View File

@ -10,6 +10,9 @@
#include "TCPSocket.h" #include "TCPSocket.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h"
using namespace utest::v1;
#ifndef MBED_CFG_TCP_CLIENT_ECHO_BUFFER_SIZE #ifndef MBED_CFG_TCP_CLIENT_ECHO_BUFFER_SIZE
@ -84,11 +87,9 @@ public:
} }
}; };
int main() {
GREENTEA_SETUP(120, "tcp_echo");
void test_tcp_echo_parallel() {
Echo echoers[MBED_CFG_TCP_CLIENT_ECHO_THREADS]; Echo echoers[MBED_CFG_TCP_CLIENT_ECHO_THREADS];
int err = net.connect(); int err = net.connect();
TEST_ASSERT_EQUAL(0, err); TEST_ASSERT_EQUAL(0, err);
@ -123,5 +124,20 @@ int main() {
} }
net.disconnect(); net.disconnect();
GREENTEA_TESTSUITE_RESULT(true); }
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(120, "tcp_echo");
return verbose_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("TCP echo parallel", test_tcp_echo_parallel),
};
Specification specification(test_setup, cases);
int main() {
return !Harness::run(specification);
} }

View File

@ -11,6 +11,10 @@
#include "TCPSocket.h" #include "TCPSocket.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h"
using namespace utest::v1;
namespace { namespace {
// Test connection information // Test connection information
@ -35,9 +39,7 @@ bool find_substring(const char *first, const char *last, const char *s_first, co
return (f != last); return (f != last);
} }
int main() { void test_tcp_hello_world() {
GREENTEA_SETUP(120, "default_auto");
bool result = false; bool result = false;
EthernetInterface eth; EthernetInterface eth;
//eth.init(); //Use DHCP //eth.init(); //Use DHCP
@ -83,5 +85,22 @@ int main() {
} }
eth.disconnect(); eth.disconnect();
GREENTEA_TESTSUITE_RESULT(result); TEST_ASSERT_EQUAL(true, result);
}
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(120, "default_auto");
return verbose_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("TCP hello world", test_tcp_hello_world),
};
Specification specification(test_setup, cases);
int main() {
return !Harness::run(specification);
} }

View File

@ -13,6 +13,9 @@
#include "TCPSocket.h" #include "TCPSocket.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h"
using namespace utest::v1;
#ifndef MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MIN #ifndef MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MIN
@ -107,8 +110,7 @@ void generate_buffer(uint8_t **buffer, size_t *size, size_t min, size_t max) {
} }
int main() { void test_tcp_packet_pressure() {
GREENTEA_SETUP(120, "tcp_echo");
generate_buffer(&buffer, &buffer_size, generate_buffer(&buffer, &buffer_size,
MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MIN, MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MIN,
MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MAX); MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MAX);
@ -123,8 +125,6 @@ int main() {
greentea_send_kv("target_ip", eth.get_ip_address()); greentea_send_kv("target_ip", eth.get_ip_address());
bool result = true;
char recv_key[] = "host_port"; char recv_key[] = "host_port";
char ipbuf[60] = {0}; char ipbuf[60] = {0};
char portbuf[16] = {0}; char portbuf[16] = {0};
@ -223,5 +223,21 @@ int main() {
MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MIN) / (1000*timer.read())); MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MIN) / (1000*timer.read()));
eth.disconnect(); eth.disconnect();
GREENTEA_TESTSUITE_RESULT(result); }
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(120, "tcp_echo");
return verbose_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("TCP packet pressure", test_tcp_packet_pressure),
};
Specification specification(test_setup, cases);
int main() {
return !Harness::run(specification);
} }

View File

@ -13,6 +13,9 @@
#include "TCPSocket.h" #include "TCPSocket.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h"
using namespace utest::v1;
#ifndef MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MIN #ifndef MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MIN
@ -224,9 +227,7 @@ public:
PressureTest *pressure_tests[MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_THREADS]; PressureTest *pressure_tests[MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_THREADS];
int main() { void test_tcp_packet_pressure_parallel() {
GREENTEA_SETUP(120, "tcp_echo");
uint8_t *buffer; uint8_t *buffer;
size_t buffer_size; size_t buffer_size;
generate_buffer(&buffer, &buffer_size, generate_buffer(&buffer, &buffer_size,
@ -247,8 +248,6 @@ int main() {
greentea_send_kv("target_ip", net.get_ip_address()); greentea_send_kv("target_ip", net.get_ip_address());
bool result = true;
char recv_key[] = "host_port"; char recv_key[] = "host_port";
char ipbuf[60] = {0}; char ipbuf[60] = {0};
char portbuf[16] = {0}; char portbuf[16] = {0};
@ -286,5 +285,21 @@ int main() {
MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MIN) / (1000*timer.read())); MBED_CFG_TCP_CLIENT_PACKET_PRESSURE_MIN) / (1000*timer.read()));
net.disconnect(); net.disconnect();
GREENTEA_TESTSUITE_RESULT(result); }
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(120, "tcp_echo");
return verbose_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("TCP packet pressure parallel", test_tcp_packet_pressure_parallel),
};
Specification specification(test_setup, cases);
int main() {
return !Harness::run(specification);
} }

View File

@ -10,6 +10,10 @@
#include "UDPSocket.h" #include "UDPSocket.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h"
using namespace utest::v1;
#ifndef MBED_CFG_UDP_DTLS_HANDSHAKE_BUFFER_SIZE #ifndef MBED_CFG_UDP_DTLS_HANDSHAKE_BUFFER_SIZE
#define MBED_CFG_UDP_DTLS_HANDSHAKE_BUFFER_SIZE 512 #define MBED_CFG_UDP_DTLS_HANDSHAKE_BUFFER_SIZE 512
@ -31,9 +35,7 @@ uint8_t buffer[MBED_CFG_UDP_DTLS_HANDSHAKE_BUFFER_SIZE] = {0};
int udp_dtls_handshake_pattern[] = {MBED_CFG_UDP_DTLS_HANDSHAKE_PATTERN}; int udp_dtls_handshake_pattern[] = {MBED_CFG_UDP_DTLS_HANDSHAKE_PATTERN};
const int udp_dtls_handshake_count = sizeof(udp_dtls_handshake_pattern) / sizeof(int); const int udp_dtls_handshake_count = sizeof(udp_dtls_handshake_pattern) / sizeof(int);
int main() { void test_udp_dtls_handshake() {
GREENTEA_SETUP(120, "udp_shotgun");
EthernetInterface eth; EthernetInterface eth;
int err = eth.connect(); int err = eth.connect();
TEST_ASSERT_EQUAL(0, err); TEST_ASSERT_EQUAL(0, err);
@ -127,5 +129,22 @@ int main() {
} }
eth.disconnect(); eth.disconnect();
GREENTEA_TESTSUITE_RESULT(result); TEST_ASSERT_EQUAL(true, result);
}
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(120, "udp_shotgun");
return verbose_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("UDP DTLS handshake", test_udp_dtls_handshake),
};
Specification specification(test_setup, cases);
int main() {
return !Harness::run(specification);
} }

View File

@ -10,6 +10,10 @@
#include "UDPSocket.h" #include "UDPSocket.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h"
using namespace utest::v1;
#ifndef MBED_CFG_UDP_CLIENT_ECHO_BUFFER_SIZE #ifndef MBED_CFG_UDP_CLIENT_ECHO_BUFFER_SIZE
#define MBED_CFG_UDP_CLIENT_ECHO_BUFFER_SIZE 64 #define MBED_CFG_UDP_CLIENT_ECHO_BUFFER_SIZE 64
@ -25,14 +29,14 @@ namespace {
char rx_buffer[MBED_CFG_UDP_CLIENT_ECHO_BUFFER_SIZE] = {0}; char rx_buffer[MBED_CFG_UDP_CLIENT_ECHO_BUFFER_SIZE] = {0};
const char ASCII_MAX = '~' - ' '; const char ASCII_MAX = '~' - ' ';
const int ECHO_LOOPS = 16; const int ECHO_LOOPS = 16;
char uuid[48] = {0};
} }
void prep_buffer(char *uuid_buffer, size_t uuid_len, char *tx_buffer, size_t tx_size) { void prep_buffer(char *uuid, char *tx_buffer, size_t tx_size) {
size_t i = 0; size_t i = 0;
for (; i<uuid_len; ++i) { memcpy(tx_buffer, uuid, strlen(uuid));
tx_buffer[i] = uuid_buffer[i]; i += strlen(uuid);
}
tx_buffer[i++] = ' '; tx_buffer[i++] = ' ';
@ -41,11 +45,7 @@ void prep_buffer(char *uuid_buffer, size_t uuid_len, char *tx_buffer, size_t tx_
} }
} }
int main() { void test_udp_echo() {
char uuid[48] = {0};
GREENTEA_SETUP_UUID(120, "udp_echo", uuid, 48);
printf("Got a uuid of %s\r\n", uuid);
size_t uuid_len = strlen(uuid);
EthernetInterface eth; EthernetInterface eth;
int err = eth.connect(); int err = eth.connect();
@ -53,8 +53,7 @@ int main() {
if (err) { if (err) {
printf("MBED: failed to connect with an error of %d\r\n", err); printf("MBED: failed to connect with an error of %d\r\n", err);
GREENTEA_TESTSUITE_RESULT(false); TEST_ASSERT_EQUAL(0, err);
return 0;
} }
printf("UDP client IP Address is %s\n", eth.get_ip_address()); printf("UDP client IP Address is %s\n", eth.get_ip_address());
@ -81,8 +80,8 @@ int main() {
SocketAddress udp_addr(ipbuf, port); SocketAddress udp_addr(ipbuf, port);
int success = 0; int success = 0;
prep_buffer(uuid, uuid_len, tx_buffer, sizeof(tx_buffer));
for (int i = 0; success < ECHO_LOOPS; i++) { for (int i = 0; success < ECHO_LOOPS; i++) {
prep_buffer(uuid, tx_buffer, sizeof(tx_buffer));
const int ret = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer)); const int ret = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
if (ret >= 0) { if (ret >= 0) {
printf("[%02d] sent %d bytes - %.*s \n", i, ret, ret, tx_buffer); printf("[%02d] sent %d bytes - %.*s \n", i, ret, ret, tx_buffer);
@ -120,9 +119,24 @@ int main() {
sock.set_timeout(MBED_CFG_UDP_CLIENT_ECHO_TIMEOUT); sock.set_timeout(MBED_CFG_UDP_CLIENT_ECHO_TIMEOUT);
} }
bool result = success == ECHO_LOOPS;
sock.close(); sock.close();
eth.disconnect(); eth.disconnect();
GREENTEA_TESTSUITE_RESULT(result); TEST_ASSERT_EQUAL(ECHO_LOOPS, success);
}
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP_UUID(120, "udp_echo", uuid, 48);
return verbose_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("UDP echo", test_udp_echo),
};
Specification specification(test_setup, cases);
int main() {
return !Harness::run(specification);
} }

View File

@ -10,6 +10,10 @@
#include "UDPSocket.h" #include "UDPSocket.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h"
using namespace utest::v1;
#ifndef MBED_CFG_UDP_CLIENT_ECHO_BUFFER_SIZE #ifndef MBED_CFG_UDP_CLIENT_ECHO_BUFFER_SIZE
#define MBED_CFG_UDP_CLIENT_ECHO_BUFFER_SIZE 64 #define MBED_CFG_UDP_CLIENT_ECHO_BUFFER_SIZE 64
@ -28,17 +32,17 @@ const int ECHO_LOOPS = 16;
EthernetInterface net; EthernetInterface net;
SocketAddress udp_addr; SocketAddress udp_addr;
Mutex iomutex; Mutex iomutex;
char uuid[48] = {0};
// NOTE: assuming that "id" stays in the single digits // NOTE: assuming that "id" stays in the single digits
void prep_buffer(int id, char *uuid_buffer, size_t uuid_len, char *tx_buffer, size_t tx_size) { void prep_buffer(int id, char *uuid, char *tx_buffer, size_t tx_size) {
size_t i = 2; size_t i = 0;
tx_buffer[0] = '0' + id; tx_buffer[i++] = '0' + id;
tx_buffer[1] = ' '; tx_buffer[i++] = ' ';
for (; i<uuid_len + 2; ++i) { memcpy(tx_buffer+i, uuid, strlen(uuid));
tx_buffer[i] = uuid_buffer[i - 2]; i += strlen(uuid);
}
tx_buffer[i++] = ' '; tx_buffer[i++] = ' ';
@ -58,18 +62,16 @@ private:
Thread thread; Thread thread;
bool result; bool result;
int id; int id;
char *uuid_buffer; char *uuid;
size_t uuid_len;
public: public:
// Limiting stack size to 1k // Limiting stack size to 1k
Echo(): thread(osPriorityNormal, 1024), result(false) { Echo(): thread(osPriorityNormal, 1024), result(false) {
} }
void start(int id, char *uuid_buffer, size_t uuid_len) { void start(int id, char *uuid) {
this->id = id; this->id = id;
this->uuid_buffer = uuid_buffer; this->uuid = uuid;
this->uuid_len = uuid_len;
osStatus status = thread.start(callback(this, &Echo::echo)); osStatus status = thread.start(callback(this, &Echo::echo));
} }
@ -86,8 +88,8 @@ public:
sock.set_timeout(MBED_CFG_UDP_CLIENT_ECHO_TIMEOUT); sock.set_timeout(MBED_CFG_UDP_CLIENT_ECHO_TIMEOUT);
prep_buffer(id, uuid_buffer, uuid_len, tx_buffer, sizeof(tx_buffer));
for (int i = 0; success < ECHO_LOOPS; i++) { for (int i = 0; success < ECHO_LOOPS; i++) {
prep_buffer(id, uuid, tx_buffer, sizeof(tx_buffer));
const int ret = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer)); const int ret = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
if (ret >= 0) { if (ret >= 0) {
iomutex.lock(); iomutex.lock();
@ -148,14 +150,9 @@ public:
} }
}; };
int main() {
char uuid[48] = {0};
GREENTEA_SETUP_UUID(120, "udp_echo", uuid, 48);
printf("Got a uuid of %s\r\n", uuid);
size_t uuid_len = strlen(uuid);
void test_udp_echo_parallel() {
Echo echoers[MBED_CFG_UDP_CLIENT_ECHO_THREADS]; Echo echoers[MBED_CFG_UDP_CLIENT_ECHO_THREADS];
int err = net.connect(); int err = net.connect();
TEST_ASSERT_EQUAL(0, err); TEST_ASSERT_EQUAL(0, err);
@ -185,7 +182,7 @@ int main() {
// Startup echo threads in parallel // Startup echo threads in parallel
for (int i = 0; i < MBED_CFG_UDP_CLIENT_ECHO_THREADS; i++) { for (int i = 0; i < MBED_CFG_UDP_CLIENT_ECHO_THREADS; i++) {
echoers[i].start(i, uuid, uuid_len); echoers[i].start(i, uuid);
} }
bool result = true; bool result = true;
@ -196,6 +193,23 @@ int main() {
} }
net.disconnect(); net.disconnect();
GREENTEA_TESTSUITE_RESULT(result); TEST_ASSERT_EQUAL(true, result);
} }
} }
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP_UUID(120, "udp_echo", uuid, 48);
return verbose_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("UDP echo parallel", test_udp_echo_parallel),
};
Specification specification(test_setup, cases);
int main() {
return !Harness::run(specification);
}

View File

@ -13,6 +13,9 @@
#include "UDPSocket.h" #include "UDPSocket.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h"
using namespace utest::v1;
#ifndef MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MIN #ifndef MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MIN
@ -110,8 +113,7 @@ void generate_buffer(uint8_t **buffer, size_t *size, size_t min, size_t max) {
TEST_ASSERT(buffer); TEST_ASSERT(buffer);
} }
int main() { void test_udp_packet_pressure() {
GREENTEA_SETUP(120, "udp_echo");
generate_buffer(&buffer, &buffer_size, generate_buffer(&buffer, &buffer_size,
MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MIN, MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MIN,
MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MAX); MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MAX);
@ -126,8 +128,6 @@ int main() {
greentea_send_kv("target_ip", eth.get_ip_address()); greentea_send_kv("target_ip", eth.get_ip_address());
bool result = true;
char recv_key[] = "host_port"; char recv_key[] = "host_port";
char ipbuf[60] = {0}; char ipbuf[60] = {0};
char portbuf[16] = {0}; char portbuf[16] = {0};
@ -246,5 +246,21 @@ int main() {
MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MIN) / (1000*timer.read())); MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MIN) / (1000*timer.read()));
eth.disconnect(); eth.disconnect();
GREENTEA_TESTSUITE_RESULT(result); }
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(120, "udp_echo");
return verbose_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("UDP packet pressure", test_udp_packet_pressure),
};
Specification specification(test_setup, cases);
int main() {
return !Harness::run(specification);
} }

View File

@ -13,6 +13,9 @@
#include "UDPSocket.h" #include "UDPSocket.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "unity/unity.h" #include "unity/unity.h"
#include "utest.h"
using namespace utest::v1;
#ifndef MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MIN #ifndef MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MIN
@ -249,9 +252,7 @@ public:
PressureTest *pressure_tests[MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_THREADS]; PressureTest *pressure_tests[MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_THREADS];
int main() { void test_udp_packet_pressure_parallel() {
GREENTEA_SETUP(120, "udp_echo");
uint8_t *buffer; uint8_t *buffer;
size_t buffer_size; size_t buffer_size;
generate_buffer(&buffer, &buffer_size, generate_buffer(&buffer, &buffer_size,
@ -272,8 +273,6 @@ int main() {
greentea_send_kv("target_ip", net.get_ip_address()); greentea_send_kv("target_ip", net.get_ip_address());
bool result = true;
char recv_key[] = "host_port"; char recv_key[] = "host_port";
char ipbuf[60] = {0}; char ipbuf[60] = {0};
char portbuf[16] = {0}; char portbuf[16] = {0};
@ -311,5 +310,21 @@ int main() {
MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MIN) / (1000*timer.read())); MBED_CFG_UDP_CLIENT_PACKET_PRESSURE_MIN) / (1000*timer.read()));
net.disconnect(); net.disconnect();
GREENTEA_TESTSUITE_RESULT(result); }
// Test setup
utest::v1::status_t test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(120, "udp_echo");
return verbose_test_setup_handler(number_of_cases);
}
Case cases[] = {
Case("UDP packet pressure parallel", test_udp_packet_pressure_parallel),
};
Specification specification(test_setup, cases);
int main() {
return !Harness::run(specification);
} }