1
0

Accepting request 766150 from devel:languages:python:numeric

OBS-URL: https://build.opensuse.org/request/show/766150
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python3-espressomd?expand=0&rev=6
This commit is contained in:
Dominique Leuenberger 2020-01-22 21:44:55 +00:00 committed by Git OBS Bridge
commit 0f4a260ee6
3 changed files with 106 additions and 5 deletions

96
3427.patch Normal file
View File

@ -0,0 +1,96 @@
From 540b6f0f5f59bd8257f09b750281dc7ddd9533c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= <jgrad@icp.uni-stuttgart.de>
Date: Tue, 21 Jan 2020 15:39:10 +0100
Subject: [PATCH] Fix BOOST_CHECK_CLOSE assertions
`BOOST_*_CLOSE` assertions take a tolerance as a percentage.
When using machine epsilon, it needs to be multiplied by 100.
---
src/core/unit_tests/grid_test.cpp | 17 ++++++++++-------
src/utils/tests/int_pow_test.cpp | 4 ++--
src/utils/tests/interpolation_test.cpp | 2 +-
src/utils/tests/matrix_vector_product.cpp | 2 +-
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/core/unit_tests/grid_test.cpp b/src/core/unit_tests/grid_test.cpp
index 3b926bf8c8..310b416f80 100644
--- a/src/core/unit_tests/grid_test.cpp
+++ b/src/core/unit_tests/grid_test.cpp
@@ -170,9 +170,9 @@ BOOST_AUTO_TEST_CASE(regular_decomposition_test) {
auto const result = regular_decomposition(box, {0, 0, 0}, node_grid);
auto const local_box_l = result.length();
- BOOST_CHECK_CLOSE(box_l[0], local_box_l[0] * node_grid[0], eps);
- BOOST_CHECK_CLOSE(box_l[1], local_box_l[1] * node_grid[1], eps);
- BOOST_CHECK_CLOSE(box_l[2], local_box_l[2] * node_grid[2], eps);
+ BOOST_CHECK_CLOSE(box_l[0], local_box_l[0] * node_grid[0], 100. * eps);
+ BOOST_CHECK_CLOSE(box_l[1], local_box_l[1] * node_grid[1], 100. * eps);
+ BOOST_CHECK_CLOSE(box_l[2], local_box_l[2] * node_grid[2], 100. * eps);
}
/* check corners */
@@ -185,9 +185,12 @@ BOOST_AUTO_TEST_CASE(regular_decomposition_test) {
auto const local_box_l = result.length();
auto const lower_corner = result.my_left();
- BOOST_CHECK_CLOSE(lower_corner[0], local_box_l[0] * node_pos[0], eps);
- BOOST_CHECK_CLOSE(lower_corner[1], local_box_l[1] * node_pos[1], eps);
- BOOST_CHECK_CLOSE(lower_corner[2], local_box_l[2] * node_pos[2], eps);
+ BOOST_CHECK_CLOSE(lower_corner[0], local_box_l[0] * node_pos[0],
+ 100. * eps);
+ BOOST_CHECK_CLOSE(lower_corner[1], local_box_l[1] * node_pos[1],
+ 100. * eps);
+ BOOST_CHECK_CLOSE(lower_corner[2], local_box_l[2] * node_pos[2],
+ 100. * eps);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/utils/tests/int_pow_test.cpp b/src/utils/tests/int_pow_test.cpp
index 072aabfff3..74610052d9 100644
--- a/src/utils/tests/int_pow_test.cpp
+++ b/src/utils/tests/int_pow_test.cpp
@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(even) {
const double x = 3.14159;
BOOST_CHECK(1 == int_pow<0>(x));
- BOOST_CHECK_CLOSE(x * x, int_pow<2>(x), eps);
+ BOOST_CHECK_CLOSE(x * x, int_pow<2>(x), 100. * eps);
BOOST_CHECK_CLOSE((x * x) * (x * x), int_pow<4>(x), 100. * eps);
}
@@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE(odd) {
const double x = 3.14159;
BOOST_CHECK(x == int_pow<1>(x));
- BOOST_CHECK_CLOSE((x * x) * x, int_pow<3>(x), eps);
+ BOOST_CHECK_CLOSE((x * x) * x, int_pow<3>(x), 100. * eps);
BOOST_CHECK_CLOSE((x * x) * (x * x) * x, int_pow<5>(x), 100. * eps);
}
diff --git a/src/utils/tests/interpolation_test.cpp b/src/utils/tests/interpolation_test.cpp
index 59a351e723..50b4b164b6 100644
--- a/src/utils/tests/interpolation_test.cpp
+++ b/src/utils/tests/interpolation_test.cpp
@@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE(nearest_point) {
bspline_3d<1>({.1, .2, .3}, save_ind, {0.5, 0.5, 0.5}, {});
BOOST_CHECK((std::array<int, 3>{{0, 0, 1}} == nmp));
- BOOST_CHECK_CLOSE(weight, 1., std::numeric_limits<double>::epsilon());
+ BOOST_CHECK_CLOSE(weight, 1., 100. * std::numeric_limits<double>::epsilon());
}
BOOST_AUTO_TEST_CASE(interpolation_points_3) {
diff --git a/src/utils/tests/matrix_vector_product.cpp b/src/utils/tests/matrix_vector_product.cpp
index fb015bb6c5..f3e560620d 100644
--- a/src/utils/tests/matrix_vector_product.cpp
+++ b/src/utils/tests/matrix_vector_product.cpp
@@ -34,6 +34,6 @@ BOOST_AUTO_TEST_CASE(inner_product) {
auto const result = Utils::matrix_vector_product<double, 3, matrix>(vector);
for (int i = 0; i < 3; ++i) {
BOOST_CHECK_CLOSE(result[i], boost::inner_product(matrix[i], vector, 0.0),
- std::numeric_limits<double>::epsilon());
+ 100. * std::numeric_limits<double>::epsilon());
}
}

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jan 21 13:26:55 UTC 2020 - Christoph Junghans <junghans@votca.org>
- add 3427.patch to fix tests on i586
-------------------------------------------------------------------
Wed Jan 15 23:35:14 CET 2020 - Matej Cepl <mcepl@suse.com>

View File

@ -42,6 +42,8 @@ License: GPL-3.0-or-later
Group: Productivity/Scientific/Chemistry
URL: http://espressomd.org
Source: https://github.com/%{modname}/%{pkgname}/releases/download/%{version}/%{pkgname}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM 3427.patch - fix test on 586 - https://github.com/espressomd/espresso/pull/3427
Patch0: 3427.patch
BuildRequires: cmake
BuildRequires: fftw3-devel
BuildRequires: gcc-c++
@ -72,6 +74,7 @@ systems, for example DNA and lipid membranes.
%prep
%setup -q -n %{pkgname}
%patch0 -p1
%build
source %{_libdir}/mpi/gcc/%{mpiver}/bin/mpivars.sh
@ -90,16 +93,13 @@ source %{_libdir}/mpi/gcc/%{mpiver}/bin/mpivars.sh
%install
%cmake_install
#fix some permissions
find %{buildroot}%{_prefix} -name "*.so" -exec chmod +x {} \;
find %{buildroot}%{_prefix} -name "gen_pxiconfig" -exec chmod +x {} \;
# no devel package
rm -f %{buildroot}%{_libdir}/lib*.so
%check
# https://github.com/espressomd/espresso/issues/3315 & gh#espressomd/espresso#3396
# https://github.com/espressomd/espresso/issues/3315
%ifarch i586
%define testargs ARGS='-E \\(matrix_vector_product\\|collision_detection\\)'
%define testargs ARGS='-E collision_detection'
%endif
LD_LIBRARY_PATH='%{buildroot}/%{python3_sitearch}/espressomd::%{_libdir}/mpi/gcc/%{mpiver}/%{_lib}' make -C build check CTEST_OUTPUT_ON_FAILURE=1 %{?testargs:%{testargs}}