This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH 1/2] Support C++-specific selftests
- From: Jeff Law <law at redhat dot com>
- To: David Malcolm <dmalcolm at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Jun 2017 09:57:05 -0600
- Subject: Re: [PATCH 1/2] Support C++-specific selftests
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=law at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C902DC013C3C
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C902DC013C3C
- References: <email@example.com>
On 06/22/2017 06:20 PM, David Malcolm wrote:
> Currently the "make selftest" target run during each stage of the
> build just runs the selftests within cc1.
> As part of the fix for PR c++/81167 I want to be able to write
> C++-specific selftests (to exercise the C++ implementation of
> the pp's format_decoder).
> Hence this patch generalizes the existing selftest logic in
> Makefile.in so that selftests are run for both cc1 and cc1plus.
> It also adds convenience methods for running them under
> gdb and under valgrind.
> It also reorganizes the existing lang-specific selftests, splitting
> them into ones shared by c-family, and those that are specific
> to individual members of the c family. There aren't any of the
> latter yet, but the followup adds some for C++.
> Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu in
> combination with the followup patch; the number of reported passes
> from -fself-test for cc1 at each stage was unaffected by the kit:
> -fself-test: 39233 pass(es),
> and cc1plus gained a similar line of output.
> OK for trunk?
> * Makefile.in (SELFTEST_FLAGS): Drop "-x c", moving it to...
> (C_SELFTEST_FLAGS): New.
> (CPP_SELFTEST_FLAGS): New.
> (SELFTEST_DEPS): New, from deps of s-selftest.
> (C_SELFTEST_DEPS): New, from deps of s-selftest.
> (CPP_SELFTEST_DEPS): New.
> (selftest): Add dependency on s-selftest-c++.
> (s-selftest): Rename to...
> (s-selftest-c): ...this, moving deps to SELFTEST_DEPS
> and C_SELFTEST_DEPS, and using C_SELFTEST_FLAGS rather
> than SELFTEST_FLAGS.
> (selftest-gdb): Rename to...
> (selftest-c-gdb): ...this, using C_SELFTEST_DEPS and
> (selftest-gdb): Reintroduce as an alias for selftest-c-gdb.
> (selftest-valgrind): Rename to...
> (selftest-c-valgrind): ...this, using C_SELFTEST_DEPS and
> (selftest-valgrind): Reintroduce as an alias for
> (s-selftest-c++): New.
> (selftest-c++-gdb): New.
> (selftest-c++-valgrind): New.
> * c-common.c (selftest::c_family_tests): New.
> * c-common.h (selftest::run_c_tests): Move decl to c/c-lang.h.
> (selftest::c_family_tests): New decl.
> * c-lang.c (selftest::run_c_tests): Move body to c_family_tests,
> and call that instead.
> * c-tree.h (selftest::run_c_tests): New decl.
> * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as
> (selftest::run_cp_tests): New function.
> * cp-tree.h (selftest::run_cp_tests): New decl.