mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Revert "tests/freertos: add test for compat layer"
This reverts commit 0a7a86db06
.
This commit is contained in:
parent
e1d4551459
commit
be9063c1d5
@ -1,8 +0,0 @@
|
|||||||
include ../Makefile.tests_common
|
|
||||||
|
|
||||||
USEMODULE += riot_freertos
|
|
||||||
USEMODULE += shell
|
|
||||||
BOARD_WHITELIST := esp32-wroom-32
|
|
||||||
|
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
|
@ -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 <julian.holzwarth@fu-berlin.de>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
@ -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 <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
@ -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 <julian.holzwarth@fu-berlin.de>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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 */
|
|
@ -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 <julian.holzwarth@fu-berlin.de>
|
|
||||||
|
|
||||||
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))
|
|
Loading…
Reference in New Issue
Block a user