From be9063c1d5a1501ba16e1e666081441334edd73b Mon Sep 17 00:00:00 2001 From: JulianHolzwarth Date: Wed, 17 Apr 2019 16:07:20 +0200 Subject: [PATCH] Revert "tests/freertos: add test for compat layer" This reverts commit 0a7a86db065520adeb6d941bc7fc67419ade5d64. --- tests/freertos/Makefile | 8 --- tests/freertos/main.c | 103 -------------------------------- tests/freertos/semaphore_test.c | 82 ------------------------- tests/freertos/semaphore_test.h | 47 --------------- tests/freertos/tests/01-run.py | 34 ----------- 5 files changed, 274 deletions(-) delete mode 100644 tests/freertos/Makefile delete mode 100644 tests/freertos/main.c delete mode 100644 tests/freertos/semaphore_test.c delete mode 100644 tests/freertos/semaphore_test.h delete mode 100755 tests/freertos/tests/01-run.py diff --git a/tests/freertos/Makefile b/tests/freertos/Makefile deleted file mode 100644 index 4f69e7f7af..0000000000 --- a/tests/freertos/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -include ../Makefile.tests_common - -USEMODULE += riot_freertos -USEMODULE += shell -BOARD_WHITELIST := esp32-wroom-32 - - -include $(RIOTBASE)/Makefile.include diff --git a/tests/freertos/main.c b/tests/freertos/main.c deleted file mode 100644 index 67acb3e61a..0000000000 --- a/tests/freertos/main.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2019 Freie Universitaet Berlin, - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup tests - * @{ - * - * @file - * @brief freertos testing tool - * - * More detailed information about the file and the functionality implemented. - * - * @author Julian Holzwarth - * - */ - -#include -#include - -#include "shell.h" - -#include "freertos/FreeRTOS.h" -#include "semaphore_test.h" - -/** - * Foward declarations - */ -static int cmd_test_mutex(int argc, char **argv); -static int cmd_test_recursive_mutex(int argc, char **argv); - - -/** - * @brief List of command for this application. - */ -static const shell_command_t shell_commands[] = { - { "mutex_semaphore", "tests freertos mutex semaphor", cmd_test_mutex, }, - { "recursive_mutex_semaphore", "tests freertos recursive mutex semaphor", cmd_test_recursive_mutex }, - { NULL, NULL, NULL } -}; - -/** - * @brief shell command to test freertos mutex semaphore - * - * @param[in] argc Number of arguments - * @param[in] argv Array of arguments - * - * @return 0 on success - */ -static int cmd_test_mutex(int argc, char **argv) -{ - (void)argc; - (void)argv; - puts("starting test: mutex semaphore"); - if (semaphore_test_mutex_take() == pdPASS) { - puts("OK"); - } - else { - puts("mutex semaphore test failed"); - } - - return 0; -} - -/** - * @brief shell command to test freertos recursive mutex semaphore - * - * @param[in] argc Number of arguments - * @param[in] argv Array of arguments - * - * @return 0 on success - */ -static int cmd_test_recursive_mutex(int argc, char **argv) -{ - (void)argc; - (void)argv; - puts("starting test: recursive mutex semaphore"); - if (semaphore_test_recursive_mutex_take() == pdPASS) { - puts("OK"); - } - else { - puts("recursive mutex semaphore test failed"); - } - return 0; -} - -/** - * @brief main function starting shell - * - * @return 0 on success - */ -int main(void) -{ - puts("Starting shell..."); - char line_buf[SHELL_DEFAULT_BUFSIZE]; - shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); - - return 0; -} diff --git a/tests/freertos/semaphore_test.c b/tests/freertos/semaphore_test.c deleted file mode 100644 index e9a1a017fa..0000000000 --- a/tests/freertos/semaphore_test.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2019 Freie Universitaet Berlin, - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -#include -#include - -#include "freertos/semphr.h" -#include "freertos/queue.h" -#include "freertos/FreeRTOS.h" - -#include "semaphore_test.h" - -/** - * @brief tests the take function for a freertos mutex semaphore - * - * @return pdPASS when the test is passed, pdFail otherwise - */ -int semaphore_test_mutex_take(void) -{ - SemaphoreHandle_t testing_semaphore = xSemaphoreCreateMutex(); - - if (testing_semaphore == NULL) { - puts("test failed: mutex semaphore not created"); - return pdFAIL; - } - /* - * Freertos Documentation: - * "pdPASS: Returned only if the call to xSemaphoreTake() - * was successful in obtaining the semaphore." - */ - /* first call should be successful */ - if (xSemaphoreTake(testing_semaphore, 0) == pdFAIL) { - puts("error in Take"); - vSemaphoreDelete(testing_semaphore); - return pdFAIL; - } - /* after the fist call every call should fail */ - if (xSemaphoreTake(testing_semaphore, 0) == pdPASS) { - puts("error in Take"); - vSemaphoreDelete(testing_semaphore); - return pdFAIL; - } - vSemaphoreDelete(testing_semaphore); - return pdPASS; -} - -/** - * @brief tests the take function for a freertos recursive mutex semaphore - * - * @return pdPASS when the test is passed, pdFAIL otherwise - */ -int semaphore_test_recursive_mutex_take(void) -{ - SemaphoreHandle_t testing_semaphore = xSemaphoreCreateRecursiveMutex(); - - if (testing_semaphore == NULL) { - puts("test failed: recursive mutex semaphore not created"); - return pdFAIL; - } - /* - * Freertos Documentation: - * "pdPASS: Returned only if the call to xSemaphoreTakeRecursive() - * was successful in obtaining the semaphore.", - * "once a recursive mutex has been successfully ‘taken’ by a task, - * further calls to xSemaphoreTakeRecursive() made by the - * same task will also be successful." - */ - for (size_t i = 0; i < 3; i++) { - if (xSemaphoreTakeRecursive(testing_semaphore, 0) == pdFAIL) { - puts("error in Take"); - vSemaphoreDelete(testing_semaphore); - return pdFAIL; - } - } - vSemaphoreDelete(testing_semaphore); - return pdPASS; -} diff --git a/tests/freertos/semaphore_test.h b/tests/freertos/semaphore_test.h deleted file mode 100644 index ff28059837..0000000000 --- a/tests/freertos/semaphore_test.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2019 Freie Universitaet Berlin, - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ -#ifndef SEMAPHORE_TEST_H -#define SEMAPHORE_TEST_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @ingroup tests - * @{ - * - * @file - * @brief freertos testing tool - * - * More detailed information about the file and the functionality implemented. - * - * @author Julian Holzwarth - * - */ - - -/** - * @brief tests the take function for a freertos mutex semaphore - * - * @return pdPASS when the test is passed, pdFail otherwise - */ -int semaphore_test_mutex_take(void); - -/** - * @brief tests the take function for a freertos recursive mutex semaphore - * - * @return pdPASS when the test is passed, pdFAIL otherwise - */ -int semaphore_test_recursive_mutex_take(void); - -#ifdef __cplusplus -} -#endif - -#endif /* SEMAPHORE_TEST_H */ diff --git a/tests/freertos/tests/01-run.py b/tests/freertos/tests/01-run.py deleted file mode 100755 index d7a1bef28f..0000000000 --- a/tests/freertos/tests/01-run.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright (C) 2019 Freie Universitaet Berlin, -# -# This file is subject to the terms and conditions of the GNU Lesser -# General Public License v2.1. See the file LICENSE in the top level -# directory for more details. - -# @author Julian Holzwarth - -import sys -import pexpect -from testrunner import run - - -def testfunc(child): - # Try to wait for the shell - for _ in range(0, 10): - child.sendline("help") - if child.expect_exact(["> ", pexpect.TIMEOUT], timeout=1) == 0: - break - child.sendline("mutex_semaphore") - child.expect("starting test: mutex semaphore") - child.expect("OK") - child.expect_exact("> ") - - child.sendline("recursive_mutex_semaphore") - child.expect_exact("starting test: recursive mutex semaphore") - child.expect("OK") - child.expect_exact("> ") - - -if __name__ == "__main__": - sys.exit(run(testfunc))