diff mbox series

[v5,1/6] libgomp: change alloc-pinned tests failure mode

Message ID 20240612114223.2206735-2-ams@baylibre.com
State New
Headers show
Series libgomp: OpenMP pinned memory for omp_alloc | expand

Commit Message

Andrew Stubbs June 12, 2024, 11:42 a.m. UTC
The feature doesn't work on non-Linux hosts, at present, so skip the tests
entirely.

On Linux systems that have insufficient lockable memory configured we still
need to fail or else the feature won't be getting tested when we think it is,
but now there's a message to explain why.

libgomp/ChangeLog:

	* testsuite/libgomp.c/alloc-pinned-1.c: Change dg-xfail-run-if to
	dg-skip-if.
	Correct spelling mistake.
	Abort on insufficient lockable memory.
	Use #error on non-linux hosts.
	* testsuite/libgomp.c/alloc-pinned-2.c: Likewise.
---
 libgomp/testsuite/libgomp.c/alloc-pinned-1.c | 20 ++++++--------------
 libgomp/testsuite/libgomp.c/alloc-pinned-2.c | 20 ++++++--------------
 2 files changed, 12 insertions(+), 28 deletions(-)

Comments

Tobias Burnus June 12, 2024, 12:40 p.m. UTC | #1
Andrew Stubbs wrote:
> The feature doesn't work on non-Linux hosts, at present, so skip the tests
> entirely.
>
> On Linux systems that have insufficient lockable memory configured we still
> need to fail or else the feature won't be getting tested when we think it is,
> but now there's a message to explain why.
>
> libgomp/ChangeLog:
>
> 	* testsuite/libgomp.c/alloc-pinned-1.c: Change dg-xfail-run-if to
> 	dg-skip-if.
> 	Correct spelling mistake.
> 	Abort on insufficient lockable memory.
> 	Use #error on non-linux hosts.
> 	* testsuite/libgomp.c/alloc-pinned-2.c: Likewise.

LGTM. Thanks!

Tobias
diff mbox series

Patch

diff --git a/libgomp/testsuite/libgomp.c/alloc-pinned-1.c b/libgomp/testsuite/libgomp.c/alloc-pinned-1.c
index 4185accf2e6..672f2453a78 100644
--- a/libgomp/testsuite/libgomp.c/alloc-pinned-1.c
+++ b/libgomp/testsuite/libgomp.c/alloc-pinned-1.c
@@ -1,6 +1,6 @@ 
 /* { dg-do run } */
 
-/* { dg-xfail-run-if "Pinning not implemented on this host" { ! *-*-linux-gnu } } */
+/* { dg-skip-if "Pinning not implemented on this host" { ! *-*-linux-gnu* } } */
 
 /* Test that pinned memory works.  */
 
@@ -19,7 +19,10 @@ 
   struct rlimit limit; \
   if (getrlimit (RLIMIT_MEMLOCK, &limit) \
       || limit.rlim_cur <= SIZE) \
-    fprintf (stderr, "unsufficient lockable memory; please increase ulimit\n"); \
+    { \
+      fprintf (stderr, "insufficient lockable memory; please increase ulimit\n"); \
+      abort (); \
+    } \
   }
 
 int
@@ -44,18 +47,7 @@  get_pinned_mem ()
   abort ();
 }
 #else
-#define PAGE_SIZE 1024 /* unknown */
-#define CHECK_SIZE(SIZE) { \
-  fprintf (stderr, "OS unsupported\n"); \
-  abort (); \
-  }
-#define EXPECT_OMP_NULL_ALLOCATOR
-
-int
-get_pinned_mem ()
-{
-  return 0;
-}
+#error "OS unsupported"
 #endif
 
 static void
diff --git a/libgomp/testsuite/libgomp.c/alloc-pinned-2.c b/libgomp/testsuite/libgomp.c/alloc-pinned-2.c
index 0b9c11d0315..b6d1d83fb6f 100644
--- a/libgomp/testsuite/libgomp.c/alloc-pinned-2.c
+++ b/libgomp/testsuite/libgomp.c/alloc-pinned-2.c
@@ -1,6 +1,6 @@ 
 /* { dg-do run } */
 
-/* { dg-xfail-run-if "Pinning not implemented on this host" { ! *-*-linux-gnu } } */
+/* { dg-skip-if "Pinning not implemented on this host" { ! *-*-linux-gnu* } } */
 
 /* Test that pinned memory works (pool_size code path).  */
 
@@ -19,7 +19,10 @@ 
   struct rlimit limit; \
   if (getrlimit (RLIMIT_MEMLOCK, &limit) \
       || limit.rlim_cur <= SIZE) \
-    fprintf (stderr, "unsufficient lockable memory; please increase ulimit\n"); \
+    { \
+      fprintf (stderr, "insufficient lockable memory; please increase ulimit\n"); \
+      abort (); \
+    } \
   }
 
 int
@@ -44,18 +47,7 @@  get_pinned_mem ()
   abort ();
 }
 #else
-#define PAGE_SIZE 1024 /* unknown */
-#define CHECK_SIZE(SIZE) { \
-  fprintf (stderr, "OS unsupported\n"); \
-  abort (); \
-  }
-#define EXPECT_OMP_NULL_ALLOCATOR
-
-int
-get_pinned_mem ()
-{
-  return 0;
-}
+#error "OS unsupported"
 #endif
 
 static void