Commit 99007fc3 authored by Orvid King's avatar Orvid King Committed by Facebook Github Bot

Fix Windows build

Summary: It was broken due to oddities with how MSVC handles expanding `##__VA_ARGS__` within the parameters to macros. Rather than deal with the pre-processor, just return the check to how it was and use `EXPECT_TRUE(false)` to achieve the same effect.

Reviewed By: yfeldblum

Differential Revision: D13850142

fbshipit-source-id: 887b39fb3c6072219c3f4748599bc7b707efbf25
parent f44d1a08
...@@ -35,16 +35,18 @@ ...@@ -35,16 +35,18 @@
* @param expectedMS The timeout duration, in milliseconds * @param expectedMS The timeout duration, in milliseconds
* @param tolerance The tolerance, in milliseconds. * @param tolerance The tolerance, in milliseconds.
*/ */
#define T_CHECK_TIMEOUT(start, end, expectedMS, ...) \ #define T_CHECK_TIMEOUT(start, end, expectedMS, ...) \
EXPECT_TRUE(::folly::checkTimeout( \ if (!::folly::checkTimeout( \
(start), (end), (expectedMS), false, ##__VA_ARGS__)) \ (start), (end), (expectedMS), false, ##__VA_ARGS__)) { \
<< "Timeout violates constraints, expectedMs = " \ ADD_FAILURE() \
<< std::chrono::duration_cast<std::chrono::milliseconds>(expectedMS) \ << "Timeout violates constraints, expectedMs = " \
.count() \ << std::chrono::duration_cast<std::chrono::milliseconds>(expectedMS) \
<< ", elapsed wall time ms = " \ .count() \
<< std::chrono::duration_cast<std::chrono::milliseconds>( \ << ", elapsed wall time ms = " \
(end).getTime() - (start).getTime()) \ << std::chrono::duration_cast<std::chrono::milliseconds>( \
.count(); (end).getTime() - (start).getTime()) \
.count(); \
}
/** /**
* Verify that an event took less than a specified amount of time. * Verify that an event took less than a specified amount of time.
...@@ -52,13 +54,15 @@ ...@@ -52,13 +54,15 @@
* This is similar to T_CHECK_TIMEOUT, but does not fail if the event took less * This is similar to T_CHECK_TIMEOUT, but does not fail if the event took less
* than the allowed time. * than the allowed time.
*/ */
#define T_CHECK_TIME_LT(start, end, expectedMS, ...) \ #define T_CHECK_TIME_LT(start, end, expectedMS, ...) \
EXPECT_TRUE(::folly::checkTimeout( \ if (!::folly::checkTimeout( \
(start), (end), (expectedMS), true, ##__VA_ARGS__)) \ (start), (end), (expectedMS), true, ##__VA_ARGS__)) { \
<< "Interval violates constraints, expectedMs = " \ ADD_FAILURE() \
<< std::chrono::duration_cast<std::chrono::milliseconds>(expectedMS) \ << "Interval violates constraints, expectedMs = " \
.count() \ << std::chrono::duration_cast<std::chrono::milliseconds>(expectedMS) \
<< ", elapsed wall time ms = " \ .count() \
<< std::chrono::duration_cast<std::chrono::milliseconds>( \ << ", elapsed wall time ms = " \
(end).getTime() - (start).getTime()) \ << std::chrono::duration_cast<std::chrono::milliseconds>( \
.count(); (end).getTime() - (start).getTime()) \
.count(); \
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment