Skip to content

Commit cc1ef74

Browse files
isheludkoCommit Bot
authored andcommitted
[tsan] Avoid modifying flags back and forth for each microtask queue test
... but do it once for the whole group of tests instead. Bug: v8:8929 Change-Id: I4c92a4cc29f8cf8a1011a563fe41972844c59972 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511476 Reviewed-by: Ulan Degenbaev <[email protected]> Commit-Queue: Igor Sheludko <[email protected]> Cr-Commit-Position: refs/heads/master@{#60122}
1 parent 913efea commit cc1ef74

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

test/unittests/background-compile-task-unittest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ class BackgroundCompileTaskTest : public TestWithNativeContext {
3636
static void SetUpTestCase() {
3737
CHECK_NULL(save_flags_);
3838
save_flags_ = new SaveFlags();
39-
TestWithNativeContext ::SetUpTestCase();
39+
TestWithNativeContext::SetUpTestCase();
4040
}
4141

4242
static void TearDownTestCase() {
43-
TestWithNativeContext ::TearDownTestCase();
43+
TestWithNativeContext::TearDownTestCase();
4444
CHECK_NOT_NULL(save_flags_);
4545
delete save_flags_;
4646
save_flags_ = nullptr;

test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ class CompilerDispatcherTest : public TestWithNativeContext {
5959

6060
static void SetUpTestCase() {
6161
CompilerDispatcherTestFlags::SetFlagsForTest();
62-
TestWithNativeContext ::SetUpTestCase();
62+
TestWithNativeContext::SetUpTestCase();
6363
}
6464

6565
static void TearDownTestCase() {
66-
TestWithNativeContext ::TearDownTestCase();
66+
TestWithNativeContext::TearDownTestCase();
6767
CompilerDispatcherTestFlags::RestoreFlags();
6868
}
6969

test/unittests/microtask-queue-unittest.cc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,33 @@ void RunStdFunction(void* data) {
3232
template <typename TMixin>
3333
class WithFinalizationGroupMixin : public TMixin {
3434
public:
35-
WithFinalizationGroupMixin() {
35+
WithFinalizationGroupMixin() = default;
36+
~WithFinalizationGroupMixin() override = default;
37+
38+
static void SetUpTestCase() {
39+
CHECK_NULL(save_flags_);
40+
save_flags_ = new SaveFlags();
3641
FLAG_harmony_weak_refs = true;
3742
FLAG_expose_gc = true;
43+
TMixin::SetUpTestCase();
44+
}
45+
46+
static void TearDownTestCase() {
47+
TMixin::TearDownTestCase();
48+
CHECK_NOT_NULL(save_flags_);
49+
delete save_flags_;
50+
save_flags_ = nullptr;
3851
}
3952

4053
private:
41-
SaveFlags save_flags_;
54+
static SaveFlags* save_flags_;
4255

4356
DISALLOW_COPY_AND_ASSIGN(WithFinalizationGroupMixin);
4457
};
4558

59+
template <typename TMixin>
60+
SaveFlags* WithFinalizationGroupMixin<TMixin>::save_flags_ = nullptr;
61+
4662
using TestWithNativeContextAndFinalizationGroup = //
4763
WithInternalIsolateMixin< //
4864
WithContextMixin< //

0 commit comments

Comments
 (0)