Commit Graph

17 Commits

Author SHA1 Message Date
Hans Wennborg
9625b74cdb [gtest] Disable new posix::FOpen Windows implementation for now
The new implementation was brought in with the gtest update in
a866ce789e, but it crashes when
building with rpmalloc, see
https://github.com/llvm/llvm-project/pull/65823#issuecomment-1739820534

Comment out the new implementation basically gives us the code
before the gtest update.
2023-09-28 21:11:09 +02:00
Haowei Wu
a866ce789e Reland "Update GoogleTest to v1.14.0 (#65823)"
This patch reland 54c1a9b20d, which
updates GoogleTest to v1.14.0. This patch fixes bots failures caused
by the early patch.
2023-09-13 14:17:24 -07:00
Haowei Wu
499d713bcb Revert "Update GoogleTest to v1.14.0 (#65823)"
This reverts commit 54c1a9b20d.
It breaks a few llvm bots.
2023-09-12 11:44:13 -07:00
Zero Omega
54c1a9b20d
Update GoogleTest to v1.14.0 (#65823)
This PR updates GoogleTest to v1.14.0 . It also updates the Clang
ASTTest to fix a compatibility issue with the new GoogleTest.
2023-09-12 10:32:26 -07:00
Nikita Popov
7ffc50708a [cmake] Drop redundant libdir suffix during gtest installation
D158607 switched this code to use CMAKE_INSTALL_LIBDIR, but kept
the explicit LLVM_DIR_SUFFIX. However, CMAKE_INSTALL_LIBDIR already
contains the suffix, so we end up installing into a path like
lib6464.
2023-08-28 10:58:19 +02:00
Will Dietz
91b3ca3966 llvm_gtest: install to appropriate locations.
Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D158607
2023-08-25 11:09:48 -05:00
Sam McCall
fe8a168161 [unittest] teach gTest to print entries of DenseMap as pairs
When an assertion like the following fails:
   EXPECT_THAT(map, ElementsAre(Pair("p", "nullable"))));
Error message before:
   Actual: { 40-byte object <E8-A5 9C-7F 25-37 00-00 58-7E 51-51 D0-7F 00-00 00-00 00-00 00-00 00-00 01-00 00-00 00-00 00-00 00-DA C7-7F 25-37 00-00> }
After:
   Actual: { ("p", "nonnull") }

It is not ideal that we need to refer directly to DenseMapPair inside the
internal namespace, but I believe the practical maintenance risk is low.
This change is covered by DenseMap's unittests, as we've covered SmallString etc
in the past.

Differential Revision: https://reviews.llvm.org/D153930
2023-06-28 11:29:52 +02:00
Martin Braenne
aad5141745 Revert "Prevent deadlocks in death tests."
This reverts commit dfbcee286b.

This was causing unit tests to fail on Gentoo, see comments on
https://reviews.llvm.org/D152696.
2023-06-20 07:39:31 +00:00
Martin Braenne
dfbcee286b Prevent deadlocks in death tests.
We have recently started seeing deadlocks in death tests while running in an internal test environment.

Per the documentation here, there are issues with death tests in the presence of threads:

https://github.com/google/googletest/blob/main/docs/advanced.md#death-tests-and-threads

To avoid the deadlocks, I first tried appending `DeathTest` to the relevant test suite names, which has the effect of running these test suites before all other tests. However, this did not prevent the deadlocks.

This patch therefore uses the option of setting the `death_test_style` flag to `"threadsafe"` (see description in the page linked above under "Death Test Styles"), and this prevents the deadlocks.

The documentation notes that the "threadsafe" death test style "trades increased test execution time (potentially dramatically so) for improved thread safety". This is because, to execute a death test, "threadsafe" does a "fork + exec", then re-executes the current test in the child process, whereas the default "fast" death test style does only a fork (on those platforms that support it). However, as we have relatively few death tests, the increased execution time does not make a big difference in total test execution time in my testing.

Note that other projects, such as Chromium, also choose to set the "threadsafe" death test style globally:

https://source.chromium.org/chromium/chromium/src/+/main:base/test/test_suite.cc;l=367

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D152696
2023-06-15 04:29:00 +00:00
Haojian Wu
ca431a4fcb Remove an extra // in the IWYU pragma for gtest-matchers.h
Differential Revision: https://reviews.llvm.org/D146022
2023-03-14 13:11:53 +01:00
Michał Górny
dde05b4b91 [third-party] Respect LLVM_INSTALL_GTEST for llvm_gtest_main
Pass BUILDTREE_ONLY to llvm_gtest_main only if LLVM_INSTALL_GTEST
is not set.  This fixes 0807986303.
Otherwise, llvm_gtest_main cannot be used
in LLVM_DISTRIBUTION_COMPONENTS, effectively making it impossible
to install llvm_gtest correctly.

Differential Revision: https://reviews.llvm.org/D145946
2023-03-13 17:11:57 +01:00
Tom Stellard
0807986303 Add install targets for gtest
Stand-alone builds need an installed version of gtest in order to run
the unittests.

Reviewed By: mgorny, kwk

Differential Revision: https://reviews.llvm.org/D137890
2023-03-10 17:22:33 -08:00
Kazu Hirata
7b31c57d69 [gtest] Use std::optional instead of llvm::Optional (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14 15:26:28 -08:00
Michał Górny
a6eb76f57c [llvm] [cmake] Set EXCLUDE_FROM_ALL on gtest and TestingSupport
Exclude building googletest and LLVMTestingSupport libraries from
the `all` target.  If unittests are being built, these libraries will
be built as a dependency anyway.  If they are not being built, building
them makes little sense as they are not installed or used otherwise.

This will also make standalone builds of other projects easier, as it
makes it possible to include these directories without having to cover
them with additional conditions to prevent them from being built
unconditionally.

Differential Revision: https://reviews.llvm.org/D137035
2022-11-24 17:52:22 +01:00
Tom Stellard
a11cd0d94e Move googletest to the third-party directory
Rre-commit of 59052468c3 with a typo
fix in compiler-rt/CMakeLists.txt
2022-11-09 15:28:08 -08:00
Tom Stellard
8a084f68c8 Revert "Move googletest to the third-party directory"
This reverts commit 59052468c3.

It looks like this patch breaks the build when compiler-rt is passed to
LLVM_ENABLE_PROJECTS instead of LLVM_ENABLE_RUNTIMES.
2022-11-09 11:34:59 -08:00
Tom Stellard
59052468c3 Move googletest to the third-party directory
This will help improve the project's layering, so that sub-projects
that don't actually need any llvm code can still use googletest
without having to reference code in the llvm directory.

This will also make it easier to consolidate and simplify the standalone
build configurations.

Reviewed By: stellaraccident, lattner, probinson, phosek

Differential Revision: https://reviews.llvm.org/D131919
2022-11-09 11:10:26 -08:00