From 12fe3415bc2c213a544b28ea2ebd4b1ac3895b59 Mon Sep 17 00:00:00 2001 From: studavekar Date: Wed, 21 Jun 2017 17:12:31 -0500 Subject: [PATCH] Deprecate testcases related to time drift. 1) RtosTimer is been Deprecated by EventQueue. 2) wait_us testing can't be reliably tested. --- TESTS/mbed_drivers/wait_us/main.cpp | 56 ------------------------ TESTS/mbedmicro-rtos-mbed/timer/main.cpp | 51 --------------------- 2 files changed, 107 deletions(-) delete mode 100644 TESTS/mbed_drivers/wait_us/main.cpp delete mode 100644 TESTS/mbedmicro-rtos-mbed/timer/main.cpp diff --git a/TESTS/mbed_drivers/wait_us/main.cpp b/TESTS/mbed_drivers/wait_us/main.cpp deleted file mode 100644 index f984c9bdd5..0000000000 --- a/TESTS/mbed_drivers/wait_us/main.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013-2016, ARM Limited, All Rights Reserved - * SPDX-License-Identifier: Apache-2.0 - * - * 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. - */ -#include "mbed.h" -#include "greentea-client/test_env.h" -#include "utest/utest.h" - -/** - NOTE: This test will have a bit of inherent drift due to it being - single-threaded, so having a drift that is non-zero should be ok. However, - it should still be well under the limit. -**/ - - -using namespace utest::v1; - -DigitalOut led(LED1); -volatile bool print_tick = false; -const int ONE_SECOND_US = 1000000; -const int total_ticks = 10; - -void test_case_ticker() { - for (int i = 0; i <= total_ticks; i++) { - wait_us(ONE_SECOND_US); - greentea_send_kv("tick", i); - } -} - -// Test cases -Case cases[] = { - Case("Timers: wait_us", test_case_ticker), -}; - -utest::v1::status_t greentea_test_setup(const size_t number_of_cases) { - GREENTEA_SETUP(total_ticks + 5, "timing_drift_auto"); - return greentea_test_setup_handler(number_of_cases); -} - -Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler); - -int main() { - Harness::run(specification); -} diff --git a/TESTS/mbedmicro-rtos-mbed/timer/main.cpp b/TESTS/mbedmicro-rtos-mbed/timer/main.cpp deleted file mode 100644 index 035ac31c66..0000000000 --- a/TESTS/mbedmicro-rtos-mbed/timer/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "mbed.h" -#include "greentea-client/test_env.h" -#include "rtos.h" - -#if defined(MBED_RTOS_SINGLE_THREAD) - #error [NOT_SUPPORTED] test not supported -#endif - -int total_ticks = 10; -volatile int current_tick = 0; - -DigitalOut LEDs[4] = { - DigitalOut(LED1), DigitalOut(LED2), DigitalOut(LED3), DigitalOut(LED4) -}; - -void blink(void const *n) { - static int blink_counter = 0; - const int led_id = int(n); - LEDs[led_id] = !LEDs[led_id]; - if (++blink_counter == 75 && current_tick <= total_ticks) { - greentea_send_kv("tick", current_tick++); - blink_counter = 0; - } -} - -int main(void) { - GREENTEA_SETUP(total_ticks + 5, "timing_drift_auto"); - - RtosTimer led_1_timer(blink, osTimerPeriodic, (void *)0); - RtosTimer led_2_timer(blink, osTimerPeriodic, (void *)1); - RtosTimer led_3_timer(blink, osTimerPeriodic, (void *)2); - RtosTimer led_4_timer(blink, osTimerPeriodic, (void *)3); - - led_1_timer.start(200); - led_2_timer.start(100); - led_3_timer.start(50); - led_4_timer.start(25); - - while(current_tick <= total_ticks) { - Thread::wait(10); - } - - led_4_timer.stop(); - led_3_timer.stop(); - led_2_timer.stop(); - led_1_timer.stop(); - - GREENTEA_TESTSUITE_RESULT(1); - - Thread::wait(osWaitForever); -}