]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp: Don't test ompx::allocator::gnu_pinned_mem on non-linux targets.
authorJakub Jelinek <jakub@redhat.com>
Thu, 17 Apr 2025 10:14:15 +0000 (12:14 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 17 Apr 2025 10:14:15 +0000 (12:14 +0200)
The libgomp.c/alloc-pinned*.c test have
/* { dg-skip-if "Pinning not implemented on this host" { ! *-*-linux-gnu* } } */
so they are only run on Linux targets right now.  Duplicating the tests or
reworking them into headers looked like too much work for me right now this
late in stage4, so I've just #ifdefed the uses at least for now.

2025-04-17  Jakub Jelinek  <jakub@redhat.com>

PR libgomp/119849
* testsuite/libgomp.c++/allocator-1.C (test_inequality, main): Guard
ompx::allocator::gnu_pinned_mem uses with #ifdef __gnu_linux__.
* testsuite/libgomp.c++/allocator-2.C (main): Likewise.

libgomp/testsuite/libgomp.c++/allocator-1.C
libgomp/testsuite/libgomp.c++/allocator-2.C

index f82072284883174e1416eb10b8d305d72605057a..49425386b33f6220a972b59594c96f7fe1f72a94 100644 (file)
@@ -78,7 +78,10 @@ void test_inequality ()
   CHECK_INEQUALITY (omp::allocator::cgroup_mem, void);
   CHECK_INEQUALITY (omp::allocator::pteam_mem, void);
   CHECK_INEQUALITY (omp::allocator::thread_mem, void);
+#ifdef __gnu_linux__
+  /* Pinning not implemented on other targets.  */
   CHECK_INEQUALITY (ompx::allocator::gnu_pinned_mem, void);
+#endif
   /* And again with the same type passed to the allocator.  */
   CHECK_INEQUALITY (omp::allocator::null_allocator, T);
   CHECK_INEQUALITY (omp::allocator::default_mem, T);
@@ -89,7 +92,9 @@ void test_inequality ()
   CHECK_INEQUALITY (omp::allocator::cgroup_mem, T);
   CHECK_INEQUALITY (omp::allocator::pteam_mem, T);
   CHECK_INEQUALITY (omp::allocator::thread_mem, T);
+#ifdef __gnu_linux__
   CHECK_INEQUALITY (ompx::allocator::gnu_pinned_mem, T);
+#endif
 }
 
 #undef CHECK_INEQUALITY
@@ -121,7 +126,9 @@ int main ()
   test<int, omp::allocator::cgroup_mem>(42);
   test<int, omp::allocator::pteam_mem>(42);
   test<int, omp::allocator::thread_mem>(42);
+#ifdef __gnu_linux__
   test<int, ompx::allocator::gnu_pinned_mem>(42);
+#endif
 
   test<long long, omp::allocator::null_allocator>(42);
   test<long long, omp::allocator::default_mem>(42);
@@ -132,7 +139,9 @@ int main ()
   test<long long, omp::allocator::cgroup_mem>(42);
   test<long long, omp::allocator::pteam_mem>(42);
   test<long long, omp::allocator::thread_mem>(42);
+#ifdef __gnu_linux__
   test<long long, ompx::allocator::gnu_pinned_mem>(42);
+#endif
 
   test<S, omp::allocator::null_allocator>( S{42, true, 128.f});
   test<S, omp::allocator::default_mem>(    S{42, true, 128.f});
@@ -143,7 +152,9 @@ int main ()
   test<S, omp::allocator::cgroup_mem>(     S{42, true, 128.f});
   test<S, omp::allocator::pteam_mem>(      S{42, true, 128.f});
   test<S, omp::allocator::thread_mem>(     S{42, true, 128.f});
+#ifdef __gnu_linux__
   test<S, ompx::allocator::gnu_pinned_mem>(S{42, true, 128.f});
+#endif
 
   test_inequality<int, omp::allocator::null_allocator>();
   test_inequality<int, omp::allocator::default_mem>();
@@ -154,5 +165,7 @@ int main ()
   test_inequality<int, omp::allocator::cgroup_mem>();
   test_inequality<int, omp::allocator::pteam_mem>();
   test_inequality<int, omp::allocator::thread_mem>();
+#ifdef __gnu_linux__
   test_inequality<int, ompx::allocator::gnu_pinned_mem>();
+#endif
 }
index d25b75501a994ca19adf28191309f7405d02c071..ca94fc7e376e482830990ca570347ec747795d36 100644 (file)
@@ -86,7 +86,10 @@ int main ()
   f<int, omp::allocator::cgroup_mem     >(0, 1, 2, 3);
   f<int, omp::allocator::pteam_mem      >(0, 1, 2, 3);
   f<int, omp::allocator::thread_mem     >(0, 1, 2, 3);
+#ifdef __gnu_linux__
+  /* Pinning not implemented on other targets.  */
   f<int, ompx::allocator::gnu_pinned_mem>(0, 1, 2, 3);
+#endif
 
   f<long long, omp::allocator::null_allocator >(0, 1, 2, 3);
   f<long long, omp::allocator::default_mem    >(0, 1, 2, 3);
@@ -97,7 +100,9 @@ int main ()
   f<long long, omp::allocator::cgroup_mem     >(0, 1, 2, 3);
   f<long long, omp::allocator::pteam_mem      >(0, 1, 2, 3);
   f<long long, omp::allocator::thread_mem     >(0, 1, 2, 3);
+#ifdef __gnu_linux__
   f<long long, ompx::allocator::gnu_pinned_mem>(0, 1, 2, 3);
+#endif
 
   S0 s0_0{   42, true,  111128.f};
   S0 s0_1{  142, false,  11128.f};
@@ -112,7 +117,9 @@ int main ()
   f<S0, omp::allocator::cgroup_mem     >(s0_0, s0_1, s0_2, s0_3);
   f<S0, omp::allocator::pteam_mem      >(s0_0, s0_1, s0_2, s0_3);
   f<S0, omp::allocator::thread_mem     >(s0_0, s0_1, s0_2, s0_3);
+#ifdef __gnu_linux__
   f<S0, ompx::allocator::gnu_pinned_mem>(s0_0, s0_1, s0_2, s0_3);
+#endif
 
   S1 s1_0{   42, true,  111128.f};
   S1 s1_1{  142, false,  11128.f};
@@ -128,5 +135,7 @@ int main ()
   f<S1, omp::allocator::cgroup_mem     >(s1_0, s1_1, s1_2, s1_3);
   f<S1, omp::allocator::pteam_mem      >(s1_0, s1_1, s1_2, s1_3);
   f<S1, omp::allocator::thread_mem     >(s1_0, s1_1, s1_2, s1_3);
+#ifdef __gnu_linux__
   f<S1, ompx::allocator::gnu_pinned_mem>(s1_0, s1_1, s1_2, s1_3);
+#endif
 }