mirror of https://github.com/ARMmbed/mbed-os.git
Added us Timer proper host test automation
parent
3e809741f7
commit
d07ed138b2
|
@ -18,12 +18,22 @@ DigitalOut out(p5);
|
|||
|
||||
DigitalOut led(LED1);
|
||||
|
||||
int main() {
|
||||
printf("Hello World\n");
|
||||
#define MS_INTERVALS 1000
|
||||
|
||||
void print_char(char c = '*')
|
||||
{
|
||||
printf("%c", c);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
int main() {
|
||||
while (true) {
|
||||
wait_us(1000);
|
||||
out = !out;
|
||||
for (int i = 0; i < MS_INTERVALS; i++)
|
||||
{
|
||||
wait_us(1000);
|
||||
out = !out;
|
||||
}
|
||||
led = !led;
|
||||
print_char();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,17 +34,17 @@ class WaitusTest(DefaultTest):
|
|||
c = self.mbed.serial.read(1)
|
||||
if i > 2: # we will ignore first few measurements
|
||||
delta = time() - start
|
||||
deviation = abs(delta - 1)
|
||||
deviation = abs(delta - 1)
|
||||
deviation_ok = True if delta > 0 and deviation <= 0.5 else False # +/-5%
|
||||
test_result = test_result and deviation_ok
|
||||
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:
|
||||
print "."
|
||||
print ". skipped"
|
||||
start = time();
|
||||
measurement_time = time() - start_serial_pool
|
||||
print "Completed in %.2f sec" % (measurement_time)
|
||||
|
||||
|
||||
if test_result: # All numbers are the same
|
||||
self.print_result('success')
|
||||
else:
|
||||
|
|
|
@ -391,6 +391,9 @@ TESTS = [
|
|||
"id": "MBED_25", "description": "Time us",
|
||||
"source_dir": join(TEST_DIR, "mbed", "time_us"),
|
||||
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB],
|
||||
"duration": 15,
|
||||
"automated": True,
|
||||
"host_test": "wait_us_auto"
|
||||
},
|
||||
{
|
||||
"id": "MBED_26", "description": "Integer constant division",
|
||||
|
|
Loading…
Reference in New Issue