1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/include/test_utils/interactive_sync.h
Gaëtan Harter 027426793c
test_utils_interactive_sync: add a helper for synchronizing tests
Add an implementation that waits for 's' to print 'START' and return.
If 'r' is given is prints 'READY' to allow querying for state.

The help and answered string have to be different to not match the other.
Using puts/getchar was smaller than using `stdio_read/stdio_write` on the
example I tested with `esp32`.
2019-08-15 12:26:28 +02:00

43 lines
897 B
C

/*
* Copyright (C) 2019 Freie Universität 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.
*/
/**
* @defgroup test_utils_interactive_sync Test interactive synchronization
* @ingroup sys
* @brief Utility function for synchronizing before a test
*
* @{
* @file
* @brief Synchronization for normally non interactive tests
*
* @author Gaëtan Harter <gaetan.harter@fu-berlin.de>
*/
#ifndef TEST_UTILS_INTERACTIVE_SYNC_H
#define TEST_UTILS_INTERACTIVE_SYNC_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Wait for the tester to start test
*
* @details Wait for a 's' character to return
*
*/
void test_utils_interactive_sync(void);
#ifdef __cplusplus
}
#endif
#endif /* TEST_UTILS_INTERACTIVE_SYNC_H */
/** @} */