[PATCH] D152696: Prevent deadlocks in death tests.
Martin Böhme via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 12 04:09:11 PDT 2023
mboehme created this revision.
Herald added a subscriber: thopre.
Herald added a project: All.
mboehme requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.
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.
As the page linked above notes, "flags are saved before each test and restored
afterwards", so the flag affects only the tests where it is set. This is
important because the "threadsafe" death test style "trades increased test
execution time (potentially dramatically so) for improved thread safety", so we
likely don't want to set it for all tests. The tests where I've added the flag
don't appear to suffer a significantly increated execution time.
This patch changes a number of unit tests across LLVM and Clang. As this patch
fixes a test infrastructure issue and doesn't affect the behavior of the tests
themselves, it seemed appropriate to change all death tests in a single patch.
However, if reviewers would prefer me to split this up into separate patches
form LLVM and Clang, I'm happy to do that.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152696
Files:
clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp
clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp
clang/unittests/Basic/FileManagerTest.cpp
clang/unittests/Basic/LineOffsetMappingTest.cpp
clang/unittests/Basic/SarifTest.cpp
clang/unittests/Lex/LexerTest.cpp
clang/unittests/Serialization/InMemoryModuleCacheTest.cpp
clang/unittests/Tooling/TransformerTest.cpp
llvm/unittests/ADT/APFloatTest.cpp
llvm/unittests/ADT/APIntTest.cpp
llvm/unittests/ADT/APSIntTest.cpp
llvm/unittests/ADT/AnyTest.cpp
llvm/unittests/ADT/BumpPtrListTest.cpp
llvm/unittests/ADT/IteratorTest.cpp
llvm/unittests/ADT/STLExtrasTest.cpp
llvm/unittests/ADT/SequenceTest.cpp
llvm/unittests/ADT/SmallVectorTest.cpp
llvm/unittests/AsmParser/AsmParserTest.cpp
llvm/unittests/BinaryFormat/MsgPackWriterTest.cpp
llvm/unittests/CodeGen/GlobalISel/MachineIRBuilderTest.cpp
llvm/unittests/CodeGen/LowLevelTypeTest.cpp
llvm/unittests/CodeGen/MachineInstrBundleIteratorTest.cpp
llvm/unittests/FileCheck/FileCheckTest.cpp
llvm/unittests/IR/ConstantsTest.cpp
llvm/unittests/IR/MetadataTest.cpp
llvm/unittests/IR/ValueHandleTest.cpp
llvm/unittests/IR/ValueTest.cpp
llvm/unittests/Support/DataExtractorTest.cpp
llvm/unittests/Support/ErrorTest.cpp
llvm/unittests/Support/Path.cpp
llvm/unittests/Support/YAMLIOTest.cpp
llvm/unittests/Support/raw_pwrite_stream_test.cpp
llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152696.530453.patch
Type: text/x-patch
Size: 21421 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230612/3cefc60b/attachment-0001.bin>
More information about the llvm-commits
mailing list