Fix FTBFS on i686-linux due to rounding issue (see references). Fixes Guix bug #22049 (see below). Copied from Debian. Source: https://sources.debian.net/src/ilmbase/2.2.0-11/debian/patches/testBoxAlgo.patch/ https://sources.debian.net/src/ilmbase/2.2.0-11/debian/patches/testBox.patch/ References: https://lists.nongnu.org/archive/html/openexr-devel/2015-12/msg00001.html https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22049 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815712 https://anonscm.debian.org/cgit/pkg-phototools/ilmbase.git/commit/?id=ab28bb45cdad8adc32e345b777ab8e692b1d9a9c --- Subject: testBoxAlgo: allow fuzzy match of b12 == b2 From: Steven Chamberlain Date: Wed, 24 Feb 2016 01:04:11 +0000 Also fix a pre-existing typo. --- a/IlmBase/ImathTest/testBoxAlgo.cpp +++ b/IlmBase/ImathTest/testBoxAlgo.cpp @@ -886,10 +886,11 @@ boxMatrixTransform () assert (approximatelyEqual (b2.min, b4.min, e)); assert (approximatelyEqual (b2.max, b4.max, e)); - assert (approximatelyEqual (b3.max, b4.max, e)); + assert (approximatelyEqual (b3.min, b4.min, e)); assert (approximatelyEqual (b3.max, b4.max, e)); - assert (b21 == b2); + assert (approximatelyEqual (b2.min, b21.min, e)); + assert (approximatelyEqual (b2.max, b21.max, e)); assert (b31 == b3); M[0][3] = 1; --- Subject: testBox: allow fuzzy comparison of floats, doubles From: Steven Chamberlain Date: Wed, 24 Feb 2016 01:10:11 +0000 Allow for inexact values, as long as the error is smaller than the epsilon of the data type. On 32-bit x86, allow even greater discrepency at double precision, due to possible double-rounding. See https://lists.nongnu.org/archive/html/openexr-devel/2015-12/msg00001.html --- a/IlmBase/ImathTest/testBox.cpp +++ b/IlmBase/ImathTest/testBox.cpp @@ -47,6 +47,58 @@ using namespace IMATH_INTERNAL_NAMESPACE namespace { +template +bool +approximatelyEqual (const T &p1, const T &p2) +{ + /* int and short should be exact */ + return (p1 == p2); +} + +bool +approximatelyEqual (const Vec2 &p1, const Vec2 &p2) +{ + float e = limits::epsilon(); + float m = 0; + + for (int i = 0; i < 2; ++i) + { + m = max (m, abs (p1[i])); + m = max (m, abs (p2[i])); + } + + for (int i = 0; i < 2; ++i) + if (!equalWithAbsError (p1[i], p2[i], m * e)) + return false; + + return true; +} + +bool +approximatelyEqual (const Vec2 &p1, const Vec2 &p2) +{ +#if defined(__i386__) || defined(_M_IX86) + /* double-rounding on 32-bit x86 may cause larger error: + use epsilon of float rather than double */ + double e = limits::epsilon(); +#else + double e = limits::epsilon(); +#endif + double m = 0; + + for (int i = 0; i < 2; ++i) + { + m = max (m, abs (p1[i])); + m = max (m, abs (p2[i])); + } + + for (int i = 0; i < 2; ++i) + if (!equalWithAbsError (p1[i], p2[i], m * e)) + return false; + + return true; +} + // // Test case generation utility - create a vector of IMATH_INTERNAL_NAMESPACE::Vec{2,3,4} // with all permutations of integers 1..T::dimensions(). @@ -250,7 +302,8 @@ testExtendByPoint(const char *type) IMATH_INTERNAL_NAMESPACE::Box b; b.extendBy(p); - assert(b.min == p && b.max == p); + assert (approximatelyEqual (b.min, p)); + assert (approximatelyEqual (b.max, p)); } // @@ -283,7 +336,8 @@ testExtendByPoint(const char *type) b.extendBy(p); - assert(b.min == min && b.max == max); + assert (approximatelyEqual (b.min, min)); + assert (approximatelyEqual (b.max, max)); } } } @@ -358,7 +412,8 @@ testExtendByBox(const char *type) } b.extendBy(IMATH_INTERNAL_NAMESPACE::Box(p0, p1)); - assert(b.min == min && b.max == max); + assert (approximatelyEqual (b.min, min)); + assert (approximatelyEqual (b.max, max)); } } } ing-shepherd-service): New procedure. (static-networking-shepherd-services): Rewrite in terms of the above. (static-networking-service): Deprecate. Adjust to new 'static-networking' API. (%base-services): Likewise. * gnu/system/install.scm (%installation-services): Likewise. * gnu/system/hurd.scm (%base-services/hurd): Likewise, and separate 'loopback' from 'networking'. * gnu/build/hurd-boot.scm (set-hurd-device-translators): Remove "servers/socket/2". * gnu/tests/networking.scm (run-openvswitch-test)["networking has started on ovs0"]: Check for 'networking instead of 'networking-ovs0, which is no longer provided. * doc/guix.texi (Networking Setup): Document the new interface. Remove documentation of 'static-networking-service'. (Virtualization Services): Change Ganeti example to use the new interface. Ludovic Courtès 2021-08-29Migrate to the new 'targets' field of bootloader-configuration....The old 'target' field is deprecated; adjust the sources to use the new 'targets' one instead. * doc/guix-cookbook.texi<target>: Replace by 'targets'. * gnu/bootloader/grub.scm: Likewise. * gnu/installer/parted.scm: Likewise. * gnu/machine/digital-ocean.scm: Likewise. * gnu/system/examples/asus-c201.tmpl: Likewise * gnu/system/examples/bare-bones.tmpl: Likewise * gnu/system/examples/bare-hurd.tmpl: Likewise * gnu/system/examples/beaglebone-black.tmpl: Likewise * gnu/system/examples/desktop.tmpl: Likewise * gnu/system/examples/docker-image.tmpl: Likewise * gnu/system/examples/lightweight-desktop.tmpl: Likewise * gnu/system/examples/vm-image.tmpl: Likewise * gnu/system/examples/yggdrasil.tmpl: Likewise * gnu/system/hurd.scm: Likewise * gnu/system/images/hurd.scm: Likewise * gnu/system/images/novena.scm: Likewise * gnu/system/images/pine64.scm: Likewise * gnu/system/images/pinebook-pro.scm: Likewise * gnu/system/images/rock64.scm: Likewise * gnu/system/install.scm: Likewise * gnu/system/vm.scm: Likewise * gnu/tests.scm: Likewise * gnu/tests/ganeti.scm: Likewise * gnu/tests/install.scm: Likewise * gnu/tests/nfs.scm: Likewise * gnu/tests/telephony.scm: Likewise * tests/boot-parameters.scm: Likewise * tests/system.scm: Likewise Maxim Cournoyer 2021-08-12system: install, hurd: Use 'setuid-programs'....This is a followup to a7ac19851baab3fbcc40c4b2cf5b00a6ac9cd2f3. * gnu/system/install.scm (installation-os)[setuid-programs]: Use 'setuid-program'. * gnu/system/hurd.scm (%setuid-programs/hurd): Use 'file-like->setuid-program'. Ludovic Courtès