From 311551ec9f9dedce5cfb6485b203635ce96c0b1243824ee977602cd3c79f1c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 7 Sep 2020 12:27:41 +0000 Subject: [PATCH] Accepting request 832752 from home:michals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixing arch-dependent test failures (bsc#1176085): * renamed failing-on-i586.patch to memory_failure_early_kill.patch * and modified it to skip the test also on s390x * added bigendian.patch * added powerpc.patch * huge thanks to Michal Suchánek OBS-URL: https://build.opensuse.org/request/show/832752 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-prctl?expand=0&rev=5 --- bigendian.patch | 27 +++++++ ...6.patch => memory_failure_early_kill.patch | 2 +- powerpc.patch | 79 +++++++++++++++++++ python-python-prctl.changes | 10 +++ python-python-prctl.spec | 7 +- 5 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 bigendian.patch rename failing-on-i586.patch => memory_failure_early_kill.patch (82%) create mode 100644 powerpc.patch diff --git a/bigendian.patch b/bigendian.patch new file mode 100644 index 0000000..d21da50 --- /dev/null +++ b/bigendian.patch @@ -0,0 +1,27 @@ +Index: python-prctl-1.7/_prctlmodule.c +=================================================================== +--- python-prctl-1.7.orig/_prctlmodule.c ++++ python-prctl-1.7/_prctlmodule.c +@@ -50,6 +50,7 @@ prctl_prctl(PyObject *self, PyObject *ar + { + long option = 0; + long arg = 0; ++ int intarg = 0; + char *argstr = NULL; + char name[17] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + int result; +@@ -286,12 +287,12 @@ prctl_prctl(PyObject *self, PyObject *ar + #ifdef PR_GET_TID_ADDRESS + case(PR_GET_TID_ADDRESS): + #endif +- result = prctl(option, &arg, 0, 0, 0); ++ result = prctl(option, &intarg, 0, 0, 0); + if(result < 0) { + PyErr_SetFromErrno(PyExc_OSError); + return NULL; + } +- return PyInt_FromLong(arg); ++ return PyInt_FromLong(intarg); + case(PR_SET_NAME): + case(PR_GET_NAME): + result = prctl(option, name, 0, 0, 0); diff --git a/failing-on-i586.patch b/memory_failure_early_kill.patch similarity index 82% rename from failing-on-i586.patch rename to memory_failure_early_kill.patch index d47447b..2c37ece 100644 --- a/failing-on-i586.patch +++ b/memory_failure_early_kill.patch @@ -6,7 +6,7 @@ Index: python-prctl-1.7/test_prctl.py self.assertEqual(prctl.get_keepcaps(), False) @require('set_mce_kill') -+ @unittest.skipIf(sys.maxsize <= 2**32, 'fails on 32 bit') ++ @unittest.skipIf(sys.maxsize <= 2**32 or arch == 's390x', 'no such file on this architecture') def test_mce_kill(self): """Test the MCE_KILL setting""" fd = open('/proc/sys/vm/memory_failure_early_kill') diff --git a/powerpc.patch b/powerpc.patch new file mode 100644 index 0000000..d5ea4b7 --- /dev/null +++ b/powerpc.patch @@ -0,0 +1,79 @@ +diff -ur python-prctl-1.7.orig/test_prctl.py python-prctl-1.7/test_prctl.py +--- python-prctl-1.7.orig/test_prctl.py 2020-09-07 11:09:38.544700725 +0200 ++++ python-prctl-1.7/test_prctl.py 2020-09-07 12:28:11.482301401 +0200 +@@ -44,6 +44,8 @@ + class PrctlTest(unittest.TestCase): + # There are architecture specific tests + arch = os.uname()[4] ++ if arch == 'ppc' or arch == 'ppc64' or arch == 'ppc64le': ++ arch = 'powerpc' + # prctl behaviour differs when root, so you should test as root and non-root + am_root = os.geteuid() == 0 + +@@ -110,6 +112,7 @@ + self.assertEqual(prctl.get_dumpable(), False) + self.assertRaises(TypeError, prctl.get_dumpable, "42") + ++ @unittest.skip('cannot change endianness of running python interpreter') + def test_endian(self): + """Test manipulation of the endianness setting""" + if self.arch == 'powerpc': +@@ -136,13 +139,55 @@ + self.assertRaises(OSError, prctl.get_fpemu) + self.assertRaises(OSError, prctl.set_fpemu, prctl.FPEMU_SIGFPE) + ++# define PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */ ++# define PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */ ++# define PR_FP_EXC_OVF 0x020000 /* floating point overflow */ ++# define PR_FP_EXC_UND 0x040000 /* floating point underflow */ ++# define PR_FP_EXC_RES 0x080000 /* floating point inexact result */ ++# define PR_FP_EXC_INV 0x100000 /* floating point invalid operation */ ++# define PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */ ++# define PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */ ++# define PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */ ++# define PR_FP_EXC_PRECISE 3 /* precise exception mode */ ++ def print_fpexc(self, fpexc): ++ if fpexc == 0: ++ print("PR_FP_EXC_DISABLED") ++ else: ++ if fpexc & 3 == _prctl.PR_FP_EXC_ASYNC: ++ print('PR_FP_EXC_ASYNC') ++ if fpexc & 3 == _prctl.PR_FP_EXC_NONRECOV: ++ print('PR_FP_EXC_NONRECOV') ++ if fpexc & 3 == _prctl.PR_FP_EXC_PRECISE: ++ print('PR_FP_EXC_PRECISE') ++ if fpexc & prctl.PR_FP_EXC_SW_ENABLE: ++ print('PR_FP_EXC_SW_ENABLE') ++ if fpexc & _prctl.PR_FP_EXC_DIV: ++ print('PR_FP_EXC_DIV') ++ if fpexc & _prctl.PR_FP_EXC_OVF: ++ print('PR_FP_EXC_OVF') ++ if fpexc & _prctl.PR_FP_EXC_UND: ++ print('PR_FP_EXC_UND') ++ if fpexc & _prctl.PR_FP_EXC_RES: ++ print('PR_FP_EXC_RES') ++ if fpexc & _prctl.PR_FP_EXC_INV: ++ print('PR_FP_EXC_INV') ++ print('\n'); ++ + def test_fpexc(self): + """Test manipulation of the fpexc setting""" + if self.arch == 'powerpc': +- # FIXME - untested +- prctl.set_fpexc(prctl.FP_EXC_SW_ENABLE) +- self.assertEqual(prctl.get_fpexc() & prctl.PR_FP_EXC_SW_ENABLE, prctl.PR_FP_EXC_SW_ENABLE) ++ fpexc = prctl.get_fpexc() ++ self.print_fpexc(fpexc) ++ # Did not find a sane combination of flags that is supported. ++ self.assertRaises(OSError, prctl.set_fpexc, ++ prctl.FP_EXC_SW_ENABLE | _prctl.PR_FP_EXC_ASYNC | _prctl.PR_FP_EXC_DIV | _prctl.PR_FP_EXC_INV) ++ self.print_fpexc(prctl.get_fpexc()) ++ self.assertEqual(prctl.get_fpexc(), fpexc) ++ prctl.set_fpexc(_prctl.PR_FP_EXC_DISABLED) ++ self.print_fpexc(prctl.get_fpexc()) ++ self.assertEqual(prctl.get_fpexc(), _prctl.PR_FP_EXC_DISABLED) + self.assertRaises(ValueError, prctl.set_fpexc, 999) ++ prctl.set_fpexc(fpexc) + else: + self.assertRaises(OSError, prctl.get_fpexc) + self.assertRaises(OSError, prctl.set_fpexc) diff --git a/python-python-prctl.changes b/python-python-prctl.changes index 1922c0e..d98d348 100644 --- a/python-python-prctl.changes +++ b/python-python-prctl.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Fri Sep 4 13:48:25 UTC 2020 - Marketa Calabkova + +- Fixing arch-dependent test failures (bsc#1176085): + * renamed failing-on-i586.patch to memory_failure_early_kill.patch + * and modified it to skip the test also on s390x + * added bigendian.patch + * added powerpc.patch + * huge thanks to Michal Suchánek + ------------------------------------------------------------------- Wed Aug 19 07:46:50 UTC 2020 - Marketa Calabkova diff --git a/python-python-prctl.spec b/python-python-prctl.spec index effbff3..0f2aea2 100644 --- a/python-python-prctl.spec +++ b/python-python-prctl.spec @@ -26,7 +26,9 @@ URL: https://github.com/seveas/python-prctl Source: https://files.pythonhosted.org/packages/source/p/python-prctl/python-prctl-%{version}.tar.gz Source99: https://raw.githubusercontent.com/seveas/python-prctl/master/COPYING Patch0: disable-sandboxed-test.patch -Patch1: failing-on-i586.patch +Patch1: memory_failure_early_kill.patch +Patch2: bigendian.patch +Patch3: powerpc.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -48,8 +50,7 @@ and allows you to set the process name as seen in ps and top. %prep %setup -q -n python-prctl-%{version} -%patch0 -p1 -%patch1 -p1 +%autopatch -p1 cp %{SOURCE99} . %build