diff options
Diffstat (limited to 'cts/task')
-rw-r--r-- | cts/task/cts.tasklist | 14 | ||||
-rw-r--r-- | cts/task/cts.testlist | 27 | ||||
-rw-r--r-- | cts/task/dut.c | 144 | ||||
l--------- | cts/task/th.c | 1 |
4 files changed, 0 insertions, 186 deletions
diff --git a/cts/task/cts.tasklist b/cts/task/cts.tasklist deleted file mode 100644 index 6477d74c2c..0000000000 --- a/cts/task/cts.tasklist +++ /dev/null @@ -1,14 +0,0 @@ -/* Copyright 2013 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/** - * See CONFIG_TASK_LIST in config.h for details. - */ -#define CONFIG_CTS_TASK_LIST \ - TASK_ALWAYS(A, task_abc, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(B, task_abc, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(C, task_abc, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(TICK, task_tick, NULL, 256) \ - TASK_ALWAYS(CTS, cts_task, NULL, TASK_STACK_SIZE) diff --git a/cts/task/cts.testlist b/cts/task/cts.testlist deleted file mode 100644 index c4b7bc3231..0000000000 --- a/cts/task/cts.testlist +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2016 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* - * Test task switching. Task A wakes up B and goes to sleep. Task B wakes - * up C then goes to sleep. Task C wakes up A then goes to sleep. This is - * repeated TEST_COUNT times. It's expected all tasks to run exactly - * TEST_COUNT times. Tick task runs to inject some irregularity. - */ -CTS_TEST(test_task_switch,,,,) - -/* - * Test task priority. CTS task wakes up A and C then goes to sleep. Since C - * has a higher priority, C should run first. This should result in C running - * one more time than A (or B). - */ -CTS_TEST(test_task_priority,,,,) - -/* - * Test stack overflow. CTS task overflows the stack and it should be detected - * when task switch happens. Reboot is expected. - */ -CTS_TEST(test_stack_overflow,\ - CTS_RC_DID_NOT_END, "Stack overflow in CTS task!",\ - CTS_RC_DID_NOT_END, "Stack overflow in CTS task!") diff --git a/cts/task/dut.c b/cts/task/dut.c deleted file mode 100644 index 71fe4050ec..0000000000 --- a/cts/task/dut.c +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright 2013 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Tasks for scheduling test. - */ - -#include "common.h" -#include "cts_common.h" -#include "task.h" -#include "timer.h" - -static int repeat_count; -static int wake_count[3]; - -void clean_state(void) -{ - wake_count[0] = wake_count[1] = wake_count[2] = 0; -} - -void task_abc(void *data) -{ - int task_id = task_get_current(); - int id = task_id - TASK_ID_A; - task_id_t next = task_id + 1; - - if (next > TASK_ID_C) - next = TASK_ID_A; - - task_wait_event(-1); - - CPRINTS("%c Starting", 'A' + id); - cflush(); - - while (1) { - wake_count[id]++; - if (id == 2 && wake_count[id] == repeat_count) { - task_set_event(TASK_ID_CTS, TASK_EVENT_WAKE); - task_wait_event(0); - } else { - task_set_event(next, TASK_EVENT_WAKE); - task_wait_event(0); - } - } -} - -void task_tick(void *data) -{ - task_wait_event(-1); - ccprintf("\n[starting Task T]\n"); - - /* Wake up every tick */ - while (1) - /* Wait for timer interrupt message */ - usleep(3000); -} - -enum cts_rc test_task_switch(void) -{ - uint32_t event; - - repeat_count = 3000; - - task_wake(TASK_ID_A); - event = task_wait_event(5 * SECOND); - - if (event != TASK_EVENT_WAKE) { - CPRINTS("Woken up by unexpected event: 0x%08x", event); - return CTS_RC_FAILURE; - } - - if (wake_count[0] != repeat_count || wake_count[1] != repeat_count) { - CPRINTS("Unexpected counter values: %d %d %d", - wake_count[0], wake_count[1], wake_count[2]); - return CTS_RC_FAILURE; - } - - /* TODO: Verify no tasks are ready, no events are pending. */ - if (*task_get_event_bitmap(TASK_ID_A) - || *task_get_event_bitmap(TASK_ID_B) - || *task_get_event_bitmap(TASK_ID_C)) { - CPRINTS("Events are pending"); - return CTS_RC_FAILURE; - } - - return CTS_RC_SUCCESS; -} - -enum cts_rc test_task_priority(void) -{ - uint32_t event; - - repeat_count = 2; - - task_wake(TASK_ID_A); - task_wake(TASK_ID_C); - - event = task_wait_event(5 * SECOND); - - if (event != TASK_EVENT_WAKE) { - CPRINTS("Woken up by unexpected event: 0x%08x", event); - return CTS_RC_FAILURE; - } - - if (wake_count[0] != repeat_count - 1 - || wake_count[1] != repeat_count - 1) { - CPRINTS("Unexpected counter values: %d %d %d", - wake_count[0], wake_count[1], wake_count[2]); - return CTS_RC_FAILURE; - } - - /* TODO: Verify no tasks are ready, no events are pending. */ - if (*task_get_event_bitmap(TASK_ID_A) - || *task_get_event_bitmap(TASK_ID_B) - || *task_get_event_bitmap(TASK_ID_C)) { - CPRINTS("Events are pending"); - return CTS_RC_FAILURE; - } - - return CTS_RC_SUCCESS; -} - -static void recurse(int x) -{ - CPRINTS("+%d", x); - msleep(1); - recurse(x + 1); - CPRINTS("-%d", x); -} - -enum cts_rc test_stack_overflow(void) -{ - recurse(0); - return CTS_RC_FAILURE; -} - -#include "cts_testlist.h" - -void cts_task(void) -{ - task_wake(TASK_ID_TICK); - cts_main_loop(tests, "Task"); - task_wait_event(-1); -} diff --git a/cts/task/th.c b/cts/task/th.c deleted file mode 120000 index 41eab28462..0000000000 --- a/cts/task/th.c +++ /dev/null @@ -1 +0,0 @@ -dut.c
\ No newline at end of file |