From a3f846b41c91293adad83758e84fef485ad3b6e5 Mon Sep 17 00:00:00 2001
From: Lisandro Dalcin <dalcinl@gmail.com>
Date: Tue, 23 Sep 2025 22:54:50 +0300
Subject: [PATCH] test: Handle know failures on Debian

Co-authored-by: Drew Parsons <dparsons@debian.org>
---
 test/test_datatype.py  | 10 ++++++++++
 test/test_environ.py   |  1 +
 test/test_pack.py      |  1 +
 test/test_spawn.py     |  4 +++-
 test/test_util_pool.py | 10 ++++++++++
 5 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/test/test_datatype.py b/test/test_datatype.py
index 404b924c..60372492 100644
--- a/test/test_datatype.py
+++ b/test/test_datatype.py
@@ -1,3 +1,4 @@
+import platform
 import struct
 
 import mpitestutil as testutil
@@ -95,6 +96,8 @@
 
 combiner_map = {}
 
+machine = platform.machine()
+
 
 class TestDatatypeNull(unittest.TestCase):
     #
@@ -224,6 +227,8 @@ def testCommit(self):
         for dtype in datatypes:
             dtype.Commit()
 
+    @unittest.skipMPI("mpich(<4.2.3)", machine.startswith("ppc"))
+    @unittest.skipMPI("openmpi(<6.0.0)", machine in {"ppc", "ppc64"})
     def testCodeCharStr(self):
         f90datatypes = []
         try:
@@ -282,6 +287,7 @@ def testCodeCharStr(self):
         self.assertEqual(MPI.INT_INT.typechar, "V")
         self.assertEqual(MPI.INT_INT.typestr, f"V{MPI.INT.extent * 2}")
 
+    @unittest.skipMPI("mpich", struct.calcsize("P") == 4)
     def testContiguousBigMPI(self):
         int_max = (1 << (struct.calcsize("i") * 8 - 1)) - 1
         mpitype = MPI.BYTE.Create_contiguous(int_max)
@@ -563,6 +569,8 @@ def testF90RealSingle(self):
         args = (p, r)
         self.check(None, factory, *args)
 
+    @unittest.skipMPI("mpich(<4.2.3)", machine.startswith("ppc"))
+    @unittest.skipMPI("openmpi(<6.0.0)", machine in {"ppc", "ppc64"})
     @unittest.skipMPI("openmpi(<3.0.0)")
     @unittest.skipMPI("msmpi")
     def testF90RealDouble(self):
@@ -579,6 +587,8 @@ def testF90ComplexSingle(self):
         args = (p, r)
         self.check(None, factory, *args)
 
+    @unittest.skipMPI("mpich(<4.2.3)", machine.startswith("ppc"))
+    @unittest.skipMPI("openmpi(<6.0.0)", machine in {"ppc", "ppc64"})
     @unittest.skipMPI("openmpi(<3.0.0)")
     @unittest.skipMPI("msmpi")
     def testF90ComplexDouble(self):
diff --git a/test/test_environ.py b/test/test_environ.py
index 18b0a8b9..b4d24f95 100644
--- a/test/test_environ.py
+++ b/test/test_environ.py
@@ -81,6 +81,7 @@ def testAppNum(self):
         if appnum is not None:
             self.assertTrue(appnum == MPI.UNDEFINED or appnum >= 0)
 
+    @unittest.skipMPI("mpich(==4.3.1)", not testutil.has_mpi_appnum())
     @unittest.skipMPI("mpich(<4.1.0)", not testutil.has_mpi_appnum())
     @unittest.skipMPI("mvapich", not testutil.has_mpi_appnum())
     @unittest.skipMPI("MPICH2", not testutil.has_mpi_appnum())
diff --git a/test/test_pack.py b/test/test_pack.py
index 38a84bf5..ca084892 100644
--- a/test/test_pack.py
+++ b/test/test_pack.py
@@ -113,6 +113,7 @@ def testPackSize(self):
                         real_size = pack_size - overhead
                         self.assertGreaterEqual(real_size, 0)
 
+    @unittest.skipMPI("openmpi(<5.0.0)", platform.machine() == "sparc64")
     def testPackUnpackExternal(self):
         for array, typecode1 in arrayimpl.loop():
             with arrayimpl.test(self):
diff --git a/test/test_spawn.py b/test/test_spawn.py
index a4e2e593..dda77b11 100644
--- a/test/test_spawn.py
+++ b/test/test_spawn.py
@@ -1,5 +1,6 @@
 import os
 import pathlib
+import platform
 import sys
 import tempfile
 import textwrap
@@ -87,8 +88,9 @@ def testErrcodes(self):
         for errcode in errcodes:
             self.assertEqual(errcode, MPI.SUCCESS)
 
-    @unittest.skipMPI("msmpi")
+    @unittest.skipMPI("mpich(<5.0.0)", platform.machine() == "ppc")
     @unittest.skipMPI("mpich(==3.4.1)")
+    @unittest.skipMPI("msmpi")
     def testArgsOnlyAtRoot(self):
         self.COMM.Barrier()
         if self.COMM.Get_rank() == self.ROOT:
diff --git a/test/test_util_pool.py b/test/test_util_pool.py
index ad7fde9b..a6b95872 100644
--- a/test/test_util_pool.py
+++ b/test/test_util_pool.py
@@ -3,6 +3,7 @@
 import itertools
 import os
 import pathlib
+import platform
 import sys
 import time
 import unittest
@@ -18,6 +19,9 @@
     import mpitestutil as testutil
 
 
+mpi_vendor_name, mpi_vendor_version = MPI.get_vendor()
+
+
 def sqr(x, wait=0.0):
     time.sleep(wait)
     return x * x
@@ -76,6 +80,12 @@ def tearDownClass(cls):
         cls.pool = None
         super().tearDownClass()
 
+    @unittest.skipIf(
+        mpi_vendor_name == "Open MPI"
+        and mpi_vendor_version < (5, 0, 0)
+        and platform.machine() == "s390x",
+        "openmpi(<5.0.0)-s390x",
+    )
     def test_apply(self):
         papply = self.pool.apply
         self.assertEqual(papply(sqr, (5,)), sqr(5))
