[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] {yacc-work} coverage: test mixed C/C++ yacc-generated parser
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH] {yacc-work} coverage: test mixed C/C++ yacc-generated parsers in the same dir |
Date: |
Sun, 10 Apr 2011 15:34:12 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
On Sunday 10 April 2011, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Sun, Apr 10, 2011 at 02:50:28PM CEST:
> > On Sunday 10 April 2011, Ralf Wildenhues wrote:
> > > I think it would make sense to also do parallel build tests here
> > >
> > Agreed (and BTW this uncovered a bug in the testcase: I had forgotten
> > to add `p.h' and `parse.hh' to BUILT_SOURCES in the Makefile.am; it's
> > fixed now).
>
> Hehe.
>
> > Here is what we could do IMHO: first try a VPATH serial build, then
> > an in-tree parallel build. See the attached squash-in.
> >
> > Tested with GNU make (3.80, 3.81, 3.82), FreeBSD and NetBSD make
> > (Debian ports), Heirloom make, Solaris XPG4 and CCS make, and
> > Solaris dmake. OK?
>
> OK.
>
> > > (only if make is GNU make, of course)
> > >
> > Why? I've never found a make implementation rejecting the `-j' option.
>
> HP-UX make has -P but not -j. The semantics of -P are sufficiently
> different so that it is not worth trying to support that, however.
>
> $ make -j; echo $?
> Make: Unknown flag argument j. Stop.
> 1
>
> Several other makes accept -j only when given a number, not without,
>
I have no intention to use `-j' without a number. Too risky IMHO (it
wouldn't be the first time that my machine gets freezed by that).
> e.g., OpenBSD make:
>
> $ make -j
> make: option requires an argument -- j
> usage: make [-BeiknPqrSst] [-D variable] [-d flags] [-f makefile]
> [-I directory] [-j max_jobs] [-m directory] [-V variable]
> [NAME=value] [target ...]
>
>
> And I think for portability to all GNU make versions, the number should
> follow immediately, i.e., without intervening space, but I'm going from
> memory here.
>
The space is fine from at least GNU make 3.78. I don't know about
earlier versions.
> It's fine to try out first if make groks -j, and use that, that gives
> more coverage then. But you should try it out in a way to not expose
> the issues you just spotted. For example, you could use
> make -j2 clean || Exit 77
>
Or, since we are doing both VPATH an in-tree builds, just continue
with serial make if `-j' doesn't work. See the attached squash-in
(which goes on the top of the previous squash-in). OK?
> (or Exit 0, if you don't consider that part of the test important
> enough).
>
> > +# Try a VPATH and by default serial build first, and then an in-tree
> > +# and by default parallel build.
> > +
> > +for try in 0 1; do
> > +
> > + if test $try -eq 0; then
> > + mkdir build
> > + cd build
> > + srcdir=..
> > + debug_info="ls -l . $srcdir"
> > + run_make=$MAKE
> > + elif test $try -eq 1; then
> > + srcdir=.
> > + debug_info="ls -l"
> > + case $MAKE in
> > + *\ -j*) run_make=$MAKE;;
> > + *) run_make="$MAKE -j 3";;
>
> See above for spacing.
>
See attached squash-in.
> Also, note that $MAKE might already include -jN.
>
The `case' statement should take care of that: in fact, it's there
only for this purpose ... I've added a clarifying comment now.
> Thanks,
> Ralf
>
Thanks, and sorry for all this churn,
Stefano
diff --git a/tests/yacc-mix-c-cxx.test b/tests/yacc-mix-c-cxx.test
index 0901ac8..8b7c1a5 100755
--- a/tests/yacc-mix-c-cxx.test
+++ b/tests/yacc-mix-c-cxx.test
@@ -141,17 +141,32 @@ $AUTOMAKE -a
for try in 0 1; do
if test $try -eq 0; then
+ # VPATH serial build.
mkdir build
cd build
srcdir=..
debug_info="ls -l . $srcdir"
run_make=$MAKE
elif test $try -eq 1; then
+ # In-tree parallel build.
srcdir=.
debug_info="ls -l"
case $MAKE in
- *\ -j*) run_make=$MAKE;;
- *) run_make="$MAKE -j 3";;
+ *\ -j*)
+ # Degree of parallelism already specified by the user do
+ # not override it.
+ run_make=$MAKE;;
+ *)
+ # Some make implementations (e.g., HP-UX) don't grok `-j',
+ # some require no space between `-j' and the number of jobs
+ # (e.g., older GNU make versions), and some *do* require a
+ # space between `-j' and the number of jobs (e.g., Solaris
+ # dmake). We need a runtime test to see what works.
+ echo 'all:' > Makefile
+ for run_make in "$MAKE -j3" "$MAKE -j 3" "$MAKE"; do
+ $run_make && break
+ done
+ rm -f Makefile
esac
else
echo "$me: invalid value of \$try '$try'" >&2