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;
@ -25,7 +24,7 @@ int main() {
EthernetInterface eth;
eth.init(); //Use DHCP
eth.connect();
printf("TCPClient 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);

View File

@ -32,34 +32,34 @@ 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);
Endpoint echo_server;
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,15 +30,14 @@ class StdioTest(DefaultTest):
print "\n{%s}\n{end}" % result
def run(self):
test_result = True
for i in range(1, 5):
random_integer = random.randint(-10000, 10000)
print "Generated number: " + str(random_integer)
self.mbed.serial.write(str(random_integer) + "\n")
serial_stdio_msg = ""
ip_msg_timeout = self.mbed.options.timeout
start_serial_pool = time();
while (time() - start_serial_pool) < ip_msg_timeout:

View File

@ -29,33 +29,33 @@ Wiring:
* Ground:
* LPC1*: p1
* KL25Z: GND
* Vout
* LPC1*: p40
* KL25Z: P3V3
* TMP102 (I2C):
* LPC1*: (SDA=p28 , SCL=p27)
* KL25Z: (SDA=PTC9, SCL=PTC8)
* digital_loop (Digital(In|Out|InOut), InterruptIn):
* LPC1*: (p5 <-> p25 )
* KL25Z: (PTA5<-> PTC6)
* NUCLEO_F103RB: (PC_6 <-> PB_8)
* port_loop (Port(In|Out|InOut)):
* LPC1*: (p5 <-> p25 ), (p6 <-> p26 )
* KL25Z: (PTA5 <-> PTC6), (PTA4 <-> PTC5)
* NUCLEO_F103RB: (PC_6 <-> PB_8), (PC_5 <-> PB_9)
* analog_loop (AnalogIn, AnalogOut):
* LPC1*: (p17 <-> p18 )
* KL25Z: (PTE30 <-> PTC2)
* SD (SPI):
* LPC1*: (mosi=p11 , miso=p12 , sclk=p13 , cs=p14 )
* KL25Z: (mosi=PTD2, miso=PTD3, sclk=PTD1, cs=PTD0)
* MMA7660 (I2C):
* LPC1*: (SDA=p28 , SCL=p27)
@ -255,7 +255,7 @@ TESTS = [
"source_dir": join(BENCHMARKS_DIR, "all"),
"dependencies": [MBED_LIBRARIES]
},
# Not automated MBED tests
{
"id": "MBED_1", "description": "I2C SRF08",
@ -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",
@ -427,7 +429,7 @@ TESTS = [
"source_dir": join(TEST_DIR, "mbed", "pin_toggling"),
"dependencies": [MBED_LIBRARIES],
},
# CMSIS RTOS tests
{
"id": "CMSIS_RTOS_1", "description": "Basic",
@ -473,7 +475,7 @@ TESTS = [
"source_dir": join(TEST_DIR, "rtos", "cmsis", "isr"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],
},
# mbed RTOS tests
{
"id": "RTOS_1", "description": "Basic",
@ -521,7 +523,7 @@ TESTS = [
"source_dir": join(TEST_DIR, "rtos", "mbed", "file"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB, SD_FS, FAT_FS],
},
# Networking Tests
{
"id": "NET_1", "description": "TCP client hello world",
@ -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",
@ -588,7 +602,7 @@ TESTS = [
"source_dir": join(TEST_DIR, "net", "echo", "tcp_client_loop"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
},
# u-blox tests
{
"id": "UB_1", "description": "u-blox USB modem: HTTP client",
@ -640,21 +654,21 @@ TESTS = [
"source_dir": join(TEST_DIR, "usb", "device", "audio"),
"dependencies": [MBED_LIBRARIES, USB_LIBRARIES],
},
# CMSIS DSP
{
"id": "CMSIS_DSP_1", "description": "FIR",
"source_dir": join(TEST_DIR, "dsp", "cmsis", "fir_f32"),
"dependencies": [MBED_LIBRARIES, DSP_LIBRARIES],
},
# mbed DSP
{
"id": "DSP_1", "description": "FIR",
"source_dir": join(TEST_DIR, "dsp", "mbed", "fir_f32"),
"dependencies": [MBED_LIBRARIES, DSP_LIBRARIES],
},
# KL25Z
{
"id": "KL25Z_1", "description": "LPTMR",
@ -688,7 +702,7 @@ TESTS = [
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, join(PERIPHERALS, 'MMA8451Q')],
"mcu": ["KL25Z", "KL05Z", "KL46Z"],
},
# Examples
{
"id": "EXAMPLE_1", "description": "/dev/null",
@ -739,23 +753,23 @@ class Test:
self.n = n
self.__dict__.update(Test.DEFAULTS)
self.__dict__.update(TESTS[n])
def is_supported(self, target, toolchain):
if hasattr(self, 'mcu') and not target in self.mcu:
return False
if not hasattr(self, 'supported'):
return True
return (target in self.supported) and (toolchain in self.supported[target])
def get_description(self):
if hasattr(self, 'description'):
return self.description
else:
return self.id
def __cmp__(self, other):
return cmp(self.n, other.n)
def __str__(self):
return "[%3d] %s: %s" % (self.n, self.id, self.get_description())