#2704·folly

CO_ASSERT_FALSE is inverted when built against a released googletest

Author: mbasmanovaCreated Sep 17, 2026Updated Sep 17, 2026

Summary

Since 0509ecd45 (released in v2026.08.18.00 onwards), CO_ASSERT_FALSE in folly/coro/GtestHelpers.h is inverted for any build that uses a released googletest: it fails when the condition is false and passes when it is true.

cpp
CO_TEST_F(MyFixture, example) {
  std::vector<int> v{1};
  CO_ASSERT_FALSE(v.empty());  // fails: "Value of: v.empty() / Actual: true / Expected: false"
  co_return;
}

The failure message is misleading — "Actual: true" is fixed text from GTEST_TEST_BOOLEAN_, so it reports the opposite of the real value.

Cause

0509ecd45 cherry-picked googletest 80b3670e1 and dropped the negation:

diff
 #define CO_ASSERT_FALSE(condition) \
   GTEST_TEST_BOOLEAN_(             \
-      !(condition), #condition, true, false, CO_GTEST_FATAL_FAILURE_)
+      (condition), #condition, true, false, CO_GTEST_FATAL_FAILURE_)

That is correct only against googletest main, where the same commit reworked GTEST_TEST_BOOLEAN_ to take the expected value and compare against it:

diff
-  if (const ::testing::AssertionResult gtest_ar_ =
-          ::testing::AssertionResult(expression))
+  if (::testing::internal::AssertionResultExpectation gtest_are_ = {
+          ::testing::AssertionResult(expression), expected})

CO_ASSERT_FALSE expands against whatever GTEST_TEST_BOOLEAN_ the installed googletest provides. In every released googletest — including v1.17.0, which folly's own build/fbcode_builder/manifests/googletest pins — that macro ignores expected and simply tests the expression, so the negation is lost.

There is no compile error and no version guard; the assertion silently inverts.

Impact

We hit this in Axiom (facebookincubator/axiom#1911): our CI image picked up folly v2026.09.07.00 and a passing test started failing, with a message pointing at code that was correct. Anything on folly >= v2026.08.18.00 with a released googletest is affected.

Suggestion

Either delegate to googletest's own macro rather than re-implementing its body, or guard the change on a googletest version that contains 80b3670e1 (no release does yet).

CC @kKPulla @kgpai — this is what broke the Axiom Linux CI once the image picked up the new folly.