rnp icon indicating copy to clipboard operation
rnp copied to clipboard

Upgrade bundled Google Test version

Open antonsviridenko opened this issue 3 years ago • 3 comments

Description

Google Test version downloaded by rnp build scripts fails to build with GCC 11

[ 11%] Building CXX object src/lib/CMakeFiles/librnp-obj.dir/__/librepgp/stream-write.cpp.o
In file included from /home/odsk/Ribose/rnp/build/_deps/googletest-src/googletest/src/gtest-all.cc:42:
/home/odsk/Ribose/rnp/build/_deps/googletest-src/googletest/src/gtest-death-test.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/home/odsk/Ribose/rnp/build/_deps/googletest-src/googletest/src/gtest-death-test.cc:1301:24: error: ‘dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
 1301 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/home/odsk/Ribose/rnp/build/_deps/googletest-src/googletest/src/gtest-death-test.cc:1290:13: note: by argument 1 of type ‘const void*’ to ‘void testing::internal::StackLowerThanAddress(const void*, bool*)’ declared here
 1290 | static void StackLowerThanAddress(const void* ptr, bool* result) {
      |             ^~~~~~~~~~~~~~~~~~~~~
/home/odsk/Ribose/rnp/build/_deps/googletest-src/googletest/src/gtest-death-test.cc:1299:7: note: ‘dummy’ declared here
 1299 |   int dummy;
      |       ^~~~~

This is a known bug, already fixed in upstream https://github.com/google/googletest/issues/3219

Steps to Reproduce

  1. Configure build with options -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=Debug -DDOWNLOAD_GTEST=On
  2. Use GCC 11 to build
gcc --version
gcc (Gentoo 11.2.0 p1) 11.2.0
  1. try to build

antonsviridenko avatar Dec 30 '21 13:12 antonsviridenko

Changing GIT TAG to main in https://github.com/rnpgp/rnp/blob/master/src/tests/CMakeLists.txt#L54 fixes this issue for me. Google recommends to use latest commit from the repo

GoogleTest now follows the Abseil Live at Head philosophy. We recommend updating to the latest commit in the main branch as often as possible.

@ni4 what do you think?

antonsviridenko avatar Jul 29 '22 22:07 antonsviridenko

I'm fine with using GoogleTest as head. I have reservations with always deploying code at head, because deployment is not an atomic task.

ronaldtse avatar Jul 30 '22 01:07 ronaldtse

@antonsviridenko I'm fine with proposed changes, let's switch to HEAD.

ni4 avatar Jul 30 '22 08:07 ni4