Added us Timer proper host test automation

pull/222/head
Przemek Wirkus 2014-03-19 19:57:02 +00:00
parent 3e809741f7
commit d07ed138b2
3 changed files with 21 additions and 8 deletions

View File

@ -18,12 +18,22 @@ DigitalOut out(p5);
DigitalOut led(LED1); DigitalOut led(LED1);
int main() { #define MS_INTERVALS 1000
printf("Hello World\n");
void print_char(char c = '*')
{
printf("%c", c);
fflush(stdout);
}
int main() {
while (true) { while (true) {
wait_us(1000); for (int i = 0; i < MS_INTERVALS; i++)
out = !out; {
wait_us(1000);
out = !out;
}
led = !led; led = !led;
print_char();
} }
} }

View File

@ -38,9 +38,9 @@ class WaitusTest(DefaultTest):
deviation_ok = True if delta > 0 and deviation <= 0.5 else False # +/-5% deviation_ok = True if delta > 0 and deviation <= 0.5 else False # +/-5%
test_result = test_result and deviation_ok test_result = test_result and deviation_ok
msg = "OK" if deviation_ok else "FAIL" msg = "OK" if deviation_ok else "FAIL"
print ". in %.2f sec (%.2f) [%s]" % (delta, abs(delta - 0.95), msg) print ". in %.2f sec (%.2f) [%s]" % (delta, deviation, msg)
else: else:
print "." print ". skipped"
start = time(); start = time();
measurement_time = time() - start_serial_pool measurement_time = time() - start_serial_pool
print "Completed in %.2f sec" % (measurement_time) print "Completed in %.2f sec" % (measurement_time)

View File

@ -391,6 +391,9 @@ TESTS = [
"id": "MBED_25", "description": "Time us", "id": "MBED_25", "description": "Time us",
"source_dir": join(TEST_DIR, "mbed", "time_us"), "source_dir": join(TEST_DIR, "mbed", "time_us"),
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB], "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
"duration": 15,
"automated": True,
"host_test": "wait_us_auto"
}, },
{ {
"id": "MBED_26", "description": "Integer constant division", "id": "MBED_26", "description": "Integer constant division",