[v3] Use pthread effective-target in testsuite

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu Jun 15 09:15:00 GMT 2017


I've recently been reminded that the pthread tests in libstdc++ still
use insanely long lists of targets to control where they are run.  I'd
several times promised to do something about that, and here's the patch
that finally does.

The patch is mostly mechanical (and those parts were produced by a short
perl script), but a couple of issues bear comments or pose questions:

* For all tests using -pthread, I've removed the target lists from both
  dg-do run and dg-options, replacing them by
  dg-require-effective-target pthread instead.

* 4 tests in 30_threads/shared_mutex use -std=gnu++17 in addition to
  -pthread, but in a weird way: most targets use both options, but three
  (*-*-darwin*, *-*-cygwin, *-*-rtems) only pass -std=gnu++17.  I've no
  idea why and think this is unnecessary:

** Darwin is just a regular pthreads target, so this should work just
   fine.

** Cygwin (and MingW) both understand -pthread as well.  If there's some
   reason *not* to use it here, it should be explained in the tests and
   made explicit.

** RTEMS just ignores -pthread according to gcc/config/rtems.opt, so we
   should be fine with just passing it anyway.

* The two forced_unwind.cc tests are GNU specific (__forced_unwind
  exception) and time out on Solaris when I tried, so I've left the
  target list as is.  I've just removed the target list from dg-options
  (which is unnecessary duplication and incorrectly included
  *-*-solaris* in one case) and added the pthread effective-target
  although that's not strictly necessary.

* In 30_threads/this_thread/57060.cc I've moved the c++11 requirement to
  dg-require-effective-target for symmetry.

Two testcases I've left alone:

* 18_support/bad_exception/23591_thread-1.c requires -ftable-verify
  support; one could add the pthread effective target and eventually
  replace the explicit (possibly incomplete) target list, but that's for
  another time.

* ext/mt_allocator/22309_thread.cc is currently restricted to
  *-*-linux*, *-*-gnu*, but I don't immediately see why it couldn't work
  on other targets with dlopen and friends.

I've refrained from creating a 200+ entry ChangeLog entry for the
mechanical part, but could do so if required.

Bootstrapped without regressions on i386-pc-solaris2.12,
sparc-sun-solaris2.12, and x86_64-pc-linux-gnu.

Did some limited testing on x86_64-apple-darwin16.7.0, but Darwin
testing is currently massively hampered by PR bootstrap/81033.

Ok for mainline?

Thanks.
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2017-06-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libstdc++-v3:
	* testsuite: Add dg-require-effective-target pthread to -pthread
	tests.
	Remove explicit target lists from dg-do and dg-options.

	* testsuite/30_threads/async/forced_unwind.cc: Remove explit
	target list from dg-options.
	* testsuite/30_threads/packaged_task/forced_unwind.cc: Likewise.

	* 30_threads/shared_mutex/cons/1.cc: Likewise.
	Pass -pthread for all targets.
	* 30_threads/shared_mutex/try_lock/1.cc: Likewise.
	* 30_threads/shared_mutex/try_lock/2.cc: Likewise.
	* 30_threads/shared_mutex/unlock/1.cc: Likewise.

	* testsuite/30_threads/this_thread/57060.cc: Require c++11 via
	dg-require-effective-target.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libstdc++-testsuite-pthread.patch
Type: text/x-patch
Size: 164423 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20170615/b5ad1443/attachment.bin>


More information about the Libstdc++ mailing list