ChimeraTK-ApplicationCore
04.06.00
Loading...
Searching...
No Matches
check_timeout.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2
// SPDX-License-Identifier: LGPL-3.0-or-later
3
#pragma once
4
5
#include <boost/test/test_tools.hpp>
6
7
#define CHECK_TIMEOUT(condition, maxMilliseconds) \
8
{ \
9
std::chrono::steady_clock::time_point t0 = std::chrono::steady_clock::now(); \
10
while(!(condition)) { \
11
bool timeout_reached = (std::chrono::steady_clock::now() - t0) > std::chrono::milliseconds(maxMilliseconds); \
12
BOOST_CHECK(!timeout_reached); \
13
if(timeout_reached) break; \
14
usleep(1000); \
15
} \
16
} \
17
(void)0
18
19
#define CHECK_EQUAL_TIMEOUT(left, right, maxMilliseconds) \
20
{ \
21
CHECK_TIMEOUT((left) == (right), maxMilliseconds); \
22
BOOST_CHECK_EQUAL(left, right); \
23
} \
24
(void)0
sources
ChimeraTK-ApplicationCore
tests
include
check_timeout.h
Generated by
1.9.8