bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with new test case.


From: Akim Demaille
Subject: Re: Help with new test case.
Date: Sun, 6 Sep 2020 09:52:28 +0200

Kaz,

> Le 5 sept. 2020 à 21:41, Kaz Kylheku <kaz@kylheku.com> a écrit :
> 
> On 2020-09-05 00:59, Kaz Kylheku wrote:
>> Hi,
>> I'm trying to add a test case in the form of a new entry in examples/c.

Examples are show cases, they are no tests.  They are there to serve
as a starting point for people who want to understand how Bison
works.

> I moved all the build rules into local.mk, and got it to work.
> 
>> 'examples/c/buildscenario/buildscenario.c', needed by
>> 'examples/c/buildscenario/examples_c_buildscenario_buildscenario-buildscenario.o'.
>>   Stop.
> 
> This seems to have been solved using:
> 
>   nodist_%C%_buildscenario_OBJECTS = %D%/y.tab.o %D%/main.o

You have to follow the same patterns as in the other examples.

> The entire local.mk looks like this. It builds, and the executable
> examples/c/buildscenario/buildscenario is produced.
> 
> Only problem is that when the test is executed, it fails.
> If I add a "ls -l" to the test script, it shows that the temporary
> test directory that it is running in such as /home/kaz/bison/22392.dir
> is empty; the executable isn't being propagated into it.
> 
> I can't see what the other local.mk files are doing to bring that
> about, that mine isn't.
> 
> local.mk follows.

I can't debug your stuff this way.  If you have some fork with a branch,
I could check that.

> buildscenariodir = $(docdir)/%D%
> 
> check_PROGRAMS += %D%/buildscenario
> 
> dist_buildscenario_DATA = %D%/parser.y %D%/parser.h %D%/main.c %D%/Makefile 
> %D%
> nodist_%C%_buildscenario_SOURCES = %D%/parse.y %D%/main.c %D%/parse.h
> nodist_%C%_buildscenario_OBJECTS = %D%/y.tab.o %D%/main.o
> 
> TESTS += %D%/buildscenario.test
> EXTRA_DIST += %D%/buildscenario.test
> 
> CLEANDIRS += %D%/*.dSYM
> CLEANFILES += $(%C%_buildscenario_buildscenario_OBJECTS)
> 
> buildscenario_CPPFLAGS =
> buildscenario_CFLAGS = $(TEST_CFLAGS) \
>                       -W -Wall -ansi -pedantic \
>                       -Werror=implicit-function-declaration \
>                       -Werror=missing-prototypes \
>                       -Werror=strict-prototypes

You are free to do whatever you want in your fork of Bison, but Bison
itself can't afford to assume that these flags are supported by the
compiler. 

> buildscenario_BISON = bison --yacc
> buildscenario_BISONFLAGS = -Wno-deprecated
> 
> %D%/y.tab.c: %D%/parser.y
>        $(buildscenario_BISON) $(buildscenario_BISONFLAGS) -v -d $<
>        @# workaround for Bison 3.x: yyparse declared in y.tab.h
>        sed -e /yyparse/d < y.tab.h > y.tab.h.tmp

What problem is this solving?

>        mv y.tab.h.tmp %D%/y.tab.h
>        mv y.tab.c %D%/y.tab.c
>        mv y.output %D%/y.output
> 
> %D%/main.o: %D%/parser.h
> 
> %D%/y.tab.o: %D%/parser.h %D%/y.tab.h
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]