Simulators such as qemu report the presence of fork (it's in glibc) but
generally do not support synchronization primitives between threads, so any
tests using fork are unreliable. This patch disables the subset of such tests
that identify themselves using dg-require-fork.
At present, such tests are limited to (a) gcc.dg/torture/ftrapv-1.c. and (b)
some tests in the 27_io section of the libstdc++ testsuite, listed below.
Further patches can add dg-require-fork to the many other tests that call fork().
Cross-tested on aarch64-none-linux-gnu using qemu, with these tests becoming
UNSUPPORTED:
(gcc)
gcc.dg/torture/ftrapv-1.c
(libstdc++)
27_io/basic_filebuf/close/char/4879.cc
27_io/basic_filebuf/close/char/9964.cc
27_io/basic_filebuf/seekoff/char/26777.cc
27_io/basic_filebuf/showmanyc/char/9533-1.cc
27_io/basic_filebuf/underflow/char/10097.cc
27_io/objects/char/7.cc
27_io/objects/char/9661-1.cc
27_io/objects/wchar_t/7.cc
27_io/objects/wchar_t/9661-1.cc
Thoughts? Is this patch OK for trunk?
Cheers, Alan
gcc/testsuite/ChangeLog:
* lib/target-supports.exp (check_fork_available): Return 0 if running
on simulator.
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index f632d00..0ffd35c 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1781,6 +1781,10 @@ proc check_function_available { function } {
# Returns true iff "fork" is available on the target system.
proc check_fork_available {} {
+ if { [check_effective_target_simulator] } {
+ # Most simulators do not properly support multithreading
+ return 0
+ }
return [check_function_available "fork"]
}