1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/posix_time/main.c
Francisco Molina 416c048737 tests: add test_utils_interactive_sync when possible
- Define test_utils_interactive_sync as DEFAULT_MODULE in Makefile.tests_common
- For tests disabling autoinit, add test_utils_interactive_sync to main
- Add DISABLE_MODULE += test_utils_interactive_sync for tests requiring
  sudo,  `tests/shell`, `tests/minimal` and `tests/stdin`
- Add shell_commands to tests/periph_wdt and tests/struct_tm_utility to
  pull `r` and `s` commands
- Remove includes and usage in `tests/main.c` for tests that where
  already using test_utils_interactive_sync
2019-11-27 15:07:42 +01:00

48 lines
895 B
C

/*
* Copyright (C) 2014-17 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.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Posix sleep test application
*
* @author Christian Mehlis <mehlis@inf.fu-berlin.de>
* @author Martine Lenders <m.lenders@fu-berlin.de>
*
* @}
*/
/* needed for posix usleep */
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600
#endif
#include <stdio.h>
#include <unistd.h>
int main(void)
{
puts("5 x usleep(i++ * 500000)");
for (unsigned i = 0; i < 5; i++) {
useconds_t us = i * 500000u;
usleep(us);
puts("wake up");
}
puts("5 x sleep(i++)");
for (unsigned i = 0; i < 5; i++) {
sleep(i);
puts("wake up");
}
puts("DONE");
return 0;
}