From 17664aea315b62b3c2df8487f300b525da1d2610 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Dec 23 2016 19:38:07 +0000 Subject: Fix test failure on non-x86 platforms. --- diff --git a/check-0.11.0-fp.patch b/check-0.11.0-fp.patch new file mode 100644 index 0000000..bc4db35 --- /dev/null +++ b/check-0.11.0-fp.patch @@ -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); + } diff --git a/check.spec b/check.spec index e082c94..a621716 100644 --- a/check.spec +++ b/check.spec @@ -3,13 +3,20 @@ Version: 0.11.0 Release: 1%{?dist} Summary: A unit test framework for C Source0: https://github.com/libcheck/%{name}/archive/%{version}.tar.gz -Group: Development/Tools License: LGPLv2+ URL: http://libcheck.github.io/check/ # Only needed for autotools in Fedora 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 + Requires(post): info Requires(preun): info @@ -22,7 +29,6 @@ The output from unit tests can be used within source code editors and IDEs. %package devel Summary: Libraries and headers for developing programs with check -Group: Development/Libraries Requires: pkgconfig Requires: %{name}%{?_isa} = %{version}-%{release} @@ -31,7 +37,6 @@ Libraries and headers for developing programs with check %package static Summary: Static libraries of check -Group: Development/Libraries %description static Static libraries of check. @@ -51,15 +56,22 @@ programs suitable for use with the Check unit test framework. %if 0%{?fedora} %patch0 -p1 -b .info-in-builddir %endif +%patch1 # Fix detection of various time-related function declarations sed -e '/DECLS(\[a/s|)|,,,[AC_INCLUDES_DEFAULT\n[#include \n #include ]]&|' \ -e '/DECLS(\[a/s/\(getline\)\( gettimeofday\)/\1,\2/' \ -i configure.ac +# Get rid of version control files +find . -name .cvsignore -exec rm {} + + # Regenerate configure due to patch 0 autoreconf -ivf +# Fix a broken prototype +sed -i.orig 's/tcase_name()/tcase_name(void)/' src/check.h.in + %build %configure @@ -76,7 +88,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la rm -rf $RPM_BUILD_ROOT%{_infodir}/dir rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name} -rm -rf doc/example/.cvsignore +rm -f doc/example/.cvsignore %check