From b867317fc626b28680c3b68259364dff3b07d68b7da7eea7bc3a0bb49b6f1e6f Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 7 Oct 2021 13:01:42 +0000 Subject: [PATCH] - Add patch skip-BE-tests.patch skipping failing tests again (gh#kbandla/dpkt#505). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dpkt?expand=0&rev=24 --- python-dpkt.changes | 3 ++- python-dpkt.spec | 10 +++---- skip-BE-tests.patch | 63 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 skip-BE-tests.patch diff --git a/python-dpkt.changes b/python-dpkt.changes index 43acd6d..9d5c50c 100644 --- a/python-dpkt.changes +++ b/python-dpkt.changes @@ -56,7 +56,8 @@ Thu Oct 7 10:42:16 UTC 2021 - Matej Cepl - Remove redundant num_compression_methods from TLSClientHello - Testing improved from 90% coverage to over 99%. - Remove upstreamed patch fix_s390x_tests.patch -- Skip failing tests again (gh#kbandla/dpkt#505). +- Add patch skip-BE-tests.patch skipping failing tests again + (gh#kbandla/dpkt#505). ------------------------------------------------------------------- Sun Jan 3 16:55:41 UTC 2021 - Matej Cepl diff --git a/python-dpkt.spec b/python-dpkt.spec index a1c0872..3e0f979 100644 --- a/python-dpkt.spec +++ b/python-dpkt.spec @@ -25,6 +25,9 @@ License: BSD-3-Clause Group: Development/Libraries/Python URL: https://github.com/kbandla/dpkt Source: https://github.com/kbandla/dpkt/archive/v%{version}.tar.gz +# PATCH-FIX-UPSTREAM skip-BE-tests.patch gh#kbandla/dpkt#505 mcepl@suse.com +# Skip tests failing on BE architectures +Patch0: skip-BE-tests.patch BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -51,12 +54,7 @@ sed -i -e '/addopts=/d' setup.cfg %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -# Skipped because of gh#kbandla/dpkt#505 -export SKIPTESTS="" -%ifarch s390x ppc64 -export SKIPTESTS="not (test_ethernet_unpack or test_ethernet_unpack or test_writepkt_epb_ts or test_custom_read_write or test_multi_idb_writer)" -%endif -%pytest -k "${SKIPTESTS}" dpkt +%pytest dpkt %files %{python_files} %license LICENSE diff --git a/skip-BE-tests.patch b/skip-BE-tests.patch new file mode 100644 index 0000000..83b38da --- /dev/null +++ b/skip-BE-tests.patch @@ -0,0 +1,63 @@ +--- + dpkt/loopback.py | 5 +++++ + dpkt/pcapng.py | 7 +++++++ + 2 files changed, 12 insertions(+) + +--- a/dpkt/loopback.py ++++ b/dpkt/loopback.py +@@ -3,6 +3,9 @@ + """Platform-dependent loopback header.""" + from __future__ import absolute_import + ++import sys ++from unittest import SkipTest ++ + from . import dpkt + from . import ethernet + from . import ip +@@ -39,6 +42,8 @@ class Loopback(dpkt.Packet): + + + def test_ethernet_unpack(): ++ if sys.byteorder == 'big': ++ raise SkipTest('This test is known to fail on big endian processors. gh#kbandla/dpkt#505') + buf = b'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x08\x00' + hdr = b'\x00\x02\x00\x02' + +--- a/dpkt/pcapng.py ++++ b/dpkt/pcapng.py +@@ -9,6 +9,7 @@ from __future__ import absolute_import + from struct import pack as struct_pack, unpack as struct_unpack + from time import time + import sys ++from unittest import SkipTest + + from . import dpkt + from .compat import BytesIO, intround +@@ -1118,6 +1119,8 @@ def test_idb_opt_err(): + + def test_custom_read_write(): + """Test a full pcapng file with 1 ICMP packet""" ++ if sys.byteorder == 'big': ++ raise SkipTest('This test is known to fail on big endian processors. gh#kbandla/dpkt#505') + buf = define_testdata().valid_pcapng + fobj = BytesIO(buf) + +@@ -1162,6 +1165,8 @@ def test_custom_read_write(): + + def test_multi_idb_writer(): + """Test writing multiple interface description blocks into pcapng and read it""" ++ if sys.byteorder == 'big': ++ raise SkipTest('This test is known to fail on big endian processors. gh#kbandla/dpkt#505') + fobj = BytesIO() + shb, idb, epb = define_testdata().shb_idb_epb_le + +@@ -1189,6 +1194,8 @@ def test_writer_validate_instance(): + @pre_test + def test_writepkt_epb_ts(): + """writepkt should assign ts_high/low for epb if they are 0""" ++ if sys.byteorder == 'big': ++ raise SkipTest('This test is known to fail on big endian processors. gh#kbandla/dpkt#505') + global time + shb, idb, epb = define_testdata().shb_idb_epb_le + writer = Writer(fobj, shb=shb, idb=idb) # noqa