bison-patches
[Top][All Lists]
Advanced

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

calc++: factor for other extracted tests


From: Akim Demaille
Subject: calc++: factor for other extracted tests
Date: Thu, 16 Feb 2012 15:59:27 +0100

This is in order to make the next patch shorter.

From 2e4986a88d5dbf180dc3829a67b5f420e727d470 Mon Sep 17 00:00:00 2001
From: Akim Demaille <address@hidden>
Date: Thu, 16 Feb 2012 15:27:03 +0100
Subject: [PATCH 4/5] calc++: factor for other extracted tests.

        * Makefile.am (TESTS, check_PROGRAMS): Initialize here.
        * examples/local.mk (doc, extexi): Define here.
        * examples/calc++/local.mk: Adjust accordingly.
        * configure.ac: Ask for parallel-tests (for the way the logs
        are handled).
        * examples/calc++/test: As a consequence, always be verbose.
        ($prog): New.
        (run): Use it.
        Sort the tests in a more natural order (simplest first).
---
 Makefile.am              |    4 +++-
 configure.ac             |    4 +++-
 examples/calc++/local.mk |   12 +++++-------
 examples/calc++/test     |   27 +++++++++++++--------------
 examples/local.mk        |    2 ++
 5 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 8f00e60..26e87cf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,10 +41,12 @@ AM_CFLAGS = $(WARN_CFLAGS)
 AM_CPPFLAGS = -I. -Ilib -I$(top_srcdir) -I$(top_srcdir)/lib
 BUILT_SOURCES =
 DISTCLEANFILES =
+MOSTLYCLEANDIRS =
 MOSTLYCLEANFILES =
 SUFFIXES =
+TESTS =
+check_PROGRAMS =
 noinst_LIBRARIES =
-MOSTLYCLEANDIRS =
 
 include build-aux/local.mk
 include data/local.mk
diff --git a/configure.ac b/configure.ac
index c51d2dd..622da5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,9 @@ AC_CONFIG_MACRO_DIR([m4])
 # releases, we want to be able run make dist without being required to
 # add a bogus NEWS entry.  In that case, the version string
 # automatically contains a dash, which we also let disable gnits.
-AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc silent-rules]
+AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc
+                 color-tests parallel-tests
+                 silent-rules]
                  m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
                            [gnu], [gnits]))
 AM_SILENT_RULES([yes])
diff --git a/examples/calc++/local.mk b/examples/calc++/local.mk
index 54e5584..839ef86 100644
--- a/examples/calc++/local.mk
+++ b/examples/calc++/local.mk
@@ -19,8 +19,6 @@
 ## Extracting.  ##
 ## ------------ ##
 
-doc = $(top_srcdir)/doc/bison.texinfo
-extexi = $(top_srcdir)/examples/extexi
 # Extract in src.
 $(top_srcdir)/examples/calc++/calc.stamp: $(doc) $(extexi)
        $(AM_V_GEN)rm -f $@ address@hidden
@@ -37,9 +35,9 @@ $(calc_extracted): $(top_srcdir)/examples/calc++/calc.stamp
          $(MAKE) $(AM_MAKEFLAGS) $<; \
        fi
 
-## --------------------------- ##
-## Building & testing calc++.  ##
-## --------------------------- ##
+## -------------------- ##
+## Building & testing.  ##
+## -------------------- ##
 
 BUILT_SOURCES += $(calc_sources) examples/calc++/calc++-parser.h
 CLEANFILES += *.tmp
@@ -59,13 +57,13 @@ calc_generated =                            \
 calc_sources =                                 \
   $(calc_extracted) $(calc_generated)
 if BISON_CXX_WORKS
-check_PROGRAMS = examples/calc++/calc++
+check_PROGRAMS += examples/calc++/calc++
 examples_calc___calc___SOURCES =               \
   $(calc_sources)                              \
   examples/calc++/y.tab.h                      \
   examples/calc++/calc++-parser.hh
 
 examples_calc___calc___CPPFLAGS = -I$(top_srcdir)/examples/calc++
-TESTS = examples/calc++/test
+TESTS += examples/calc++/test
 endif
 EXTRA_DIST += examples/calc++/test
diff --git a/examples/calc++/test b/examples/calc++/test
index 150f161..0dfe368 100755
--- a/examples/calc++/test
+++ b/examples/calc++/test
@@ -15,11 +15,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-test -z "$VERBOSE" && {
-   exec > /dev/null 2>&1
-   set -x
-}
-
 me=`basename $0`
 
 # Number of the current test.
@@ -28,6 +23,9 @@ number=1
 # Exit status of this script.
 exit=true
 
+# The exercised program.
+prog=./examples/calc++/calc++
+
 # run EXPECTED-EXIT-STATUS EXPECTED-OUTPUT [PARSER-OPTIONS]
 # ---------------------------------------------------------
 run ()
@@ -37,7 +35,7 @@ run ()
   shift
   local out_exp=$1
   shift
-  ./examples/calc++/calc++ "$@" input >out_eff
+  $prog "$@" - <input >out_eff
   local sta_eff=$?
   local out_eff=`cat out_eff`
   if test $sta_eff -eq $sta_exp; then
@@ -56,6 +54,14 @@ run ()
   number=`expr $number + 1`
 }
 
+
+cat >input <<EOF
+toto := 1
+toto
+EOF
+run 0 1 -s
+
+
 cat >input <<EOF
 a := 1
 b := 2
@@ -81,14 +87,7 @@ cat >input <<EOF
 a := 1
 d := a + b * c
 EOF
-run 1 '' input
-
-
-cat >input <<EOF
-toto := 1
-toto
-EOF
-run 0 1 -s
+run 1 ''
 
 rm input out_eff
 $exit
diff --git a/examples/local.mk b/examples/local.mk
index 6da395d..e6d69d0 100644
--- a/examples/local.mk
+++ b/examples/local.mk
@@ -13,6 +13,8 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+doc = $(top_srcdir)/doc/bison.texinfo
+extexi = $(top_srcdir)/examples/extexi
 dist_noinst_SCRIPTS = examples/extexi
 
 include examples/calc++/local.mk
-- 
1.7.9





reply via email to

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