C++ Google test aborts on Ubuntu calling Notify() multiple times on Notification object

  abseil, c++, googlemock, googletest, linux

i use google test and google mock.
There is a mock object on which i expect a method call OnConnectionError() which notifies the absl::Notification object done 3 times.

  absl::Notification done;
  EXPECT_CALL(*client, OnConnectionError(::testing::_)).Times(3)
    .WillRepeatedly(Notify(&done));

  bool result = client->ConnectToServer("localhost", 5000, 2);

  done.WaitForNotificationWithTimeout(absl::Duration(absl::Seconds(30)));

The method client->ConnectToServer has a loop which results in the repetitive call of OnConnectionError, which is fully fine and the desired behaviour.

On Windows the unit test passes fine. When jenkins runs it on ubuntu, it aborts the whole test run (not only failing one test!!) with the following output.

[notification.cc : 32] RAW: Notify() method called more than once for Notification object 0x7ffffde87320

Is it not allowed to call the Notification object multiple times? Why does the test success on Windows and aborts on ubuntu?

many thanks for your support!

Source: Windows Questions C++

LEAVE A COMMENT