From 492f71faebad723f31b763d2bb6b36396913c06bc402a9be932e572736d763af Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 18 Sep 2018 16:00:36 +0000 Subject: [PATCH 1/3] - Switch off falling tests with new patch ignore-tests.patch instead of -k parameter for py.test. https://bitbucket.org/cffi/cffi/issues/384/ OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=48 --- ignore-tests.patch | 46 +++++++++++++++++++++++++++++++++++++++++++ python-cffi-rpmlintrc | 2 +- python-cffi.changes | 7 +++++++ python-cffi.spec | 13 ++++++++---- 4 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 ignore-tests.patch diff --git a/ignore-tests.patch b/ignore-tests.patch new file mode 100644 index 0000000..53152b5 --- /dev/null +++ b/ignore-tests.patch @@ -0,0 +1,46 @@ +--- a/c/test_c.py ++++ b/c/test_c.py +@@ -3908,6 +3908,7 @@ def test_cdata_dir(): + check_dir(pp[0], ['a1', 'a2']) + check_dir(pp[0][0], ['a1', 'a2']) + ++@py.test.mark.skip(reason="Temporarily skipping failing tests") + def test_char_pointer_conversion(): + import warnings + assert __version__.startswith(("1.8", "1.9", "1.10", "1.11")), ( +--- a/testing/cffi0/backend_tests.py ++++ b/testing/cffi0/backend_tests.py +@@ -1381,6 +1381,7 @@ class BackendTests: + assert ffi.getctype("pe") == 'e *' + assert ffi.getctype("e1*") == 'e1 *' + ++ @py.test.mark.skip(reason="Temporarily skipping failing tests") + def test_opaque_enum(self): + import warnings + ffi = FFI(backend=self.Backend()) +@@ -1899,6 +1900,7 @@ class BackendTests: + assert res == 42 + assert seen == [1, 1] + ++ @py.test.mark.skip(reason="Temporarily skipping failing tests") + def test_init_once_multithread(self): + import sys, time + if sys.version_info < (3,): +--- a/testing/cffi1/test_ffi_obj.py ++++ b/testing/cffi1/test_ffi_obj.py +@@ -440,6 +440,7 @@ def test_init_once(): + assert res == 42 + assert seen == [1, 1] + ++@py.test.mark.skip(reason="Temporarily skipping failing tests") + def test_init_once_multithread(): + if sys.version_info < (3,): + import thread +@@ -474,6 +475,7 @@ def test_init_once_failure(): + py.test.raises(ValueError, ffi.init_once, do_init, "tag") + assert seen == [1] * (i + 1) + ++@py.test.mark.skip(reason="Temporarily skipping failing tests") + def test_init_once_multithread_failure(): + if sys.version_info < (3,): + import thread diff --git a/python-cffi-rpmlintrc b/python-cffi-rpmlintrc index c47c742..387960a 100644 --- a/python-cffi-rpmlintrc +++ b/python-cffi-rpmlintrc @@ -1,4 +1,4 @@ # cffi specifically installs C headers in site-packages, so : addFilter("devel-file-in-non-devel-package .*/site-packages/cffi/parse_c_type.h") -addFilter("devel-file-in-non-devel-package .*/site-packages/cffi/_cffi_include.h") +addFilter("devel-file-in-non-devel-package .*/site-packages/cffi/_cffi_(include|errors).h") addFilter("devel-file-in-non-devel-package .*/site-packages/cffi/_embedding.h") diff --git a/python-cffi.changes b/python-cffi.changes index 46fbc12..b42615c 100644 --- a/python-cffi.changes +++ b/python-cffi.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Sep 18 15:51:02 UTC 2018 - Matěj Cepl + +- Switch off falling tests with new patch + ignore-tests.patch instead of -k parameter for py.test. + https://bitbucket.org/cffi/cffi/issues/384/ + ------------------------------------------------------------------- Fri Mar 2 23:14:41 UTC 2018 - arun@gmx.de diff --git a/python-cffi.spec b/python-cffi.spec index b4b94d3..38b23c5 100644 --- a/python-cffi.spec +++ b/python-cffi.spec @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -23,13 +23,16 @@ Release: 0 Summary: Foreign Function Interface for Python calling C code License: MIT Group: Development/Languages/Python -Url: http://cffi.readthedocs.org +URL: http://cffi.readthedocs.org Source0: https://files.pythonhosted.org/packages/source/c/cffi/cffi-%{version}.tar.gz Source1: python-cffi-rpmlintrc +# https://bitbucket.org/cffi/cffi/issues/384/ +Patch0: ignore-tests.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pycparser} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} +BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: pkgconfig BuildRequires: python-rpm-macros @@ -43,6 +46,7 @@ is to provide a convenient and reliable way of calling C code from Python. %prep %setup -q -n cffi-%{version} +%autopatch -p1 %build export CFLAGS="%{optflags}" @@ -50,12 +54,13 @@ export CFLAGS="%{optflags}" %install %python_install +%python_expand %fdupes %{buildroot}%{$python_sitearch} %check -%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} py.test-%$python_bin_suffix -k "not test_init_once_multithread" c/ testing/ +%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} py.test-%$python_bin_suffix -W ignore::UserWarning c/ testing/ %files %{python_files} -%doc LICENSE +%license LICENSE %{python_sitearch}/* %changelog From 78a65200eabd3c798a63473bcb157324ef790102417133c92e51899e393f6487 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 19 Sep 2018 18:44:24 +0000 Subject: [PATCH 2/3] - Remove ignore-tests.patch -- testing what will happen - Add e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch from upstream to remove some warnings. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=49 --- ...24a2f13e3a646de6f6ff03e90ed7d37e2636.patch | 32 +++++++++++++ ignore-tests.patch | 46 ------------------- python-cffi.changes | 7 +++ python-cffi.spec | 2 +- 4 files changed, 40 insertions(+), 47 deletions(-) create mode 100644 e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch delete mode 100644 ignore-tests.patch diff --git a/e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch b/e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch new file mode 100644 index 0000000..76097bd --- /dev/null +++ b/e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch @@ -0,0 +1,32 @@ +# HG changeset patch +# User Armin Rigo +# Date 1537369554 -7200 +# Node ID e2e324a2f13e3a646de6f6ff03e90ed7d37e2636 +# Parent 8076f2ac1bd2b68b7015fb1fb936bd6907946756 +Issue #384 + +Un-ignore the warnings when testing for them, in case someone runs +py.test with the PYTHONWARNINGS environment variable set + +diff --git a/c/test_c.py b/c/test_c.py +--- a/c/test_c.py ++++ b/c/test_c.py +@@ -3968,6 +3968,7 @@ + z3 = cast(BVoidP, 0) + z4 = cast(BUCharP, 0) + with warnings.catch_warnings(record=True) as w: ++ warnings.simplefilter("always") + newp(new_pointer_type(BIntP), z1) # warn + assert len(w) == 1 + newp(new_pointer_type(BVoidP), z1) # fine +diff --git a/testing/cffi0/backend_tests.py b/testing/cffi0/backend_tests.py +--- a/testing/cffi0/backend_tests.py ++++ b/testing/cffi0/backend_tests.py +@@ -1386,6 +1386,7 @@ + ffi = FFI(backend=self.Backend()) + ffi.cdef("enum foo;") + with warnings.catch_warnings(record=True) as log: ++ warnings.simplefilter("always") + n = ffi.cast("enum foo", -1) + assert int(n) == 0xffffffff + assert str(log[0].message) == ( diff --git a/ignore-tests.patch b/ignore-tests.patch deleted file mode 100644 index 53152b5..0000000 --- a/ignore-tests.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- a/c/test_c.py -+++ b/c/test_c.py -@@ -3908,6 +3908,7 @@ def test_cdata_dir(): - check_dir(pp[0], ['a1', 'a2']) - check_dir(pp[0][0], ['a1', 'a2']) - -+@py.test.mark.skip(reason="Temporarily skipping failing tests") - def test_char_pointer_conversion(): - import warnings - assert __version__.startswith(("1.8", "1.9", "1.10", "1.11")), ( ---- a/testing/cffi0/backend_tests.py -+++ b/testing/cffi0/backend_tests.py -@@ -1381,6 +1381,7 @@ class BackendTests: - assert ffi.getctype("pe") == 'e *' - assert ffi.getctype("e1*") == 'e1 *' - -+ @py.test.mark.skip(reason="Temporarily skipping failing tests") - def test_opaque_enum(self): - import warnings - ffi = FFI(backend=self.Backend()) -@@ -1899,6 +1900,7 @@ class BackendTests: - assert res == 42 - assert seen == [1, 1] - -+ @py.test.mark.skip(reason="Temporarily skipping failing tests") - def test_init_once_multithread(self): - import sys, time - if sys.version_info < (3,): ---- a/testing/cffi1/test_ffi_obj.py -+++ b/testing/cffi1/test_ffi_obj.py -@@ -440,6 +440,7 @@ def test_init_once(): - assert res == 42 - assert seen == [1, 1] - -+@py.test.mark.skip(reason="Temporarily skipping failing tests") - def test_init_once_multithread(): - if sys.version_info < (3,): - import thread -@@ -474,6 +475,7 @@ def test_init_once_failure(): - py.test.raises(ValueError, ffi.init_once, do_init, "tag") - assert seen == [1] * (i + 1) - -+@py.test.mark.skip(reason="Temporarily skipping failing tests") - def test_init_once_multithread_failure(): - if sys.version_info < (3,): - import thread diff --git a/python-cffi.changes b/python-cffi.changes index b42615c..c972f4b 100644 --- a/python-cffi.changes +++ b/python-cffi.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Sep 19 20:43:08 CEST 2018 - mcepl@suse.com + +- Remove ignore-tests.patch -- testing what will happen +- Add e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch from + upstream to remove some warnings. + ------------------------------------------------------------------- Tue Sep 18 15:51:02 UTC 2018 - Matěj Cepl diff --git a/python-cffi.spec b/python-cffi.spec index 38b23c5..a1895aa 100644 --- a/python-cffi.spec +++ b/python-cffi.spec @@ -27,7 +27,7 @@ URL: http://cffi.readthedocs.org Source0: https://files.pythonhosted.org/packages/source/c/cffi/cffi-%{version}.tar.gz Source1: python-cffi-rpmlintrc # https://bitbucket.org/cffi/cffi/issues/384/ -Patch0: ignore-tests.patch +Patch0: e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pycparser} BuildRequires: %{python_module pytest} From 85c14cfd927c212125f8cca9bfc46245ea532ae516ad25a12d2b07d74abc45cc Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 21 Sep 2018 05:26:36 +0000 Subject: [PATCH 3/3] - Add 3184b0a675fc425b821b528d7fdf744b2f08dadf.patch as a workardond against https://bitbucket.org/cffi/cffi/issues/378/ (possible bug in GCC, see https://bugzilla.redhat.com/1552724). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=50 --- ...b0a675fc425b821b528d7fdf744b2f08dadf.patch | 46 +++++++++++++++++++ python-cffi.changes | 8 ++++ python-cffi.spec | 2 + 3 files changed, 56 insertions(+) create mode 100644 3184b0a675fc425b821b528d7fdf744b2f08dadf.patch diff --git a/3184b0a675fc425b821b528d7fdf744b2f08dadf.patch b/3184b0a675fc425b821b528d7fdf744b2f08dadf.patch new file mode 100644 index 0000000..8fb8c07 --- /dev/null +++ b/3184b0a675fc425b821b528d7fdf744b2f08dadf.patch @@ -0,0 +1,46 @@ +# HG changeset patch +# User Armin Rigo +# Date 1536839482 -7200 +# Node ID 3184b0a675fc425b821b528d7fdf744b2f08dadf +# Parent 97a61f7b0bcd48eb74f136280ffd8733e829f153 +Issue 378 + +Workaround for a GCC bug + +diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c +--- a/c/_cffi_backend.c ++++ b/c/_cffi_backend.c +@@ -892,11 +892,21 @@ + return 0; + } + ++#ifdef __GNUC__ ++/* This is a workaround for what I think is a GCC bug on several ++ platforms. See issue #378. */ ++__attribute__((noinline)) ++#endif ++void _cffi_memcpy(char *target, const void *src, size_t size) ++{ ++ memcpy(target, src, size); ++} ++ + #define _write_raw_data(type) \ + do { \ + if (size == sizeof(type)) { \ + type r = (type)source; \ +- memcpy(target, &r, sizeof(type)); \ ++ _cffi_memcpy(target, &r, sizeof(type)); \ + return; \ + } \ + } while(0) +@@ -970,8 +980,8 @@ + if (size == 2*sizeof(type)) { \ + type r = (type)source.real; \ + type i = (type)source.imag; \ +- memcpy(target, &r, sizeof(type)); \ +- memcpy(target+sizeof(type), &i, sizeof(type)); \ ++ _cffi_memcpy(target, &r, sizeof(type)); \ ++ _cffi_memcpy(target+sizeof(type), &i, sizeof(type)); \ + return; \ + } \ + } while(0) diff --git a/python-cffi.changes b/python-cffi.changes index c972f4b..73c0c1d 100644 --- a/python-cffi.changes +++ b/python-cffi.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Sep 21 07:24:58 CEST 2018 - mcepl@suse.com + +- Add 3184b0a675fc425b821b528d7fdf744b2f08dadf.patch as + a workardond against + https://bitbucket.org/cffi/cffi/issues/378/ (possible bug in + GCC, see https://bugzilla.redhat.com/1552724). + ------------------------------------------------------------------- Wed Sep 19 20:43:08 CEST 2018 - mcepl@suse.com diff --git a/python-cffi.spec b/python-cffi.spec index a1895aa..626e2b0 100644 --- a/python-cffi.spec +++ b/python-cffi.spec @@ -28,6 +28,8 @@ Source0: https://files.pythonhosted.org/packages/source/c/cffi/cffi-%{ver Source1: python-cffi-rpmlintrc # https://bitbucket.org/cffi/cffi/issues/384/ Patch0: e2e324a2f13e3a646de6f6ff03e90ed7d37e2636.patch +# https://bitbucket.org/cffi/cffi/issues/378 +Patch1: 3184b0a675fc425b821b528d7fdf744b2f08dadf.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pycparser} BuildRequires: %{python_module pytest}