RTOS_4 Signal test automation added to test suite

pull/234/head
Przemek Wirkus 2014-03-25 11:28:50 +00:00
parent 031bf1323b
commit 9a73b5a809
2 changed files with 20 additions and 5 deletions

View File

@ -1,21 +1,35 @@
#include "mbed.h"
#include "test_env.h"
#include "rtos.h"
#define SIGNALS_TO_EMIT 100
#define SIGNAL_HANDLE_DELEY 25
#define SIGNAL_SET_VALUE 0x01
DigitalOut led(LED1);
volatile int signal_counter = 0;
void led_thread(void const *argument) {
while (true) {
// Signal flags that are reported as event are automatically cleared.
Thread::signal_wait(0x1);
Thread::signal_wait(SIGNAL_SET_VALUE);
led = !led;
signal_counter++;
}
}
int main (void) {
Thread thread(led_thread);
bool result = true;
while (true) {
Thread::wait(1000);
thread.signal_set(0x1);
Thread::wait(2 * SIGNAL_HANDLE_DELEY);
thread.signal_set(SIGNAL_SET_VALUE);
if (signal_counter == SIGNALS_TO_EMIT) {
printf("Handled %d signals\r\n", signal_counter);
break;
}
}
notify_completion(result);
return 0;
}

View File

@ -520,7 +520,8 @@ TESTS = [
{
"id": "RTOS_4", "description": "Signals",
"source_dir": join(TEST_DIR, "rtos", "mbed", "signals"),
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES],
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, TEST_MBED_LIB],
"automated": True,
},
{
"id": "RTOS_5", "description": "Queue",