https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127425

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
            Summary|estsuite:                   |testsuite:
                   |__gnu_test::semaphore exits |__gnu_test::semaphore exits
                   |0 when SysV semaphores are  |0 when SysV semaphores are
                   |unavailable, so 10 tests    |unavailable, so 10 tests
                   |report PASS without         |report PASS without
                   |executing                   |executing
           Severity|normal                      |minor
   Last reconfirmed|                            |2026-09-16

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
How many real targets do we care about that support fork and mkfifo but not
SysV IPC?

It would be simpler to just gate those tests on SysV IPC support:

--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -286,6 +286,15 @@ proc dg-require-cpp-feature-test { n args } {
     return
 }

+proc dg-require-sysv-ipc { n args } {
+    if { ![ check_v3_target_sysv_ipc $args ] } {
+       upvar dg-do-what dg-do-what
+       set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+       return
+    }
+    return
+}
+
 proc add_options_for_no_pch { flags } {
     # Remove any inclusion of bits/stdc++.h from the options.
     regsub -all -- "-include bits/stdc...h" $flags "" flags
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp
b/libstdc++-v3/testsuite/lib/libstdc++.exp
index cda231246cb0..165ba09f31fa 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1440,6 +1440,13 @@ proc check_v3_target_nprocs { } {
     }]
 }

+# Return 1 if the XSI option is supported for the current target, 0 otherwise.
+proc check_v3_target_sysv_ipc { cond } {
+    set inc "#include <unistd.h>"
+    set result [v3_check_preprocessor_condition sysv_ipc "_XOPEN_UNIX" $inc]
+    return $result
+}
+
 # Return 1 if linking with -static-libstdc++ works, 0 otherwise.
 proc check_v3_target_static_libstdcxx { } {
     return [check_v3_target_prop_cached et_static_libstdcxx {
--- a/libstdc++-v3/testsuite/util/testsuite_hooks.cc
+++ b/libstdc++-v3/testsuite/util/testsuite_hooks.cc
@@ -266,9 +266,9 @@ namespace __gnu_test
       std::__throw_runtime_error("could not initialize semaphore");
 #else
     // There are no semaphores on this system.  We have no way to mark
-    // a test as "unsupported" at runtime, so we just exit, pretending
-    // that the test passed.
-    exit(0);
+    // a test as "unsupported" at runtime, so we just exit with an error.
+    // The test should use { dg-require-sysv-ipc "" } to be UNSUPPORTED.
+    exit(1);
 #endif
   }

Reply via email to