mirror of https://github.com/ARMmbed/mbed-os.git
Merge branch 'master' of https://github.com/mbedmicro/mbed
commit
ead2bc63cb
|
@ -1,9 +1,10 @@
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
|
#include "test_env.h"
|
||||||
|
|
||||||
class DevNull : public Stream {
|
class DevNull : public Stream {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DevNull(const char *name=NULL) : Stream(name) {}
|
DevNull(const char *name = NULL) : Stream(name) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int _getc() {return 0;}
|
virtual int _getc() {return 0;}
|
||||||
|
@ -13,14 +14,10 @@ protected:
|
||||||
DevNull null("null");
|
DevNull null("null");
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("re-routing stdout to /null\n");
|
printf("MBED: re-routing stdout to /null\n");
|
||||||
|
|
||||||
freopen("/null", "w", stdout);
|
freopen("/null", "w", stdout);
|
||||||
printf("printf redirected to /null\n");
|
printf("MBED: printf redirected to /null\n"); // This shouldn't appear
|
||||||
|
// If failure message can be seen test should fail :)
|
||||||
DigitalOut led(LED1);
|
notify_completion(false); // This is 'false' on purpose
|
||||||
while (true) {
|
return 0;
|
||||||
led = !led;
|
|
||||||
wait(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
#include <utility> // std::pair
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
|
#include "test_env.h"
|
||||||
|
|
||||||
uint32_t test_64(uint64_t ticks) {
|
uint32_t test_64(uint64_t ticks) {
|
||||||
ticks >>= 3; // divide by 8
|
ticks >>= 3; // divide by 8
|
||||||
|
@ -10,18 +12,30 @@ uint32_t test_64(uint64_t ticks) {
|
||||||
return (uint32_t)(0xFFFFFFFF & ticks);
|
return (uint32_t)(0xFFFFFFFF & ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
const char *result_str(bool result) {
|
||||||
// 0xFFFFFFFF * 8 = 0x7fffffff8
|
return result ? "[OK]" : "[FAIL]";
|
||||||
printf("expected : 55555555\n");
|
}
|
||||||
printf("64: 0x7fffffff8: %x\n", test_64(0x7fffffff8));
|
|
||||||
|
int main() {
|
||||||
// 0xFFFFFFFF * 24 = 0x17ffffffe8
|
DigitalOut led(LED1);
|
||||||
printf("expected : ffffffff\n");
|
bool result = true;
|
||||||
printf("64: 0x17ffffffe8: %x\n", test_64(0x17FFFFFFE8));
|
|
||||||
|
{ // 0xFFFFFFFF * 8 = 0x7fffffff8
|
||||||
DigitalOut led(LED1);
|
std::pair<uint32_t, uint64_t> values = std::make_pair(0x55555555, 0x7FFFFFFF8);
|
||||||
while (1) {
|
uint32_t test_ret = test_64(values.second);
|
||||||
led = !led;
|
bool test_res = values.first == test_ret;
|
||||||
wait(0.5);
|
result = result && test_res;
|
||||||
}
|
printf("64bit: 0x7FFFFFFF8: expected 0x%X got 0x%X ... %s\r\n", values.first, test_ret, result_str(test_res));
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // 0xFFFFFFFF * 24 = 0x17ffffffe8
|
||||||
|
std::pair<uint32_t, uint64_t> values = std::make_pair(0xFFFFFFFF, 0x17FFFFFFE8);
|
||||||
|
uint32_t test_ret = test_64(values.second);
|
||||||
|
bool test_res = values.first == test_ret;
|
||||||
|
result = result && test_res;
|
||||||
|
printf("64bit: 0x17FFFFFFE8: expected 0x%X got 0x%X ... %s\r\n", values.first, test_ret, result_str(test_res));
|
||||||
|
}
|
||||||
|
|
||||||
|
notify_completion(result);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ DigitalOut myled(LED1);
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("Hello World\n");
|
printf("Hello World\n");
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
wait(0.5);
|
wait(0.5);
|
||||||
myled = !myled;
|
myled = !myled;
|
||||||
|
|
|
@ -1,17 +1,31 @@
|
||||||
#include "test_env.h"
|
#include "test_env.h"
|
||||||
|
|
||||||
|
#define MAC_VENDOR_ARM_0 0x00
|
||||||
|
#define MAC_VENDOR_ARM_1 0x02
|
||||||
|
#define MAC_VENDOR_ARM_2 0xF7
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char uid[DEVICE_ID_LENGTH + 1];
|
char uid[DEVICE_ID_LENGTH + 1] = {0};
|
||||||
|
bool result = true;
|
||||||
if (mbed_interface_uid(uid) == 0) {
|
|
||||||
printf("UID: %s\n", uid);
|
const int ret = mbed_interface_uid(uid);
|
||||||
} else{
|
if (ret == 0) {
|
||||||
printf("Error\n");
|
printf("UID: %s\r\n", uid);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
char mac[16];
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char mac[6] = {0}; // @param mac A 6-byte array to write the MAC address
|
||||||
mbed_mac_address(mac);
|
mbed_mac_address(mac);
|
||||||
printf("mac address: %02x,%02x,%02x,%02x,%02x,%02x\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
printf("MAC Address: %02X:%02X:%02X:%02X:%02X:%02X\r\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
|
|
||||||
notify_completion(true);
|
if (mac[0] == MAC_VENDOR_ARM_0 &&
|
||||||
|
mac[1] == MAC_VENDOR_ARM_1 &&
|
||||||
|
mac[2] == MAC_VENDOR_ARM_2) {
|
||||||
|
printf("MAC Address Prefix: 00:02:F7, Vendor: ARM\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
notify_completion(result);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,61 @@
|
||||||
|
#include <algorithm>
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
#include "EthernetInterface.h"
|
#include "EthernetInterface.h"
|
||||||
|
#include "test_env.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const char *HTTP_SERVER_NAME = "mbed.org";
|
||||||
|
const int HTTP_SERVER_PORT = 80;
|
||||||
|
const int RECV_BUFFER_SIZE = 512;
|
||||||
|
|
||||||
|
// Test related data
|
||||||
|
const char *HTTP_OK_STR = "200 OK";
|
||||||
|
const char *HTTP_HELLO_STR = "Hello world!";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool find_substring(const char *first, const char *last, const char *s_first, const char *s_last) {
|
||||||
|
const char *f = std::search(first, last, s_first, s_last);
|
||||||
|
return (f != last);
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
EthernetInterface eth;
|
EthernetInterface eth;
|
||||||
eth.init(); //Use DHCP
|
eth.init(); //Use DHCP
|
||||||
eth.connect();
|
eth.connect();
|
||||||
printf("IP Address is %s\n", eth.getIPAddress());
|
printf("TCP client IP Address is %s\n", eth.getIPAddress());
|
||||||
|
|
||||||
TCPSocketConnection sock;
|
TCPSocketConnection sock;
|
||||||
sock.connect("mbed.org", 80);
|
sock.connect(HTTP_SERVER_NAME, HTTP_SERVER_PORT);
|
||||||
|
|
||||||
char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n";
|
char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\n\n";
|
||||||
sock.send_all(http_cmd, sizeof(http_cmd));
|
sock.send_all(http_cmd, sizeof(http_cmd));
|
||||||
|
|
||||||
char buffer[300];
|
char buffer[RECV_BUFFER_SIZE] = {0};
|
||||||
int ret;
|
bool result = true;
|
||||||
while (true) {
|
while (true) {
|
||||||
ret = sock.receive(buffer, sizeof(buffer)-1);
|
const int ret = sock.receive(buffer, sizeof(buffer) - 1);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
break;
|
break;
|
||||||
buffer[ret] = '\0';
|
buffer[ret] = '\0';
|
||||||
printf("Received %d chars from server:\n%s\n", ret, buffer);
|
|
||||||
|
// Find 200 OK HTTP status in reply
|
||||||
|
bool found_200_ok = find_substring(buffer, buffer + ret, HTTP_OK_STR, HTTP_OK_STR + strlen(HTTP_OK_STR));
|
||||||
|
result = result && found_200_ok;
|
||||||
|
|
||||||
|
// Find Hello World! in reply
|
||||||
|
bool found_hello = find_substring(buffer, buffer + ret, HTTP_HELLO_STR, HTTP_HELLO_STR + strlen(HTTP_HELLO_STR));
|
||||||
|
result = result && found_hello;
|
||||||
|
|
||||||
|
// Print results
|
||||||
|
printf("HTTP: Received %d chars from server\r\n", ret);
|
||||||
|
printf("HTTP: Received 200 OK status ... %s\r\n", found_200_ok ? "[OK]" : "[FAIL]");
|
||||||
|
printf("HTTP: Received '%s' status ... %s\r\n", HTTP_HELLO_STR, found_hello ? "[OK]" : "[FAIL]");
|
||||||
|
printf("HTTP: Received massage:\r\n\r\n");
|
||||||
|
printf("%s", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
sock.close();
|
sock.close();
|
||||||
|
|
||||||
eth.disconnect();
|
eth.disconnect();
|
||||||
|
notify_completion(result);
|
||||||
while(1) {}
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,48 @@
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
#include "EthernetInterface.h"
|
#include "EthernetInterface.h"
|
||||||
|
#include "test_env.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const char *HTTP_SERVER_NAME = "utcnist.colorado.edu";
|
||||||
|
const int HTTP_SERVER_PORT = 37;
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
bool result = false;
|
||||||
EthernetInterface eth;
|
EthernetInterface eth;
|
||||||
eth.init(); //Use DHCP
|
eth.init(); //Use DHCP
|
||||||
eth.connect();
|
eth.connect();
|
||||||
|
printf("UDP client IP Address is %s\n", eth.getIPAddress());
|
||||||
|
|
||||||
UDPSocket sock;
|
UDPSocket sock;
|
||||||
sock.init();
|
sock.init();
|
||||||
|
|
||||||
Endpoint nist;
|
Endpoint nist;
|
||||||
nist.set_address("utcnist.colorado.edu", 37);
|
nist.set_address(HTTP_SERVER_NAME, HTTP_SERVER_PORT);
|
||||||
|
|
||||||
char out_buffer[] = "plop"; // Does not matter
|
char out_buffer[] = "plop"; // Does not matter
|
||||||
sock.sendTo(nist, out_buffer, sizeof(out_buffer));
|
sock.sendTo(nist, out_buffer, sizeof(out_buffer));
|
||||||
|
|
||||||
char in_buffer[4];
|
union {
|
||||||
int n = sock.receiveFrom(nist, in_buffer, sizeof(in_buffer));
|
char in_buffer_tab[4];
|
||||||
|
unsigned int in_buffer_uint;
|
||||||
unsigned int timeRes = ntohl( *((unsigned int*)in_buffer));
|
};
|
||||||
printf("Received %d bytes from server %s on port %d: %u seconds since 1/01/1900 00:00 GMT\n", n, nist.get_address(), nist.get_port(), timeRes);
|
|
||||||
|
const int n = sock.receiveFrom(nist, in_buffer_tab, sizeof(in_buffer_tab));
|
||||||
|
if (n > 0) {
|
||||||
|
const unsigned int timeRes = ntohl(in_buffer_uint);
|
||||||
|
const float years = timeRes / 60.0 / 60.0 / 24.0 / 365;
|
||||||
|
printf("UDP: Received %d bytes from server %s on port %d\r\n", n, nist.get_address(), nist.get_port());
|
||||||
|
printf("UDP: %u seconds since 01/01/1900 00:00 GMT ... %s\r\n", timeRes, timeRes > 0 ? "[OK]" : "[FAIL]");
|
||||||
|
printf("UDP: %.2f years since 01/01/1900 00:00 GMT ... %s\r\n", years, timeRes > 114.0 ? "[OK]" : "[FAIL]");
|
||||||
|
result = true;
|
||||||
|
|
||||||
|
if (years < 114.0) {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
sock.close();
|
sock.close();
|
||||||
|
|
||||||
eth.disconnect();
|
eth.disconnect();
|
||||||
while(1) {}
|
notify_completion(result);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
"""
|
||||||
|
mbed SDK
|
||||||
|
Copyright (c) 2011-2013 ARM Limited
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from host_test import Test, DefaultTest
|
||||||
|
from sys import stdout
|
||||||
|
|
||||||
|
class DevNullTest(DefaultTest):
|
||||||
|
|
||||||
|
def print_result(self, result):
|
||||||
|
print "\n{%s}\n{end}" % result
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
test_result = True
|
||||||
|
c = self.mbed.serial.read(512)
|
||||||
|
print "Received %d bytes" % len(c)
|
||||||
|
if "{failure}" not in c:
|
||||||
|
self.print_result('success')
|
||||||
|
else:
|
||||||
|
self.print_result('failure')
|
||||||
|
stdout.flush()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
DevNullTest().run()
|
|
@ -0,0 +1,37 @@
|
||||||
|
"""
|
||||||
|
mbed SDK
|
||||||
|
Copyright (c) 2011-2013 ARM Limited
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from host_test import Test, DefaultTest
|
||||||
|
from sys import stdout
|
||||||
|
|
||||||
|
class HelloTest(DefaultTest):
|
||||||
|
HELLO_WORLD = "Hello World\n"
|
||||||
|
|
||||||
|
def print_result(self, result):
|
||||||
|
print "\n{%s}\n{end}" % result
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
c = self.mbed.serial.read(len(self.HELLO_WORLD))
|
||||||
|
stdout.write(c)
|
||||||
|
if c == self.HELLO_WORLD: # Hello World received
|
||||||
|
self.print_result('success')
|
||||||
|
else:
|
||||||
|
self.print_result('failure')
|
||||||
|
stdout.flush()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
HelloTest().run()
|
|
@ -93,6 +93,7 @@ from workspace_tools.paths import BUILD_DIR
|
||||||
from workspace_tools.paths import HOST_TESTS
|
from workspace_tools.paths import HOST_TESTS
|
||||||
from workspace_tools.targets import TARGET_MAP
|
from workspace_tools.targets import TARGET_MAP
|
||||||
from workspace_tools.tests import TEST_MAP
|
from workspace_tools.tests import TEST_MAP
|
||||||
|
from workspace_tools.tests import TESTS
|
||||||
|
|
||||||
# Be sure that the tools directory is in the search path
|
# Be sure that the tools directory is in the search path
|
||||||
ROOT = abspath(join(dirname(__file__), ".."))
|
ROOT = abspath(join(dirname(__file__), ".."))
|
||||||
|
@ -306,9 +307,9 @@ def reset(mcu_name, serial, verbose=False, sleep_before_reset=0, sleep_after_res
|
||||||
sleep(sleep_before_reset)
|
sleep(sleep_before_reset)
|
||||||
if verbose:
|
if verbose:
|
||||||
verbose_msg = "Reset::cmd(sendBreak)"
|
verbose_msg = "Reset::cmd(sendBreak)"
|
||||||
|
|
||||||
serial.sendBreak()
|
serial.sendBreak()
|
||||||
|
|
||||||
if sleep_before_reset > 0:
|
if sleep_before_reset > 0:
|
||||||
sleep(sleep_after_reset)
|
sleep(sleep_after_reset)
|
||||||
if verbose:
|
if verbose:
|
||||||
|
@ -377,6 +378,73 @@ def get_json_data_from_file(json_spec_filename, verbose=False):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def get_result_summary_table():
|
||||||
|
# get all unique test ID prefixes
|
||||||
|
unique_test_id = []
|
||||||
|
for test in TESTS:
|
||||||
|
split = test['id'].split('_')[:-1]
|
||||||
|
test_id_prefix = '_'.join(split)
|
||||||
|
if test_id_prefix not in unique_test_id:
|
||||||
|
unique_test_id.append(test_id_prefix)
|
||||||
|
unique_test_id.sort()
|
||||||
|
counter_dict_test_id_types = dict((t, 0) for t in unique_test_id)
|
||||||
|
counter_dict_test_id_types_all = dict((t, 0) for t in unique_test_id)
|
||||||
|
|
||||||
|
test_properties = ['id', 'automated', 'description', 'peripherals', 'host_test', 'duration']
|
||||||
|
pt = PrettyTable(test_properties)
|
||||||
|
for col in test_properties:
|
||||||
|
pt.align[col] = "l" # Left align
|
||||||
|
|
||||||
|
counter_all = 0
|
||||||
|
counter_automated = 0
|
||||||
|
|
||||||
|
pt.padding_width = 1 # One space between column edges and contents (default)
|
||||||
|
for test in TESTS:
|
||||||
|
row = []
|
||||||
|
split = test['id'].split('_')[:-1]
|
||||||
|
test_id_prefix = '_'.join(split)
|
||||||
|
|
||||||
|
for col in test_properties:
|
||||||
|
row.append(test[col] if col in test else "")
|
||||||
|
if 'automated' in test and test['automated'] == True:
|
||||||
|
counter_dict_test_id_types[test_id_prefix] += 1
|
||||||
|
counter_automated += 1
|
||||||
|
pt.add_row(row)
|
||||||
|
# Update counters
|
||||||
|
counter_all += 1
|
||||||
|
counter_dict_test_id_types_all[test_id_prefix] += 1
|
||||||
|
print pt
|
||||||
|
print "Result:"
|
||||||
|
percent_progress = round(100.0 * counter_automated / float(counter_all), 2)
|
||||||
|
print "\tAutomated: %d / %d (%s %%)" % (counter_automated, counter_all, percent_progress)
|
||||||
|
print
|
||||||
|
test_id_cols = ['id', 'automated', 'all', 'percent [%]', 'progress']
|
||||||
|
pt = PrettyTable(test_id_cols)
|
||||||
|
pt.align['id'] = "l" # Left align
|
||||||
|
for unique_id in unique_test_id:
|
||||||
|
# print "\t\t%s: %d / %d" % (unique_id, counter_dict_test_id_types[unique_id], counter_dict_test_id_types_all[unique_id])
|
||||||
|
percent_progress = round(100.0 * counter_dict_test_id_types[unique_id] / float(counter_dict_test_id_types_all[unique_id]), 2)
|
||||||
|
str_progress = progress_bar(percent_progress, 75)
|
||||||
|
row = [unique_id,
|
||||||
|
counter_dict_test_id_types[unique_id],
|
||||||
|
counter_dict_test_id_types_all[unique_id],
|
||||||
|
percent_progress,
|
||||||
|
"[" + str_progress + "]"]
|
||||||
|
pt.add_row(row)
|
||||||
|
print pt
|
||||||
|
|
||||||
|
|
||||||
|
def progress_bar(percent_progress, saturation=0):
|
||||||
|
""" This function creates progress bar with optional simple saturation mark"""
|
||||||
|
step = int(percent_progress / 2) # Scale by to (scale: 1 - 50)
|
||||||
|
str_progress = '#' * step + '.' * int(50 - step)
|
||||||
|
c = '!' if str_progress[38] == '.' else '|'
|
||||||
|
if (saturation > 0):
|
||||||
|
saturation = saturation / 2
|
||||||
|
str_progress = str_progress[:saturation] + c + str_progress[saturation:]
|
||||||
|
return str_progress
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Command line options
|
# Command line options
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
|
@ -408,6 +476,18 @@ if __name__ == '__main__':
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help='Suppresses display of wellformatted table with test results')
|
help='Suppresses display of wellformatted table with test results')
|
||||||
|
|
||||||
|
parser.add_option('-r', '--test-automation-report',
|
||||||
|
dest='test_automation_report',
|
||||||
|
default=False,
|
||||||
|
action="store_true",
|
||||||
|
help='Prints information about all tests and exits')
|
||||||
|
|
||||||
|
parser.add_option('-P', '--only-peripheral',
|
||||||
|
dest='test_only_peripheral',
|
||||||
|
default=False,
|
||||||
|
action="store_true",
|
||||||
|
help='Test only peripheral declared for MUT and skip common tests')
|
||||||
|
|
||||||
parser.add_option('-v', '--verbose',
|
parser.add_option('-v', '--verbose',
|
||||||
dest='verbose',
|
dest='verbose',
|
||||||
default=False,
|
default=False,
|
||||||
|
@ -415,10 +495,15 @@ if __name__ == '__main__':
|
||||||
help='Verbose mode (pronts some extra information)')
|
help='Verbose mode (pronts some extra information)')
|
||||||
|
|
||||||
parser.description = """This script allows you to run mbed defined test cases for particular MCU(s) and corresponding toolchain(s)."""
|
parser.description = """This script allows you to run mbed defined test cases for particular MCU(s) and corresponding toolchain(s)."""
|
||||||
parser.epilog = """Example: singletest.py -i test_spec.json [-M muts_all.json]"""
|
parser.epilog = """Example: singletest.py -i test_spec.json -M muts_all.json"""
|
||||||
|
|
||||||
(opts, args) = parser.parse_args()
|
(opts, args) = parser.parse_args()
|
||||||
|
|
||||||
|
# Print summary / information about automation test status
|
||||||
|
if opts.test_automation_report:
|
||||||
|
get_result_summary_table()
|
||||||
|
exit(0)
|
||||||
|
|
||||||
# Open file with test specification
|
# Open file with test specification
|
||||||
# test_spec_filename tells script which targets and their toolchain(s)
|
# test_spec_filename tells script which targets and their toolchain(s)
|
||||||
# should be covered by the test scenario
|
# should be covered by the test scenario
|
||||||
|
@ -458,6 +543,11 @@ if __name__ == '__main__':
|
||||||
if test_ids and test_id not in test_ids:
|
if test_ids and test_id not in test_ids:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if opts.test_only_peripheral and not test.peripherals:
|
||||||
|
if opts.verbose:
|
||||||
|
print "TargetTest::%s::NotPeripheralTestSkipped(%s)" % (target, ",".join(test.peripherals))
|
||||||
|
continue
|
||||||
|
|
||||||
if test.automated and test.is_supported(target, toolchain):
|
if test.automated and test.is_supported(target, toolchain):
|
||||||
if not is_peripherals_available(target, test.peripherals):
|
if not is_peripherals_available(target, test.peripherals):
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
|
|
|
@ -322,6 +322,8 @@ TESTS = [
|
||||||
"id": "MBED_10", "description": "Hello World",
|
"id": "MBED_10", "description": "Hello World",
|
||||||
"source_dir": join(TEST_DIR, "mbed", "hello"),
|
"source_dir": join(TEST_DIR, "mbed", "hello"),
|
||||||
"dependencies": [MBED_LIBRARIES],
|
"dependencies": [MBED_LIBRARIES],
|
||||||
|
"automated": True,
|
||||||
|
"host_test": "hello_auto",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "MBED_11", "description": "Ticker Int",
|
"id": "MBED_11", "description": "Ticker Int",
|
||||||
|
@ -391,6 +393,7 @@ TESTS = [
|
||||||
"id": "MBED_22", "description": "Semihost",
|
"id": "MBED_22", "description": "Semihost",
|
||||||
"source_dir": join(TEST_DIR, "mbed", "semihost"),
|
"source_dir": join(TEST_DIR, "mbed", "semihost"),
|
||||||
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
|
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
|
||||||
|
"automated": True,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "MBED_23", "description": "Ticker Int us",
|
"id": "MBED_23", "description": "Ticker Int us",
|
||||||
|
@ -420,6 +423,7 @@ TESTS = [
|
||||||
"id": "MBED_26", "description": "Integer constant division",
|
"id": "MBED_26", "description": "Integer constant division",
|
||||||
"source_dir": join(TEST_DIR, "mbed", "div"),
|
"source_dir": join(TEST_DIR, "mbed", "div"),
|
||||||
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
|
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
|
||||||
|
"automated": True,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "MBED_27", "description": "SPI ADXL345",
|
"id": "MBED_27", "description": "SPI ADXL345",
|
||||||
|
@ -568,12 +572,18 @@ TESTS = [
|
||||||
{
|
{
|
||||||
"id": "NET_1", "description": "TCP client hello world",
|
"id": "NET_1", "description": "TCP client hello world",
|
||||||
"source_dir": join(TEST_DIR, "net", "helloworld", "tcpclient"),
|
"source_dir": join(TEST_DIR, "net", "helloworld", "tcpclient"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],
|
||||||
|
"duration": 15,
|
||||||
|
"automated": True,
|
||||||
|
"peripherals": ["ethernet"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_2", "description": "UDP client hello world",
|
"id": "NET_2", "description": "UDP client hello world",
|
||||||
"source_dir": join(TEST_DIR, "net", "helloworld", "udpclient"),
|
"source_dir": join(TEST_DIR, "net", "helloworld", "udpclient"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY, TEST_MBED_LIB],
|
||||||
|
"duration": 15,
|
||||||
|
"automated": True,
|
||||||
|
"peripherals": ["ethernet"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_3", "description": "TCP echo server",
|
"id": "NET_3", "description": "TCP echo server",
|
||||||
|
@ -581,7 +591,7 @@ TESTS = [
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
||||||
"automated": True,
|
"automated": True,
|
||||||
"host_test" : "tcpecho_server_auto",
|
"host_test" : "tcpecho_server_auto",
|
||||||
"peripherals": ["ethernet"]
|
"peripherals": ["ethernet"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_4", "description": "TCP echo client",
|
"id": "NET_4", "description": "TCP echo client",
|
||||||
|
@ -626,26 +636,31 @@ TESTS = [
|
||||||
"id": "NET_9", "description": "Multicast Send",
|
"id": "NET_9", "description": "Multicast Send",
|
||||||
"source_dir": join(TEST_DIR, "net", "helloworld", "multicast_send"),
|
"source_dir": join(TEST_DIR, "net", "helloworld", "multicast_send"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
||||||
|
"peripherals": ["ethernet"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_10", "description": "Multicast Receive",
|
"id": "NET_10", "description": "Multicast Receive",
|
||||||
"source_dir": join(TEST_DIR, "net", "helloworld", "multicast_receive"),
|
"source_dir": join(TEST_DIR, "net", "helloworld", "multicast_receive"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
||||||
|
"peripherals": ["ethernet"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_11", "description": "Broadcast Send",
|
"id": "NET_11", "description": "Broadcast Send",
|
||||||
"source_dir": join(TEST_DIR, "net", "helloworld", "broadcast_send"),
|
"source_dir": join(TEST_DIR, "net", "helloworld", "broadcast_send"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
||||||
|
"peripherals": ["ethernet"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_12", "description": "Broadcast Receive",
|
"id": "NET_12", "description": "Broadcast Receive",
|
||||||
"source_dir": join(TEST_DIR, "net", "helloworld", "broadcast_receive"),
|
"source_dir": join(TEST_DIR, "net", "helloworld", "broadcast_receive"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
||||||
|
"peripherals": ["ethernet"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "NET_13", "description": "TCP client echo loop",
|
"id": "NET_13", "description": "TCP client echo loop",
|
||||||
"source_dir": join(TEST_DIR, "net", "echo", "tcp_client_loop"),
|
"source_dir": join(TEST_DIR, "net", "echo", "tcp_client_loop"),
|
||||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, ETH_LIBRARY],
|
||||||
|
"peripherals": ["ethernet"],
|
||||||
},
|
},
|
||||||
|
|
||||||
# u-blox tests
|
# u-blox tests
|
||||||
|
@ -752,7 +767,9 @@ TESTS = [
|
||||||
{
|
{
|
||||||
"id": "EXAMPLE_1", "description": "/dev/null",
|
"id": "EXAMPLE_1", "description": "/dev/null",
|
||||||
"source_dir": join(TEST_DIR, "mbed", "dev_null"),
|
"source_dir": join(TEST_DIR, "mbed", "dev_null"),
|
||||||
"dependencies": [MBED_LIBRARIES],
|
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
|
||||||
|
"automated": True,
|
||||||
|
"host_test" : "dev_null_auto",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "EXAMPLE_2", "description": "FS + RTOS",
|
"id": "EXAMPLE_2", "description": "FS + RTOS",
|
||||||
|
|
Loading…
Reference in New Issue