tests: Output test time to trs files
[lttng-tools.git] / tests / utils / utils.h
CommitLineData
0458ed8c 1/*
9d16b343 2 * Copyright (C) 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
0458ed8c 3 *
9d16b343 4 * SPDX-License-Identifier: LGPL-2.1-only
0458ed8c 5 *
0458ed8c
JG
6 */
7
8#ifndef TEST_UTILS_H
9#define TEST_UTILS_H
10
3fd0ee48
JG
11#include <unistd.h>
12
729c1fec
SM
13#if defined(__cplusplus)
14extern "C" {
15#endif
16
28f23191
JG
17#if !defined(__GLIBC__) || \
18 ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE))
d23253ae
FD
19
20/*
21 * Version using XSI strerror_r.
22 */
0c818c97
SM
23#define PERROR_NO_LOGGER(msg, args...) \
24 do { \
25 char _perror_buf[200]; \
26 strerror_r(errno, _perror_buf, sizeof(_perror_buf)); \
27 fprintf(stderr, msg ": %s\n", ##args, _perror_buf); \
d23253ae
FD
28 } while (0);
29#else
30/*
31 * Version using GNU strerror_r, for linux with appropriate defines.
32 */
28f23191
JG
33#define PERROR_NO_LOGGER(msg, args...) \
34 do { \
35 char *_perror_buf; \
36 char _perror_tmp[200]; \
37 _perror_buf = strerror_r(errno, _perror_tmp, sizeof(_perror_tmp)); \
38 fprintf(stderr, msg ": %s\n", ##args, _perror_buf); \
d23253ae
FD
39 } while (0);
40#endif
41
0458ed8c 42int usleep_safe(useconds_t usec);
b2047add
FD
43int create_file(const char *path);
44int wait_on_file(const char *path);
0458ed8c 45
729c1fec
SM
46#if defined(__cplusplus)
47}
48#endif
49
0458ed8c 50#endif /* TEST_UTILS_H */
This page took 0.050429 seconds and 4 git commands to generate.