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

--- Comment #6 from Alejandro Colomar <alx at kernel dot org> ---
On Mon, Jan 15, 2024 at 09:38:31AM +0000, pinskia at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113378
> 
> --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> (In reply to Alejandro Colomar from comment #4)
> > 
> > Not necessarily.  I use stdin for simplicity in small tests.  The
> > test suite
> 
> Which testsuite is this?

Nothing standard.  Just a hand-written GNUmakefile that runs all scripts
within share/tests/.


        TESTS  := $(shell $(FIND) $(TESTSDIR) -type f | $(GREP) '\.sh$$' |
$(SORT))
        _TESTS := $(patsubst $(srcdir)/share/%,$(builddir)/%.ck.touch,$(TESTS))
        _tests := $(patsubst
$(srcdir)/share/%,$(builddir)/%.ick.touch,$(TESTS))


        _TESTSDIRS := $(patsubst $(srcdir)/share/%,$(builddir)/%/,$(shell
$(FIND) $(TESTSDIR) -type d | $(SORT)))


        $(_TESTSDIRS): | $$(dir $$(@D))
                $(info  MKDIR   $@)
                $(MKDIR) $@


        $(_TESTS): $(builddir)/%.ck.touch: $(srcdir)/share/% $(MK) $(TU_h)
$(_LIB_a) $(_LIB_so_v) | $$(@D)/
                $(info  SH (test)       $@)
                PKG_CONFIG_LIBDIR=$(PCDIR) $<
                touch $@

        $(_tests): $(builddir)/%.ick.touch: $(srcdir)/share/% $(MK) $(_tu_h)
$(_lib_a) $(_lib_so) | $$(@D)/
                $(info  SH (test)       $@)
                $<
                touch $@


        .PHONY: check
        check: $(_TESTS)


        .PHONY: installcheck
        installcheck: $(_tests)


>  I should note GCC uses dejagnu (and you can make your
> own testsuite using that too for other compilers too) which allows you to do
> things like:

I know.  I want to learn to use it if I find some time, and replace my
custom scripts.

> ```
> #include <a2i/str2i.h>
> 
> int
> main(void)
> {
>   unsigned char  n;
>   str2i(signed char, &n, "0"); /* { dg-error "-Werror=pointer-sign" } */
> }
> ```
> Which is easier to maintain than shell scripts like you provided in comment 
> #4.
>  Note a simple dejagnu testsuite supports dg-error/dg-warning by default; 
> GCC's
> version of dg-error/dg-warning has more features though.

Thanks!

Have a lovely day,
Alex

Reply via email to