Fix test failure on non-x86 platforms.

This commit is contained in:
Jerry James 2016-12-23 12:38:07 -07:00
parent 79fb554a81
commit 17664aea31
2 changed files with 39 additions and 5 deletions

22
check-0.11.0-fp.patch Normal file
View File

@ -0,0 +1,22 @@
--- tests/check_check_master.c.orig 2016-12-17 16:35:40.000000000 -0700
+++ tests/check_check_master.c 2016-12-23 11:54:11.764383535 -0700
@@ -191,7 +191,7 @@ static master_test_t master_tests[] = {
{ "Simple Tests", "test_ck_assert_ldouble_ge", CK_FAILURE, "Assertion 'x >= y' failed: x == 2.5, y == 3" },
{ "Simple Tests", "test_ck_assert_ldouble_ge_with_mod", CK_FAILURE, "Assertion '2%d >= 3%f' failed: 2%d == 0, 3%f == 1" },
{ "Simple Tests", "test_ck_assert_ldouble_with_expr", CK_PASS, "Passed" },
- { "Simple Tests", "test_ck_assert_ldouble_eq_tol", CK_FAILURE, "Assertion 'fabsl(y - x) < t' failed: x == 0.001, y == 0.002, t == 0.001" },
+ { "Simple Tests", "test_ck_assert_ldouble_eq_tol", CK_FAILURE, "Assertion 'fabsl(y - x) < t' failed: x == 0.001, y == 0.002, t == 0.0009" },
{ "Simple Tests", "test_ck_assert_ldouble_eq_tol_with_mod", CK_FAILURE, "Assertion 'fabsl(2%f - 3%d) < 2%p' failed: 3%d == 1, 2%f == 0, 2%p == 0" },
{ "Simple Tests", "test_ck_assert_ldouble_ne_tol", CK_FAILURE, "Assertion 'fabsl(y - x) >= t' failed: x == 0.001, y == 0.002, t == 0.01" },
{ "Simple Tests", "test_ck_assert_ldouble_ne_tol_with_mod", CK_FAILURE, "Assertion 'fabsl(3%f - 3%d) >= 3%p' failed: 3%d == 1, 3%f == 1, 3%p == 1" },
--- tests/check_check_sub.c.orig 2016-12-17 16:35:40.000000000 -0700
+++ tests/check_check_sub.c 2016-12-23 11:53:46.643534215 -0700
@@ -1634,7 +1634,7 @@ START_TEST(test_ck_assert_ldouble_eq_tol
y*=10.0l;
t*=10.0l;
ck_assert_ldouble_eq_tol(x, y, t);
- t/=10.0l;
+ t=0.0009l;
record_failure_line_num(__LINE__);
ck_assert_ldouble_eq_tol(x, y, t);
}

View File

@ -3,13 +3,20 @@ Version: 0.11.0
Release: 1%{?dist} Release: 1%{?dist}
Summary: A unit test framework for C Summary: A unit test framework for C
Source0: https://github.com/libcheck/%{name}/archive/%{version}.tar.gz Source0: https://github.com/libcheck/%{name}/archive/%{version}.tar.gz
Group: Development/Tools
License: LGPLv2+ License: LGPLv2+
URL: http://libcheck.github.io/check/ URL: http://libcheck.github.io/check/
# Only needed for autotools in Fedora # Only needed for autotools in Fedora
Patch0: %{name}-0.11.0-info-in-builddir.patch Patch0: %{name}-0.11.0-info-in-builddir.patch
BuildRequires: pkgconfig, libtool, autoconf, automake, subunit-devel # Fix test failures due to varying floating point behavior across platforms
Patch1: %{name}-0.11.0-fp.patch
BuildRequires: gcc
BuildRequires: libtool
BuildRequires: patchutils
BuildRequires: pkgconfig
BuildRequires: subunit-devel
BuildRequires: texinfo BuildRequires: texinfo
Requires(post): info Requires(post): info
Requires(preun): info Requires(preun): info
@ -22,7 +29,6 @@ The output from unit tests can be used within source code editors and IDEs.
%package devel %package devel
Summary: Libraries and headers for developing programs with check Summary: Libraries and headers for developing programs with check
Group: Development/Libraries
Requires: pkgconfig Requires: pkgconfig
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
@ -31,7 +37,6 @@ Libraries and headers for developing programs with check
%package static %package static
Summary: Static libraries of check Summary: Static libraries of check
Group: Development/Libraries
%description static %description static
Static libraries of check. Static libraries of check.
@ -51,15 +56,22 @@ programs suitable for use with the Check unit test framework.
%if 0%{?fedora} %if 0%{?fedora}
%patch0 -p1 -b .info-in-builddir %patch0 -p1 -b .info-in-builddir
%endif %endif
%patch1
# Fix detection of various time-related function declarations # Fix detection of various time-related function declarations
sed -e '/DECLS(\[a/s|)|,,,[AC_INCLUDES_DEFAULT\n[#include <time.h>\n #include <sys/time.h>]]&|' \ sed -e '/DECLS(\[a/s|)|,,,[AC_INCLUDES_DEFAULT\n[#include <time.h>\n #include <sys/time.h>]]&|' \
-e '/DECLS(\[a/s/\(getline\)\( gettimeofday\)/\1,\2/' \ -e '/DECLS(\[a/s/\(getline\)\( gettimeofday\)/\1,\2/' \
-i configure.ac -i configure.ac
# Get rid of version control files
find . -name .cvsignore -exec rm {} +
# Regenerate configure due to patch 0 # Regenerate configure due to patch 0
autoreconf -ivf autoreconf -ivf
# Fix a broken prototype
sed -i.orig 's/tcase_name()/tcase_name(void)/' src/check.h.in
%build %build
%configure %configure
@ -76,7 +88,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -rf $RPM_BUILD_ROOT%{_infodir}/dir rm -rf $RPM_BUILD_ROOT%{_infodir}/dir
rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name} rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}
rm -rf doc/example/.cvsignore rm -f doc/example/.cvsignore
%check %check