about summary refs log tree commit diff
path: root/absl/synchronization
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-01-30T00·28-0800
committerjueminyang <jueminyang@google.com>2018-01-30T15·33-0500
commit26d8858eccf280ac5763db15e8b3eeed75489cf1 (patch)
tree6a54a0e31986c8bc2d9076a784f8068dabce2506 /absl/synchronization
parent46ed9d96d1412223d22430ca2aed4411894c2d63 (diff)
Changes imported from Abseil "staging" branch:
  - 53419b5e123c4c9c47ecfe52ba747a271b03ae9c Add the sampling weight to MallocHook_SampledAlloc, so th... by Abseil Team <absl-team@google.com>
  - 8689c9a0dc685f50ba843a8d0d7d4274a1ec656a Factor out inline variable detection to separate macro. by Matt Calabrese <calabrese@google.com>
  - 0eac39ee9d81c03b8335c1cd3871d0dc4ec7bca7 Log the actual and expected durations for failed timing t... by Abseil Team <absl-team@google.com>

GitOrigin-RevId: 53419b5e123c4c9c47ecfe52ba747a271b03ae9c
Change-Id: I4ae8f5c0e924cdeee253fdf37d483d47893fc64c
Diffstat (limited to 'absl/synchronization')
-rw-r--r--absl/synchronization/mutex_test.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/absl/synchronization/mutex_test.cc b/absl/synchronization/mutex_test.cc
index 5a5874def72d..53b937843a34 100644
--- a/absl/synchronization/mutex_test.cc
+++ b/absl/synchronization/mutex_test.cc
@@ -1234,10 +1234,12 @@ static void CheckResults(bool exp_result, bool act_result,
                          absl::Duration act_duration) {
   ABSL_RAW_CHECK(exp_result == act_result, "CheckResults failed");
   // Allow for some worse-case scheduling delay and clock skew.
-  ABSL_RAW_CHECK(exp_duration - absl::Milliseconds(40) <= act_duration,
-                 "CheckResults failed");
-  ABSL_RAW_CHECK(exp_duration + absl::Milliseconds(150) >= act_duration,
-                 "CheckResults failed");
+  if ((exp_duration - absl::Milliseconds(40) > act_duration) ||
+      (exp_duration + absl::Milliseconds(150) < act_duration)) {
+    ABSL_RAW_LOG(FATAL, "CheckResults failed: operation took %s, expected %s",
+                 absl::FormatDuration(act_duration).c_str(),
+                 absl::FormatDuration(exp_duration).c_str());
+  }
 }
 
 static void TestAwaitTimeout(Cond *cp, absl::Duration timeout, bool exp_result,