Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d97317a

Browse filesBrowse files
nodejs-github-bottargos
authored andcommitted
deps: update googletest to e4fdb87
PR-URL: #51657 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ad8ca12 commit d97317a
Copy full SHA for d97317a

File tree

Expand file treeCollapse file tree

4 files changed

+69
-40
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+69
-40
lines changed
Open diff view settings
Collapse file

‎deps/googletest/include/gtest/gtest.h‎

Copy file name to clipboardExpand all lines: deps/googletest/include/gtest/gtest.h
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,20 @@ class GTEST_API_ UnitTest {
12621262
// total_test_suite_count() - 1. If i is not in that range, returns NULL.
12631263
TestSuite* GetMutableTestSuite(int i);
12641264

1265+
// Invokes OsStackTrackGetterInterface::UponLeavingGTest. UponLeavingGTest()
1266+
// should be called immediately before Google Test calls user code. It saves
1267+
// some information about the current stack that CurrentStackTrace() will use
1268+
// to find and hide Google Test stack frames.
1269+
void UponLeavingGTest();
1270+
1271+
// Sets the TestSuite object for the test that's currently running.
1272+
void set_current_test_suite(TestSuite* a_current_test_suite)
1273+
GTEST_LOCK_EXCLUDED_(mutex_);
1274+
1275+
// Sets the TestInfo object for the test that's currently running.
1276+
void set_current_test_info(TestInfo* a_current_test_info)
1277+
GTEST_LOCK_EXCLUDED_(mutex_);
1278+
12651279
// Accessors for the implementation object.
12661280
internal::UnitTestImpl* impl() { return impl_; }
12671281
const internal::UnitTestImpl* impl() const { return impl_; }
@@ -1270,6 +1284,8 @@ class GTEST_API_ UnitTest {
12701284
// members of UnitTest.
12711285
friend class ScopedTrace;
12721286
friend class Test;
1287+
friend class TestInfo;
1288+
friend class TestSuite;
12731289
friend class internal::AssertHelper;
12741290
friend class internal::StreamingListenerTest;
12751291
friend class internal::UnitTestRecordPropertyTestHelper;
Collapse file

‎deps/googletest/src/gtest-death-test.cc‎

Copy file name to clipboardExpand all lines: deps/googletest/src/gtest-death-test.cc
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -630,13 +630,13 @@ bool DeathTestImpl::Passed(bool status_ok) {
630630
#ifndef GTEST_OS_WINDOWS
631631
// Note: The return value points into args, so the return value's lifetime is
632632
// bound to that of args.
633-
static std::unique_ptr<char*[]> CreateArgvFromArgs(
634-
std::vector<std::string>& args) {
635-
auto result = std::make_unique<char*[]>(args.size() + 1);
636-
for (size_t i = 0; i < args.size(); ++i) {
637-
result[i] = &args[i][0];
633+
static std::vector<char*> CreateArgvFromArgs(std::vector<std::string>& args) {
634+
std::vector<char*> result;
635+
result.reserve(args.size() + 1);
636+
for (auto& arg : args) {
637+
result.push_back(&arg[0]);
638638
}
639-
result[args.size()] = nullptr; // extra null terminator
639+
result.push_back(nullptr); // Extra null terminator.
640640
return result;
641641
}
642642
#endif
@@ -1036,8 +1036,8 @@ DeathTest::TestRole FuchsiaDeathTest::AssumeRole() {
10361036
// "Fuchsia Test Component" which contains a "Fuchsia Component Manifest")
10371037
// Launching processes is a privileged operation in Fuchsia, and the
10381038
// declaration indicates that the ability is required for the component.
1039-
std::unique_ptr<char*[]> argv = CreateArgvFromArgs(args);
1040-
status = fdio_spawn_etc(child_job, FDIO_SPAWN_CLONE_ALL, argv[0], argv.get(),
1039+
std::vector<char*> argv = CreateArgvFromArgs(args);
1040+
status = fdio_spawn_etc(child_job, FDIO_SPAWN_CLONE_ALL, argv[0], argv.data(),
10411041
nullptr, 2, spawn_actions,
10421042
child_process_.reset_and_get_address(), nullptr);
10431043
GTEST_DEATH_TEST_CHECK_(status == ZX_OK);
@@ -1388,8 +1388,8 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
13881388
// is necessary.
13891389
FlushInfoLog();
13901390

1391-
std::unique_ptr<char*[]> argv = CreateArgvFromArgs(args);
1392-
const pid_t child_pid = ExecDeathTestSpawnChild(argv.get(), pipe_fd[0]);
1391+
std::vector<char*> argv = CreateArgvFromArgs(args);
1392+
const pid_t child_pid = ExecDeathTestSpawnChild(argv.data(), pipe_fd[0]);
13931393
GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
13941394
set_child_pid(child_pid);
13951395
set_read_fd(pipe_fd[0]);
Collapse file

‎deps/googletest/src/gtest-internal-inl.h‎

Copy file name to clipboardExpand all lines: deps/googletest/src/gtest-internal-inl.h
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -709,18 +709,6 @@ class GTEST_API_ UnitTestImpl {
709709
return type_parameterized_test_registry_;
710710
}
711711

712-
// Sets the TestSuite object for the test that's currently running.
713-
void set_current_test_suite(TestSuite* a_current_test_suite) {
714-
current_test_suite_ = a_current_test_suite;
715-
}
716-
717-
// Sets the TestInfo object for the test that's currently running. If
718-
// current_test_info is NULL, the assertion results will be stored in
719-
// ad_hoc_test_result_.
720-
void set_current_test_info(TestInfo* a_current_test_info) {
721-
current_test_info_ = a_current_test_info;
722-
}
723-
724712
// Registers all parameterized tests defined using TEST_P and
725713
// INSTANTIATE_TEST_SUITE_P, creating regular tests for each test/parameter
726714
// combination. This method can be called more then once; it has guards
@@ -841,6 +829,18 @@ class GTEST_API_ UnitTestImpl {
841829
// GTEST_FLAG(catch_exceptions) at the moment it starts.
842830
void set_catch_exceptions(bool value) { catch_exceptions_ = value; }
843831

832+
// Sets the TestSuite object for the test that's currently running.
833+
void set_current_test_suite(TestSuite* a_current_test_suite) {
834+
current_test_suite_ = a_current_test_suite;
835+
}
836+
837+
// Sets the TestInfo object for the test that's currently running. If
838+
// current_test_info is NULL, the assertion results will be stored in
839+
// ad_hoc_test_result_.
840+
void set_current_test_info(TestInfo* a_current_test_info) {
841+
current_test_info_ = a_current_test_info;
842+
}
843+
844844
// The UnitTest object that owns this implementation object.
845845
UnitTest* const parent_;
846846

Collapse file

‎deps/googletest/src/gtest.cc‎

Copy file name to clipboardExpand all lines: deps/googletest/src/gtest.cc
+31-18Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,14 +2836,13 @@ void TestInfo::Run() {
28362836
}
28372837

28382838
// Tells UnitTest where to store test result.
2839-
internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
2840-
impl->set_current_test_info(this);
2839+
UnitTest::GetInstance()->set_current_test_info(this);
28412840

28422841
// Notifies the unit test event listeners that a test is about to start.
28432842
repeater->OnTestStart(*this);
28442843
result_.set_start_timestamp(internal::GetTimeInMillis());
28452844
internal::Timer timer;
2846-
impl->os_stack_trace_getter()->UponLeavingGTest();
2845+
UnitTest::GetInstance()->UponLeavingGTest();
28472846

28482847
// Creates the test object.
28492848
Test* const test = internal::HandleExceptionsInMethodIfSupported(
@@ -2861,7 +2860,7 @@ void TestInfo::Run() {
28612860

28622861
if (test != nullptr) {
28632862
// Deletes the test object.
2864-
impl->os_stack_trace_getter()->UponLeavingGTest();
2863+
UnitTest::GetInstance()->UponLeavingGTest();
28652864
internal::HandleExceptionsInMethodIfSupported(
28662865
test, &Test::DeleteSelf_, "the test fixture's destructor");
28672866
}
@@ -2873,15 +2872,14 @@ void TestInfo::Run() {
28732872

28742873
// Tells UnitTest to stop associating assertion results to this
28752874
// test.
2876-
impl->set_current_test_info(nullptr);
2875+
UnitTest::GetInstance()->set_current_test_info(nullptr);
28772876
}
28782877

28792878
// Skip and records a skipped test result for this object.
28802879
void TestInfo::Skip() {
28812880
if (!should_run_) return;
28822881

2883-
internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
2884-
impl->set_current_test_info(this);
2882+
UnitTest::GetInstance()->set_current_test_info(this);
28852883

28862884
TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
28872885

@@ -2890,12 +2888,13 @@ void TestInfo::Skip() {
28902888

28912889
const TestPartResult test_part_result =
28922890
TestPartResult(TestPartResult::kSkip, this->file(), this->line(), "");
2893-
impl->GetTestPartResultReporterForCurrentThread()->ReportTestPartResult(
2894-
test_part_result);
2891+
internal::GetUnitTestImpl()
2892+
->GetTestPartResultReporterForCurrentThread()
2893+
->ReportTestPartResult(test_part_result);
28952894

28962895
// Notifies the unit test event listener that a test has just finished.
28972896
repeater->OnTestEnd(*this);
2898-
impl->set_current_test_info(nullptr);
2897+
UnitTest::GetInstance()->set_current_test_info(nullptr);
28992898
}
29002899

29012900
// class TestSuite
@@ -2991,8 +2990,7 @@ void TestSuite::AddTestInfo(TestInfo* test_info) {
29912990
void TestSuite::Run() {
29922991
if (!should_run_) return;
29932992

2994-
internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
2995-
impl->set_current_test_suite(this);
2993+
UnitTest::GetInstance()->set_current_test_suite(this);
29962994

29972995
TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
29982996

@@ -3022,7 +3020,7 @@ void TestSuite::Run() {
30223020
repeater->OnTestCaseStart(*this);
30233021
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
30243022

3025-
impl->os_stack_trace_getter()->UponLeavingGTest();
3023+
UnitTest::GetInstance()->UponLeavingGTest();
30263024
internal::HandleExceptionsInMethodIfSupported(
30273025
this, &TestSuite::RunSetUpTestSuite, "SetUpTestSuite()");
30283026

@@ -3047,7 +3045,7 @@ void TestSuite::Run() {
30473045
}
30483046
elapsed_time_ = timer.Elapsed();
30493047

3050-
impl->os_stack_trace_getter()->UponLeavingGTest();
3048+
UnitTest::GetInstance()->UponLeavingGTest();
30513049
internal::HandleExceptionsInMethodIfSupported(
30523050
this, &TestSuite::RunTearDownTestSuite, "TearDownTestSuite()");
30533051

@@ -3058,15 +3056,14 @@ void TestSuite::Run() {
30583056
repeater->OnTestCaseEnd(*this);
30593057
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
30603058

3061-
impl->set_current_test_suite(nullptr);
3059+
UnitTest::GetInstance()->set_current_test_suite(nullptr);
30623060
}
30633061

30643062
// Skips all tests under this TestSuite.
30653063
void TestSuite::Skip() {
30663064
if (!should_run_) return;
30673065

3068-
internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
3069-
impl->set_current_test_suite(this);
3066+
UnitTest::GetInstance()->set_current_test_suite(this);
30703067

30713068
TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
30723069

@@ -3088,7 +3085,7 @@ void TestSuite::Skip() {
30883085
repeater->OnTestCaseEnd(*this);
30893086
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
30903087

3091-
impl->set_current_test_suite(nullptr);
3088+
UnitTest::GetInstance()->set_current_test_suite(nullptr);
30923089
}
30933090

30943091
// Clears the results of all tests in this test suite.
@@ -5304,6 +5301,22 @@ TestSuite* UnitTest::GetMutableTestSuite(int i) {
53045301
return impl()->GetMutableSuiteCase(i);
53055302
}
53065303

5304+
void UnitTest::UponLeavingGTest() {
5305+
impl()->os_stack_trace_getter()->UponLeavingGTest();
5306+
}
5307+
5308+
// Sets the TestSuite object for the test that's currently running.
5309+
void UnitTest::set_current_test_suite(TestSuite* a_current_test_suite) {
5310+
internal::MutexLock lock(&mutex_);
5311+
impl_->set_current_test_suite(a_current_test_suite);
5312+
}
5313+
5314+
// Sets the TestInfo object for the test that's currently running.
5315+
void UnitTest::set_current_test_info(TestInfo* a_current_test_info) {
5316+
internal::MutexLock lock(&mutex_);
5317+
impl_->set_current_test_info(a_current_test_info);
5318+
}
5319+
53075320
// Returns the list of event listeners that can be used to track events
53085321
// inside Google Test.
53095322
TestEventListeners& UnitTest::listeners() { return *impl()->listeners(); }

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.