Compare commits

..
Author SHA1 Message Date
openeuler-ci-bot 3c28c39ce8 !24 update to version 1.17.0
From: @fundawang 
Reviewed-by: @wk333 
Signed-off-by: @wk333
2025-05-12 01:13:46 +00:00
Funda Wang c51431d326 1.17.0 2025-05-12 00:37:22 +08:00
openeuler-ci-bot 8477977b57 !22 update to version 1.16.0
From: @fundawang 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
2025-03-20 06:13:13 +00:00
Funda Wang 231f2e75c6 1.16.0 2025-03-10 12:40:51 +08:00
openeuler-ci-bot f51f77e1a9 !21 Update to 1.15.2
From: @starlet-dx 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2025-01-16 09:10:00 +00:00
starlet-dx 435883ff61 Update to 1.15.2 2025-01-16 14:48:28 +08:00
openeuler-ci-bot 6158d2a9f7 !12 cmake modules in gtest-devel needs libgmock.so.*
From: @fundawang 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2024-07-12 02:40:27 +00:00
Funda Wang c6c0f46428 cmake modules in gtest-devel needs libgmock.so.* 2024-07-11 20:48:24 +08:00
openeuler-ci-bot f8102d6e33 !11 Update to 1.14.0
From: @wk333 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2023-08-25 06:22:13 +00:00
wk333 b6c0fd06ff Update to 1.14.0 2023-08-25 11:43:48 +08:00
openeuler-ci-bot 1a7c0e8686 !6 Internal Change
From: @xing_xing1992 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
2023-01-18 09:26:46 +00:00
xing_xing1992 f2219a627a Internal Change 2023-01-07 12:05:09 +08:00
9 changed files with 36 additions and 383 deletions
-127
View File
@@ -1,127 +0,0 @@
From dc72f7c3b4da30461fe424b0f44d7f65c5acefec Mon Sep 17 00:00:00 2001
From: srz_zumix <zumix.cpp@gmail.com>
Date: Mon, 20 Aug 2018 16:18:41 -0400
Subject: [PATCH] Googletest export
Internal Change
PiperOrigin-RevId: 209471987
---
googletest/include/gtest/gtest.h | 4 +-
.../test/gtest_setuptestcase_failure_test.cc | 58 +++++++++++++++++++
googletest/test/gtest_unittest.cc | 22 -------
3 files changed, 61 insertions(+), 23 deletions(-)
create mode 100644 googletest/test/gtest_setuptestcase_failure_test.cc
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 2be8b112..78cfc329 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -868,7 +868,9 @@ class GTEST_API_ TestCase {
bool Passed() const { return !Failed(); }
// Returns true iff the test case failed.
- bool Failed() const { return failed_test_count() > 0; }
+ bool Failed() const {
+ return failed_test_count() > 0 || ad_hoc_test_result().Failed();
+ }
// Returns the elapsed time, in milliseconds.
TimeInMillis elapsed_time() const { return elapsed_time_; }
diff --git a/googletest/test/gtest_setuptestcase_failure_test.cc b/googletest/test/gtest_setuptestcase_failure_test.cc
new file mode 100644
index 00000000..b20d9a4e
--- /dev/null
+++ b/googletest/test/gtest_setuptestcase_failure_test.cc
@@ -0,0 +1,58 @@
+// Copyright 2009 Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "gtest/gtest.h"
+
+using ::testing::InitGoogleTest;
+
+// Tests ad_hoc_test_result().
+
+class AdHocTestResultTest : public testing::Test {
+ protected:
+ static void SetUpTestCase() {
+ FAIL() << "A failure happened inside SetUpTestCase().";
+ }
+};
+
+TEST_F(AdHocTestResultTest, AdHocTestResultForTestCaseShowsFailure) {
+ const testing::TestResult& test_result = testing::UnitTest::GetInstance()
+ ->current_test_case()
+ ->ad_hoc_test_result();
+ EXPECT_TRUE(test_result.Failed());
+}
+
+TEST_F(AdHocTestResultTest, AdHocTestResultTestForUnitTestDoesNotShowFailure) {
+ const testing::TestResult& test_result =
+ testing::UnitTest::GetInstance()->ad_hoc_test_result();
+ EXPECT_FALSE(test_result.Failed());
+}
+
+int main(int argc, char **argv) {
+ InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS() ? 0 : 1;
+}
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index e1c30f39..98755540 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -7771,25 +7771,3 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) {
EXPECT_FALSE(SkipPrefix("world!", &p));
EXPECT_EQ(str, p);
}
-
-// Tests ad_hoc_test_result().
-
-class AdHocTestResultTest : public testing::Test {
- protected:
- static void SetUpTestCase() {
- FAIL() << "A failure happened inside SetUpTestCase().";
- }
-};
-
-TEST_F(AdHocTestResultTest, AdHocTestResultForTestCaseShowsFailure) {
- const testing::TestResult& test_result = testing::UnitTest::GetInstance()
- ->current_test_case()
- ->ad_hoc_test_result();
- EXPECT_TRUE(test_result.Failed());
-}
-
-TEST_F(AdHocTestResultTest, AdHocTestResultTestForUnitTestDoesNotShowFailure) {
- const testing::TestResult& test_result =
- testing::UnitTest::GetInstance()->ad_hoc_test_result();
- EXPECT_FALSE(test_result.Failed());
-}
--
2.39.0.windows.2
Binary file not shown.
@@ -1,34 +0,0 @@
diff --git a/googlemock/cmake/gmock.pc.in b/googlemock/cmake/gmock.pc.in
index c441642..e80b506 100644
--- a/googlemock/cmake/gmock.pc.in
+++ b/googlemock/cmake/gmock.pc.in
@@ -5,5 +5,6 @@ Name: gmock
Description: GoogleMock (without main() function)
Version: @PROJECT_VERSION@
URL: https://github.com/google/googletest
+Requires: gtest = @PROJECT_VERSION@
Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
diff --git a/googlemock/cmake/gmock_main.pc.in b/googlemock/cmake/gmock_main.pc.in
index c377dba..752f14d 100644
--- a/googlemock/cmake/gmock_main.pc.in
+++ b/googlemock/cmake/gmock_main.pc.in
@@ -5,5 +5,6 @@ Name: gmock_main
Description: GoogleMock (with main() function)
Version: @PROJECT_VERSION@
URL: https://github.com/google/googletest
+Requires: gmock = @PROJECT_VERSION@
Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
diff --git a/googletest/cmake/gtest_main.pc.in b/googletest/cmake/gtest_main.pc.in
index fe25d9c..63b2b14 100644
--- a/googletest/cmake/gtest_main.pc.in
+++ b/googletest/cmake/gtest_main.pc.in
@@ -5,6 +5,6 @@ Name: gtest_main
Description: GoogleTest (with main() function)
Version: @PROJECT_VERSION@
URL: https://github.com/google/googletest
-Requires: gtest
+Requires: gtest = @PROJECT_VERSION@
Libs: -L${libdir} -lgtest_main @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
-29
View File
@@ -1,29 +0,0 @@
diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt
index 8a8de1f..d67c0f5 100644
--- a/googlemock/CMakeLists.txt
+++ b/googlemock/CMakeLists.txt
@@ -109,8 +109,10 @@ if (MSVC)
else()
cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
target_link_libraries(gmock PUBLIC gtest)
+ set_target_properties(gmock PROPERTIES VERSION ${GOOGLETEST_VERSION})
cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc)
target_link_libraries(gmock_main PUBLIC gmock)
+ set_target_properties(gmock_main PROPERTIES VERSION ${GOOGLETEST_VERSION})
endif()
# If the CMake version supports it, attach header directory information
# to the targets for when we are part of a parent build (ie being pulled
diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt
index 9ee7940..1f3de11 100644
--- a/googletest/CMakeLists.txt
+++ b/googletest/CMakeLists.txt
@@ -131,7 +131,9 @@ endif()
# are used for other targets, to ensure that gtest can be compiled by a user
# aggressive about warnings.
cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
+set_target_properties(gtest PROPERTIES VERSION ${GOOGLETEST_VERSION})
cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
+set_target_properties(gtest_main PROPERTIES VERSION ${GOOGLETEST_VERSION})
# If the CMake version supports it, attach header directory information
# to the targets for when we are part of a parent build (ie being pulled
# in via add_subdirectory() rather than being a standalone build).
-17
View File
@@ -1,17 +0,0 @@
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 96b07c6..4af3e5a 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -2693,10 +2693,12 @@ void TestInfo::Run() {
test->Run();
}
+ if (test != NULL) {
// Deletes the test object.
impl->os_stack_trace_getter()->UponLeavingGTest();
internal::HandleExceptionsInMethodIfSupported(
test, &Test::DeleteSelf_, "the test fixture's destructor");
+ }
result_.set_elapsed_time(internal::GetTimeInMillis() - start);
-149
View File
@@ -1,149 +0,0 @@
From 149c0d24148da9a339d6c9d03e638a39c59731f6 Mon Sep 17 00:00:00 2001
From: Peter Levine <plevine457@gmail.com>
Date: Fri, 14 Sep 2018 19:40:51 -0400
Subject: [PATCH] Fix Python3 support
---
googletest/test/googletest-env-var-test.py | 4 ++--
googletest/test/googletest-filter-unittest.py | 13 ++++++++-----
googletest/test/googletest-output-test.py | 2 +-
googletest/test/googletest-throw-on-failure-test.py | 2 +-
googletest/test/googletest-uninitialized-test.py | 4 ++--
googletest/test/gtest_xml_output_unittest.py | 3 ++-
googletest/test/gtest_xml_test_utils.py | 2 +-
7 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/googletest/test/googletest-env-var-test.py b/googletest/test/googletest-env-var-test.py
index e1efeee1e..2f0e406af 100755
--- a/googletest/test/googletest-env-var-test.py
+++ b/googletest/test/googletest-env-var-test.py
@@ -45,8 +45,8 @@
def AssertEq(expected, actual):
if expected != actual:
- print 'Expected: %s' % (expected,)
- print ' Actual: %s' % (actual,)
+ print('Expected: %s' % (expected,))
+ print(' Actual: %s' % (actual,))
raise AssertionError
diff --git a/googletest/test/googletest-filter-unittest.py b/googletest/test/googletest-filter-unittest.py
index dc0b5bd9a..6b32f2d21 100755
--- a/googletest/test/googletest-filter-unittest.py
+++ b/googletest/test/googletest-filter-unittest.py
@@ -42,7 +42,10 @@
import os
import re
-import sets
+try:
+ from sets import Set as set # For Python 2.3 compatibility
+except ImportError:
+ pass
import sys
import gtest_test_utils
@@ -57,7 +60,7 @@
if sys.executable:
os.environ['EMPTY_VAR'] = ''
child = gtest_test_utils.Subprocess(
- [sys.executable, '-c', 'import os; print \'EMPTY_VAR\' in os.environ'])
+ [sys.executable, '-c', 'import os; print(\'EMPTY_VAR\' in os.environ)'])
CAN_PASS_EMPTY_ENV = eval(child.output)
@@ -72,7 +75,7 @@
os.environ['UNSET_VAR'] = 'X'
del os.environ['UNSET_VAR']
child = gtest_test_utils.Subprocess(
- [sys.executable, '-c', 'import os; print \'UNSET_VAR\' not in os.environ'
+ [sys.executable, '-c', 'import os; print(\'UNSET_VAR\' not in os.environ)'
])
CAN_UNSET_ENV = eval(child.output)
@@ -245,14 +248,14 @@ def AssertPartitionIsValid(self, set_var, list_of_sets):
for slice_var in list_of_sets:
full_partition.extend(slice_var)
self.assertEqual(len(set_var), len(full_partition))
- self.assertEqual(sets.Set(set_var), sets.Set(full_partition))
+ self.assertEqual(set(set_var), set(full_partition))
def AdjustForParameterizedTests(self, tests_to_run):
"""Adjust tests_to_run in case value parameterized tests are disabled."""
global param_tests_present
if not param_tests_present:
- return list(sets.Set(tests_to_run) - sets.Set(PARAM_TESTS))
+ return list(set(tests_to_run) - set(PARAM_TESTS))
else:
return tests_to_run
diff --git a/googletest/test/googletest-output-test.py b/googletest/test/googletest-output-test.py
index 2d69e353a..1a9ee6e3b 100755
--- a/googletest/test/googletest-output-test.py
+++ b/googletest/test/googletest-output-test.py
@@ -287,7 +287,7 @@ def testOutput(self):
# sequences when we read the golden file irrespective of an operating
# system used. Therefore, we need to strip those \r's from newlines
# unconditionally.
- golden = ToUnixLineEnding(golden_file.read())
+ golden = ToUnixLineEnding(golden_file.read().decode())
golden_file.close()
# We want the test to pass regardless of certain features being
diff --git a/googletest/test/googletest-throw-on-failure-test.py b/googletest/test/googletest-throw-on-failure-test.py
index 46cb9f6da..204e43e79 100755
--- a/googletest/test/googletest-throw-on-failure-test.py
+++ b/googletest/test/googletest-throw-on-failure-test.py
@@ -68,7 +68,7 @@ def SetEnvVar(env_var, value):
def Run(command):
"""Runs a command; returns True/False if its exit code is/isn't 0."""
- print 'Running "%s". . .' % ' '.join(command)
+ print('Running "%s". . .' % ' '.join(command))
p = gtest_test_utils.Subprocess(command)
return p.exited and p.exit_code == 0
diff --git a/googletest/test/googletest-uninitialized-test.py b/googletest/test/googletest-uninitialized-test.py
index 5b7d1e74f..69595a0dd 100755
--- a/googletest/test/googletest-uninitialized-test.py
+++ b/googletest/test/googletest-uninitialized-test.py
@@ -43,8 +43,8 @@ def Assert(condition):
def AssertEq(expected, actual):
if expected != actual:
- print 'Expected: %s' % (expected,)
- print ' Actual: %s' % (actual,)
+ print('Expected: %s' % (expected,))
+ print(' Actual: %s' % (actual,))
raise AssertionError
diff --git a/googletest/test/gtest_xml_output_unittest.py b/googletest/test/gtest_xml_output_unittest.py
index faedd4e6c..8669f19e5 100755
--- a/googletest/test/gtest_xml_output_unittest.py
+++ b/googletest/test/gtest_xml_output_unittest.py
@@ -266,7 +266,8 @@ def testDefaultOutputFile(self):
'gtest_no_test_unittest')
try:
os.remove(output_file)
- except OSError, e:
+ except OSError:
+ e = sys.exc_info()[1]
if e.errno != errno.ENOENT:
raise
diff --git a/googletest/test/gtest_xml_test_utils.py b/googletest/test/gtest_xml_test_utils.py
index 1e0358592..afcf55e0d 100755
--- a/googletest/test/gtest_xml_test_utils.py
+++ b/googletest/test/gtest_xml_test_utils.py
@@ -94,7 +94,7 @@ def AssertEquivalentNodes(self, expected_node, actual_node):
self.assertEquals(
len(expected_children), len(actual_children),
'number of child elements differ in element ' + actual_node.tagName)
- for child_id, child in expected_children.iteritems():
+ for child_id, child in expected_children.items():
self.assert_(child_id in actual_children,
'<%s> is not in <%s> (in element %s)' %
(child_id, actual_children, actual_node.tagName))
+34 -25
View File
@@ -1,16 +1,12 @@
Name: gtest
Version: 1.8.1
Release: 5
Version: 1.17.0
Release: 1
Summary: Google C++ testing framework
License: BSD and ASL 2.0
License: BSD-3-Clause and Apache-2.0
URL: https://github.com/google/googletest
Source0: https://github.com/google/googletest/archive/release-%{version}.tar.gz
Patch0000: gtest-1.8.1-null-pointer.patch
Patch0001: gtest-PR1839-Fix-Python3-support.patch
Patch0002: gtest-1.8.1-libversion.patch
Patch0003: gtest-1.8.1-add-missing-pkgconfig-requires.patch
Patch0004: 0001-Googletest-export.patch
Source0: https://github.com/google/googletest/releases/download/v%{version}/googletest-%{version}.tar.gz
BuildRequires: gcc-c++ cmake python3-devel
%description
This package is Google C++ testing framework,It can be compiled for
a variety of platforms.Google Test is a unit testing library for
@@ -40,49 +36,62 @@ Requires: gmock = %{version}-%{release}
The package is libraries and head files for google mocking framework.
%prep
%autosetup -p1 -n googletest-release-%{version}
sed -e "s/set(GOOGLETEST_VERSION .*)/set(GOOGLETEST_VERSION %{version})/" -i CMakeLists.txt
%autosetup -p1 -n googletest-%{version}
%build
mkdir build && cd build
%cmake -DBUILD_SHARED_LIBS=ON -DPYTHON_EXECUTABLE=%{__python3} -Dgtest_build_tests=ON ..
%make_build
%cmake -DBUILD_SHARED_LIBS=ON -DPYTHON_EXECUTABLE=%{__python3} -Dgtest_build_tests=ON
%cmake_build
%install
cd build
%make_install
%cmake_install
%check
cd build
make test
%ctest
%files
%license googletest/LICENSE
%license LICENSE
%{_libdir}/libgtest*.%{version}
%files -n gtest-devel
%doc googletest/{CHANGES,CONTRIBUTORS,README.md,docs,samples}
%doc CONTRIBUTORS README.md
%doc docs/
%{_includedir}/gtest/
%{_libdir}/libgtest*.so
%{_libdir}/cmake/GTest/
%{_libdir}/pkgconfig/gtest*
%files -n gmock
%license googlemock/LICENSE
%license LICENSE
%{_libdir}/libgmock*.%{version}
%files -n gmock-devel
%doc googlemock/{CHANGES,CONTRIBUTORS,README.md,docs}
%doc CONTRIBUTORS README.md
%doc docs/
%{_includedir}/gmock/
%{_libdir}/libgmock*.so
%{_libdir}/pkgconfig/gmock*
%changelog
* Thu Jul 11 2024 Funda Wang <fundawang@yeah.net> - 1.8.1-5
* Mon May 12 2025 Funda Wang <fundawang@yeah.net> - 1.17.0-1
- update to 1.17.0
* Mon Mar 10 2025 Funda Wang <fundawang@yeah.net> - 1.16.0-1
- update to 1.16.0
* Thu Jan 16 2025 yaoxin <1024769339@qq.com> - 1.15.2-1
- Update to 1.15.2:
* GoogleTest requires at least C++14 and follows Google's Foundational C++ Support Policy.
* C++ Language Support
* Bzlmod is now officially supported
* Many bug fixes
* Thu Jul 11 2024 Funda Wang <fundawang@yeah.net> - 1.14.0-2
- cmake modules in gtest-devel needs libgmock.so.*
* Tue Jan 18 2023 xingxing<xingxing@xfusion.com> - 1.8.1-4
* Fri Aug 25 2023 wangkai <13474090681@163.com> - 1.14.0-1
- Update to 1.14.0
* Sat Jan 07 2023 xingxing<xingxing@xfusion.com> - 1.8.1-4
- Internal Change
* Wed Nov 27 2019 zhujunhao <zhujunhao5@huawei.com> - 1.8.1-3
+2 -2
View File
@@ -1,4 +1,4 @@
version_control: github
src_repo: google/googletest
tag_prefix: release-
seperator: .
tag_prefix: ^v
separator: .
Binary file not shown.