From c32258de09e7ce4750bbdfa689904165dc5b3d21 Mon Sep 17 00:00:00 2001 From: Przemek Wirkus Date: Thu, 20 Mar 2014 11:06:14 +0000 Subject: [PATCH] Added Interrupt vector relocation test automation. --- libraries/tests/mbed/vtor_reloc/main.cpp | 25 ++++++++++++------------ workspace_tools/tests.py | 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/libraries/tests/mbed/vtor_reloc/main.cpp b/libraries/tests/mbed/vtor_reloc/main.cpp index 4456569c9d..0ab7fb8572 100644 --- a/libraries/tests/mbed/vtor_reloc/main.cpp +++ b/libraries/tests/mbed/vtor_reloc/main.cpp @@ -18,8 +18,10 @@ static uint32_t int_table[NUM_VECTORS]; void flipper() { for (int i = 0; i < 5; i++) { - out = 1; wait(0.2); - out = 0; wait(0.2); + out = 1; + wait(0.2); + out = 0; + wait(0.2); } } @@ -30,31 +32,30 @@ void in_handler() { static bool test_once() { InterruptIn in(PIN_IN); - checks = 0; - printf(" Interrupt table location: 0x%08X\r\n", SCB->VTOR); + printf("Interrupt table location: 0x%08X\r\n", SCB->VTOR); in.rise(NULL); in.fall(in_handler); flipper(); in.fall(NULL); - if (checks != 5) { - printf(" Test failed.\r\n"); - return false; - } - printf(" Test passed.\r\n"); - return true; + bool result = (checks == 5); + printf(result ? "Test passed.\r\n" : "Test failed.\r\n"); + return result; } int main() { printf("Starting first test (interrupts not relocated).\r\n"); - if (!test_once()) + if (!test_once()) { notify_completion(false); + return 1; + } // Relocate interrupt table and test again memcpy(int_table, (void*)SCB->VTOR, sizeof(int_table)); SCB->VTOR = (uint32_t)int_table; printf("Starting second test (interrupts relocated).\r\n"); - notify_completion(test_once()); + notify_completion(test_once()); + return 0; } diff --git a/workspace_tools/tests.py b/workspace_tools/tests.py index 77389bfcb6..a80078a02d 100644 --- a/workspace_tools/tests.py +++ b/workspace_tools/tests.py @@ -183,7 +183,8 @@ TESTS = [ "id": "MBED_A18", "description": "Interrupt vector relocation", "source_dir": join(TEST_DIR, "mbed", "vtor_reloc"), "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,], - "mcu": ["LPC1768"] + "mcu": ["LPC1768"], + "automated": True, }, { "id": "MBED_A19", "description": "I2C EEPROM read/write test",