Use patch from Jonathan Wakely to fix opt issue (rhbz#1408291)
This commit is contained in:
parent
ec99f6b153
commit
3e0fdc4436
34
gtest-null-pointer.patch
Normal file
34
gtest-null-pointer.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 62466cfccad1a4fe3f59a2c33104c40adc01b4fe Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Wakely <jwakely@redhat.com>
|
||||
Date: Fri, 23 Dec 2016 01:56:14 +0000
|
||||
Subject: [PATCH] Stop TestInfo::Run() calling a function through null pointer
|
||||
|
||||
If the object was never created then trying to call &Test::DeleteSelf_
|
||||
will dereference a null pointer, with undefined behaviour.
|
||||
|
||||
Fixes #845
|
||||
---
|
||||
googletest/src/gtest.cc | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
|
||||
index d882ab2..1fb05ea 100644
|
||||
--- a/googletest/src/gtest.cc
|
||||
+++ b/googletest/src/gtest.cc
|
||||
@@ -2656,10 +2656,12 @@ void TestInfo::Run() {
|
||||
test->Run();
|
||||
}
|
||||
|
||||
- // Deletes the test object.
|
||||
- impl->os_stack_trace_getter()->UponLeavingGTest();
|
||||
- internal::HandleExceptionsInMethodIfSupported(
|
||||
- test, &Test::DeleteSelf_, "the test fixture's destructor");
|
||||
+ 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);
|
||||
|
||||
17
gtest.spec
17
gtest.spec
@ -1,20 +1,22 @@
|
||||
Summary: Google C++ testing framework
|
||||
Name: gtest
|
||||
Version: 1.7.0
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
License: BSD
|
||||
Group: Development/Tools
|
||||
URL: http://code.google.com/p/googletest/
|
||||
Source0: http://googletest.googlecode.com/files/gtest-%{version}.zip
|
||||
Patch0: gtest-soname.patch
|
||||
# https://github.com/google/googletest/issues/845
|
||||
Patch1: gtest-null-pointer.patch
|
||||
BuildRequires: cmake
|
||||
BuildRequires: libtool
|
||||
BuildRequires: python-devel
|
||||
|
||||
%description
|
||||
Google's framework for writing C++ tests on a variety of platforms
|
||||
(GNU/Linux, Mac OS X, Windows, Windows CE, and Symbian). Based on the
|
||||
xUnit architecture. Supports automatic test discovery, a rich set of
|
||||
Framework for writing C++ tests on a variety of platforms (GNU/Linux,
|
||||
Mac OS X, Windows, Windows CE, and Symbian). Based on the xUnit
|
||||
architecture. Supports automatic test discovery, a rich set of
|
||||
assertions, user-defined assertions, death tests, fatal and non-fatal
|
||||
failures, various options for running the tests, and XML test report
|
||||
generation.
|
||||
@ -31,14 +33,12 @@ This package contains development files for %{name}.
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1 -b .0-soname
|
||||
%patch1 -p2 -b .0-null-pointer
|
||||
|
||||
# keep a clean copy of samples.
|
||||
cp -a ./samples ./samples.orig
|
||||
|
||||
%build
|
||||
# disable C++ compiler optimization since it breaks exception handling
|
||||
CXXFLAGS="${CXXFLAGS:-%optflags}"
|
||||
CXXFLAGS=$(sed -e "s/-O\w*//" <<<$CXXFLAGS)
|
||||
# this is odd but needed only to generate gtest-config.
|
||||
%configure
|
||||
mkdir build && pushd build
|
||||
@ -93,6 +93,9 @@ install -D -p -m 0644 m4/gtest.m4 %{buildroot}%{_datadir}/aclocal/gtest.m4
|
||||
%{_includedir}/gtest
|
||||
|
||||
%changelog
|
||||
* Sun Jan 15 2017 Terje Rosten <terje.rosten@ntnu.no> - 1.7.0-8
|
||||
- Use patch from Jonathan Wakely to fix opt issue (rhbz#1408291)
|
||||
|
||||
* Wed Dec 21 2016 Merlin Mathesius <mmathesi@redhat.com> - 1.7.0-7
|
||||
- Disable C++ compiler optimization to fix FTBFS (BZ#1406937).
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user