Run selftests for C++ as well as C
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 17 Oct 2018 13:56:05 +0000 (13:56 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Wed, 17 Oct 2018 13:56:05 +0000 (13:56 +0000)
gcc/ChangeLog:
* Makefile.in (SELFTEST_TARGETS): New.
(selftest) Change from s-selftest-c to $(SELFTEST_TARGETS).
(C_SELFTEST_FLAGS, C_SELFTEST_DEPS, s-selftest-c, selftest-c-gdb)
(selftest-gdb, selftest-c-valgrind, selftest-valgrind): Move to
c/Make-lang.in.
(CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
(selftest-c++-gdb, selftest-c++-valgrind): Move to
cp/Make-lang.in.
* configure: Regenerate.
* configure.ac (selftest_languages): New.

gcc/brig/ChangeLog:
* Make-lang.in (selftest-brig): New.

gcc/c/ChangeLog:
* Make-lang.in (selftest-c): New.
(C_SELFTEST_FLAGS, C_SELFTEST_DEPS, s-selftest-c, selftest-c-gdb)
(selftest-gdb, selftest-c-valgrind, selftest-valgrind): Move here
from gcc/Makefile.in.

gcc/cp/ChangeLog:
* Make-lang.in (selftest-c++): New.
(CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
(selftest-c++-gdb, selftest-c++-valgrind): Move here from
gcc/Makefile.in.

gcc/fortran/ChangeLog:
* Make-lang.in (selftest-fortran): New.

gcc/go/ChangeLog:
* Make-lang.in (selftest-go): New.

gcc/jit/ChangeLog:
* Make-lang.in (selftest-jit): New.

gcc/lto/ChangeLog:
* Make-lang.in (selftest-lto): New.

gcc/objc/ChangeLog:
* Make-lang.in (selftest-objc): New.

gcc/objcp/ChangeLog:
* Make-lang.in (selftest-obj-c++): New.

From-SVN: r265240

23 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/ada/gcc-interface/Make-lang.in
gcc/brig/ChangeLog
gcc/brig/Make-lang.in
gcc/c/ChangeLog
gcc/c/Make-lang.in
gcc/configure
gcc/configure.ac
gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/fortran/ChangeLog
gcc/fortran/Make-lang.in
gcc/go/ChangeLog
gcc/go/Make-lang.in
gcc/jit/ChangeLog
gcc/jit/Make-lang.in
gcc/lto/ChangeLog
gcc/lto/Make-lang.in
gcc/objc/ChangeLog
gcc/objc/Make-lang.in
gcc/objcp/ChangeLog
gcc/objcp/Make-lang.in

index 6cfaac1690d9b232d946fb3989f7f91a3d87f913..1332e08e5ce2468e4dc2af0cfaadab0329984d2b 100644 (file)
@@ -1,3 +1,16 @@
+2018-10-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * Makefile.in (SELFTEST_TARGETS): New.
+       (selftest) Change from s-selftest-c to $(SELFTEST_TARGETS).
+       (C_SELFTEST_FLAGS, C_SELFTEST_DEPS, s-selftest-c, selftest-c-gdb)
+       (selftest-gdb, selftest-c-valgrind, selftest-valgrind): Move to
+       c/Make-lang.in.
+       (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
+       (selftest-c++-gdb, selftest-c++-valgrind): Move to
+       cp/Make-lang.in.
+       * configure: Regenerate.
+       * configure.ac (selftest_languages): New.
+
 2018-10-17  Aldy Hernandez  <aldyh@redhat.com>
 
         * tree-vrp.c (extract_range_from_multiplicative_op): Remove
index 116ed6ea8a54884fe5c25cce5691857e41c120d1..52240d17f3d15e4086071b2664807e6cc15ae04a 100644 (file)
@@ -1935,62 +1935,20 @@ DEVNULL=$(if $(findstring mingw,$(build)),nul,/dev/null)
 SELFTEST_FLAGS = -nostdinc $(DEVNULL) -S -o $(DEVNULL) \
        -fself-test=$(srcdir)/testsuite/selftests
 
-C_SELFTEST_FLAGS = -xc $(SELFTEST_FLAGS)
-CPP_SELFTEST_FLAGS = -xc++ $(SELFTEST_FLAGS)
-
 SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests
 
-C_SELFTEST_DEPS = cc1$(exeext) $(SELFTEST_DEPS)
-CPP_SELFTEST_DEPS = cc1plus$(exeext) $(SELFTEST_DEPS)
-
 # Run the selftests during the build once we have a driver and the frontend,
 # so that self-test failures are caught as early as possible.
 # Use "s-selftest-FE" to ensure that we only run the selftests if the
 # driver, frontend, or selftest data change.
 .PHONY: selftest
 
-# By default, only run the selftests within the C frontend
-selftest: s-selftest-c
-
-# C selftests
-s-selftest-c: $(C_SELFTEST_DEPS)
-       $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS)
-       $(STAMP) $@
-
-# Convenience methods for running C selftests under gdb:
-.PHONY: selftest-c-gdb
-selftest-c-gdb: $(C_SELFTEST_DEPS)
-       $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \
-         -wrapper gdb,--args
-
-.PHONY: selftest-gdb
-selftest-gdb: selftest-c-gdb
-
-# Convenience methods for running C selftests under valgrind:
-.PHONY: selftest-c-valgrind
-selftest-c-valgrind: $(C_SELFTEST_DEPS)
-       $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \
-         -wrapper valgrind,--leak-check=full
-
-.PHONY: selftest-valgrind
-selftest-valgrind: selftest-c-valgrind
-
-# C++ selftests
-s-selftest-c++: $(CPP_SELFTEST_DEPS)
-       $(GCC_FOR_TARGET) $(CPP_SELFTEST_FLAGS)
-       $(STAMP) $@
+# Potentially run all selftest-<LANG>.  The various <LANG>/Make-lang.in can
+# require the selftests to be run by defining their selftest-<LANG> as
+# s-selftest-<LANG>.  Otherwise, they should define it as empty.
 
-# Convenience method for running C++ selftests under gdb:
-.PHONY: selftest-c++-gdb
-selftest-c++-gdb: $(CPP_SELFTEST_DEPS)
-       $(GCC_FOR_TARGET) $(CPP_SELFTEST_FLAGS) \
-         -wrapper gdb,--args
-
-# Convenience method for running C++ selftests under valgrind:
-.PHONY: selftest-c++-valgrind
-selftest-c++-valgrind: $(CPP_SELFTEST_DEPS)
-       $(GCC_FOR_TARGET) $(CPP_SELFTEST_FLAGS) \
-         -wrapper valgrind,--leak-check=full
+SELFTEST_TARGETS = @selftest_languages@
+selftest: $(SELFTEST_TARGETS)
 
 # Recompile all the language-independent object files.
 # This is used only if the user explicitly asks for it.
index 4866c2ad6a000114799661d0c193de6fd37b38c6..56020922288412c6390871f495bde69d19938dfb 100644 (file)
@@ -930,6 +930,9 @@ check_gnat_parallelize = 1000
 check-ada: check-acats check-gnat
 check-ada-subtargets: check-acats-subtargets check-gnat-subtargets
 
+# No ada-specific selftests
+selftest-ada:
+
 ACATSDIR = $(TESTSUITEDIR)/ada/acats
 ACATSCMD = run_acats.sh
 
index f8749b46e617c15d1658abb6ad526c38667337d0..18f226967c06542621ce6d0b7301cc5f1d861e6f 100644 (file)
@@ -1,3 +1,7 @@
+2018-10-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * Make-lang.in (selftest-brig): New.
+
 2018-07-20  Martin Sebor  <msebor@redhat.com>
 
        PR middle-end/82063
index 8799aa78ab2c7ebc9d2d5900fd68c10b9c19188b..07c038cbc58952545e7bd71df4da08f82587aa61 100644 (file)
@@ -148,6 +148,9 @@ brig.srcman: doc/gccbrig.1
 
 lang_checks += check-brig
 
+# No brig-specific selftests
+selftest-brig:
+
 # Install hooks.
 
 brig.install-common: installdirs
index 720aadcd0eac31b71844cb98b9fe41d519fdeae0..4807a322527d52fd29032aafe36be4f67fd552ad 100644 (file)
@@ -1,3 +1,10 @@
+2018-10-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * Make-lang.in (selftest-c): New.
+       (C_SELFTEST_FLAGS, C_SELFTEST_DEPS, s-selftest-c, selftest-c-gdb)
+       (selftest-gdb, selftest-c-valgrind, selftest-valgrind): Move here
+       from gcc/Makefile.in.
+
 2018-10-02  Richard Biener  <rguenther@suse.de>
 
        * c-decl.c (warn_if_shadowing): Do not test DECL_FROM_INLINE.
index 180923fece7b73eade4cc2fa0e860eb3635bdc8a..bfae6fd2549c4f728816cd355fa9739dcc08fcde 100644 (file)
@@ -110,6 +110,38 @@ c.tags: force
 c.man:
 c.srcman:
 
+# C selftests
+
+# If C is enabled, require the selftests to be run for it
+# at each stage of the build:
+selftest-c: s-selftest-c
+
+C_SELFTEST_FLAGS = -xc $(SELFTEST_FLAGS)
+C_SELFTEST_DEPS = cc1$(exeext) $(SELFTEST_DEPS)
+
+# Run the C selftests:
+s-selftest-c: $(C_SELFTEST_DEPS)
+       $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS)
+       $(STAMP) $@
+
+# Convenience methods for running C selftests under gdb:
+.PHONY: selftest-c-gdb
+selftest-c-gdb: $(C_SELFTEST_DEPS)
+       $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \
+         -wrapper gdb,--args
+
+.PHONY: selftest-gdb
+selftest-gdb: selftest-c-gdb
+
+# Convenience methods for running C selftests under valgrind:
+.PHONY: selftest-c-valgrind
+selftest-c-valgrind: $(C_SELFTEST_DEPS)
+       $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \
+         -wrapper valgrind,--leak-check=full
+
+.PHONY: selftest-valgrind
+selftest-valgrind: selftest-c-valgrind
+
 # List of targets that can use the generic check- rule and its // variant.
 lang_checks += check-gcc
 lang_checks_parallelized += check-gcc
index 563860181a1c1ae7e469e89a1716e0dd8fceb124..fb1c707f6cf0a5a640b4e14ea4e69db06338ca8d 100755 (executable)
@@ -656,6 +656,7 @@ TM_ENDIAN_CONFIG
 tmake_file
 xmake_file
 cpp_install_dir
+selftest_languages
 check_languages
 build_file_translate
 build_xm_defines
@@ -18509,7 +18510,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18512 "configure"
+#line 18513 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18615,7 +18616,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18618 "configure"
+#line 18619 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
        check_languages="$check_languages check-$language"
 done
 
+selftest_languages=
+for language in $all_selected_languages
+do
+       selftest_languages="$selftest_languages selftest-$language"
+done
+
 # We link each language in with a set of hooks, reached indirectly via
 # lang.${target}.  Only do so for selected languages.
 
@@ -29474,6 +29481,7 @@ fi
 
 
 
+
 
 
 # Echo link setup.
index c5c33af374ccb1fa84c0d8be6522c65dc06c029d..3b70d5310a40f3d1fa396f9156f2dfdb4433f4a1 100644 (file)
@@ -6194,6 +6194,12 @@ do
        check_languages="$check_languages check-$language"
 done
 
+selftest_languages=
+for language in $all_selected_languages
+do
+       selftest_languages="$selftest_languages selftest-$language"
+done
+
 # We link each language in with a set of hooks, reached indirectly via
 # lang.${target}.  Only do so for selected languages.
 
@@ -6277,6 +6283,7 @@ AC_SUBST(build_xm_include_list)
 AC_SUBST(build_xm_defines)
 AC_SUBST(build_file_translate)
 AC_SUBST(check_languages)
+AC_SUBST(selftest_languages)
 AC_SUBST(cpp_install_dir)
 AC_SUBST(xmake_file)
 AC_SUBST(tmake_file)
index 99595d9f3520072a7c6c809ab3f3f455cf16b628..c04dbe840057394c2789be0159dab0a7d277e724 100644 (file)
@@ -1,3 +1,10 @@
+2018-10-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * Make-lang.in (selftest-c++): New.
+       (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++)
+       (selftest-c++-gdb, selftest-c++-valgrind): Move here from
+       gcc/Makefile.in.
+
 2018-10-17  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/84705
index fa8c1e69354f5182e4837157c6263da3a74d8a99..e358b76bbda98b26a34007ed2a3cefab0dc3a6c1 100644 (file)
@@ -164,6 +164,32 @@ c++.man: doc/g++.1
 c++.srcman: doc/g++.1
        -cp -p $^ $(srcdir)/doc
 
+# C++ selftests
+
+# If C++ is enabled, require the selftests to be run for it
+# at each stage of the build:
+selftest-c++: s-selftest-c++
+
+CPP_SELFTEST_DEPS = cc1plus$(exeext) $(SELFTEST_DEPS)
+CPP_SELFTEST_FLAGS = -xc++ $(SELFTEST_FLAGS)
+
+# Run the C++ selftests
+s-selftest-c++: $(CPP_SELFTEST_DEPS)
+       $(GCC_FOR_TARGET) $(CPP_SELFTEST_FLAGS)
+       $(STAMP) $@
+
+# Convenience method for running C++ selftests under gdb:
+.PHONY: selftest-c++-gdb
+selftest-c++-gdb: $(CPP_SELFTEST_DEPS)
+       $(GCC_FOR_TARGET) $(CPP_SELFTEST_FLAGS) \
+         -wrapper gdb,--args
+
+# Convenience method for running C++ selftests under valgrind:
+.PHONY: selftest-c++-valgrind
+selftest-c++-valgrind: $(CPP_SELFTEST_DEPS)
+       $(GCC_FOR_TARGET) $(CPP_SELFTEST_FLAGS) \
+         -wrapper valgrind,--leak-check=full
+
 # 'make check' in gcc/ looks for check-c++, as do all toplevel C++-related
 # check targets.  However, our DejaGNU framework requires 'check-g++' as its
 # entry point.  We feed the former to the latter here.
index ffc8629acf4de419b2837186e93fb753e59687d9..962f7fb6028b422d70dcd806f585c360fdafceac 100644 (file)
@@ -1,3 +1,7 @@
+2018-10-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * Make-lang.in (selftest-fortran): New.
+
 2018-10-17  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/56386
index 62f652e14087d493a1725c5dab60af738373039e..5eff00b06376b36a23038ed298458b2613ff2933 100644 (file)
@@ -170,6 +170,9 @@ lang_checks_parallelized += check-gfortran
 # For description see the check_$lang_parallelize comment in gcc/Makefile.in.
 check_gfortran_parallelize = 10000
 
+# No fortran-specific selftests
+selftest-fortran:
+
 # GFORTRAN documentation.
 GFORTRAN_TEXI = \
   $(srcdir)/fortran/gfortran.texi \
index afb0a7d601938ea4f32d30af8ec77dd821f9ad91..6fe4b3c58e88f7abd1b8504eccec37ea31c18563 100644 (file)
@@ -1,3 +1,7 @@
+2018-10-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * Make-lang.in (selftest-go): New.
+
 2018-09-25  Martin Liska  <mliska@suse.cz>
 
        * gofrontend/escape.cc (Gogo::analyze_escape): Remove
index 021250abe08d15000b80466a49709807e1809843..e8656cbe1d3e4ea4088bc80a0f45348f5eec57c5 100644 (file)
@@ -139,6 +139,9 @@ lang_checks += check-go
 lang_checks_parallelized += check-go
 check_go_parallelize = 10
 
+# No go-specific selftests
+selftest-go:
+
 # Install hooks.
 
 go.install-common: installdirs
index 40dbde606d156c0efb79951def17e6d1f9d28386..4e0c6e44c00b25a99442ddf2abd3313b3435a6ee 100644 (file)
@@ -1,3 +1,7 @@
+2018-10-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * Make-lang.in (selftest-jit): New.
+
 2018-06-28  Martin Liska  <mliska@suse.cz>
 
        * jit-playback.c: Include opt-suggestions.h.
index 280c094e9f2f7cafb9d563fee7bfdbb2d3cacf9f..e82f9453eb2f86a9146083a969c592fe73199dff 100644 (file)
@@ -270,6 +270,9 @@ lang_checks_parallelized += check-jit
 # we want them to be placed in different "buckets".
 check_jit_parallelize = 10
 
+# No jit-specific selftests
+selftest-jit:
+
 #\f
 # Install hooks:
 jit.install-common: installdirs
index f997f03ed88fa9afb13974dd95a3587ba3fd7bd1..c0e9f1c3d71f0f1205244a9c571815087e791b4a 100644 (file)
@@ -1,3 +1,7 @@
+2018-10-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * Make-lang.in (selftest-lto): New.
+
 2018-08-29  Martin Liska  <mliska@suse.cz>
 
        PR bootstrap/87130
index 46950776dd2c59b996d81b4249b1bcd0c75fb977..2cc3619696e1d54bbc8e41332f5f83586291452e 100644 (file)
@@ -86,3 +86,6 @@ lto1.fda: ../prev-gcc/lto1$(exeext) ../prev-gcc/$(PERF_DATA)
 
 # LTO testing is done as part of C/C++/Fortran etc. testing.
 check-lto:
+
+# No LTO-specific selftests
+selftest-lto:
index 5eeec7213512d0e12ca646d5d45d5348b720f229..ebff7446f5cc148fefbf0abec04c9bfcc139a7dd 100644 (file)
@@ -1,3 +1,7 @@
+2018-10-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * Make-lang.in (selftest-objc): New.
+
 2018-04-20  Martin Liska  <mliska@suse.cz>
 
        PR objc/85476
index 49b7a9f90d978ad00c3e47378a45bf6088654922..909a774f6c64912ebcf06f2b5740046cc79b5f05 100644 (file)
@@ -98,6 +98,9 @@ lang_checks += check-objc
 lang_checks_parallelized += check-objc
 check_objc_parallelize = 6
 
+# No objc-c-specific selftests
+selftest-objc:
+
 #\f
 # Install hooks:
 # cc1obj is installed elsewhere as part of $(COMPILERS).
index b8a97939f48fbac4db8701ed08fe80e0f0081999..26de7cbf1654ea44e0e2f8014b07e94481452ed5 100644 (file)
@@ -1,3 +1,7 @@
+2018-10-17  David Malcolm  <dmalcolm@redhat.com>
+
+       * Make-lang.in (selftest-obj-c++): New.
+
 2018-05-07  Nathan Sidwell  <nathan@acm.org>
 
        * objcp-lang.c (objcxx_init_ts): Don't call init_shadowed_var_for_decl.
index 5a0399994fdf4fcf15e5de705ca86c18a4598fb3..c98286b830c667e8264ff4979f79ab84fd53db57 100644 (file)
@@ -126,6 +126,9 @@ obj-c++.tags: force
 
 lang_checks += check-obj-c++
 
+# No objc-c++-specific selftests
+selftest-obj-c++:
+
 #\f
 # Install hooks:
 # cc1objplus is installed elsewhere as part of $(COMPILERS).