public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/libbash:master commit in: /, bashast/gunit/
@ 2011-03-17  9:44 Petteri Räty
  0 siblings, 0 replies; only message in thread
From: Petteri Räty @ 2011-03-17  9:44 UTC (permalink / raw
  To: gentoo-commits

commit:     7f143ec96c24645a0c379da88f8d6fa8165b6ce8
Author:     Petteri Räty <petsku <AT> petteriraty <DOT> eu>
AuthorDate: Sat Mar 12 13:45:24 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Sat Mar 12 13:58:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=7f143ec9

Remove manual build system for gunit

All of the build system is now handled by automake. Instead of having
runtests.sh compiling needed Java files for running gunit it's now just
a thing wrapper to parsing the .gunit files. With this change working on
native code goes faster as recompiling the Java files is not needed.

---
 .gitignore                |    2 +
 Makefile.am               |   37 +++++++++++++++++++--
 bashast/gunit/runtests.sh |   78 +-------------------------------------------
 3 files changed, 37 insertions(+), 80 deletions(-)

diff --git a/.gitignore b/.gitignore
index 68a1c10..63a1f7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,9 +3,11 @@
 *.la
 *.lo
 *.log
+*.class
 .deps
 .libs
 .dirstamp
+classcheck.stamp
 Makefile.in
 aclocal.m4
 depcomp

diff --git a/Makefile.am b/Makefile.am
index 9303a51..f262751 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,9 +22,33 @@ include doxygen.am
 
 ACLOCAL_AMFLAGS = -I m4
 
-TESTS = bashast/gunit/runtests.sh
-TEST_EXTENSIONS= .sh
-SH_LOG_COMPILER = /bin/bash
+TEST_EXTENSIONS= .gunit
+GUNIT_LOG_COMPILER = bashast/gunit/runtests.sh
+AM_GUNIT_LOG_FLAGS = @antlr_cp@:.
+GUNIT_TESTS = bashast/gunit/arith_main.gunit \
+		bashast/gunit/array.gunit \
+		bashast/gunit/assoc_array.gunit \
+		bashast/gunit/brace.gunit \
+		bashast/gunit/command_sub.gunit \
+		bashast/gunit/comment.gunit \
+		bashast/gunit/compound.gunit \
+		bashast/gunit/cond_main.gunit \
+		bashast/gunit/continued_lines.gunit \
+		bashast/gunit/expansions.gunit \
+		bashast/gunit/fname.gunit \
+		bashast/gunit/function.gunit \
+		bashast/gunit/list.gunit \
+		bashast/gunit/param_main.gunit \
+		bashast/gunit/pipeline.gunit \
+		bashast/gunit/proc_sub.gunit \
+		bashast/gunit/redir.gunit \
+		bashast/gunit/simp_command.gunit \
+		bashast/gunit/simp_prog.gunit
+
+TESTS = $(GUNIT_TESTS)
+# these get cleaned so only add autogenerated stuff or modify CLEANFILES
+check_JAVA = bashast/bashastLexer.java bashast/bashastParser.java
+AM_JAVACFLAGS = -classpath @antlr_cp@
 
 if HAVE_GTEST
 TESTS += builtin_unittests post_check
@@ -46,7 +70,7 @@ AM_CXXFLAGS=$(BOOST_CPPFLAGS) -std=c++0x
 
 GENERATED_C = bashastLexer.c bashastParser.c
 GENERATED_H = bashastLexer.h bashastParser.h
-CLEANFILES = $(GENERATED_C) $(GENERATED_H) bashast.g
+CLEANFILES = $(GENERATED_C) $(GENERATED_H) bashast.g $(check_JAVA) bashast/grammar.run grammar.run
 lib_LTLIBRARIES = libcppbash.la
 libcppbash_la_SOURCES = src/cppbash_builtin.cpp
 libcppbash_la_SOURCES += src/builtins/echo_builtin.cpp
@@ -66,3 +90,8 @@ $(GENERATED_H): grammar.run
 bashast.g: bashast/bashast.g
 	sed -e 's/CommonTree/pANTLR3_BASE_TREE/g' -e 's/Java/C/g' $< > $@
 
+bashast/grammar.run: bashast/bashast.g
+	@JAVA@ -classpath @antlr_cp@ -Xmx1024m org.antlr.Tool -Xconversiontimeout 20000 $<
+	touch $@
+
+$(check_JAVA): bashast/grammar.run

diff --git a/bashast/gunit/runtests.sh b/bashast/gunit/runtests.sh
index 3a4a42d..7af4592 100755
--- a/bashast/gunit/runtests.sh
+++ b/bashast/gunit/runtests.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 #############################################
-#Copyright 2010 Nathan Eloe
+#Copyright 2010 Petteri Räty
 #
 #This file is part of libbash.
 #
@@ -16,79 +16,5 @@
 #You should have received a copy of the GNU General Public License
 #along with libbash.  If not, see <http://www.gnu.org/licenses/>.
 ##############################################
-#variable for number of tests
-let failedtests=0
 
-#test running function
-function rtest {
-	freason=""
-	gramname=`cat $1 |grep gunit|awk '{print $2}'|awk -F';' '{print $1}'`
-	grammar="$gramname.g"
-	if [[ ! -a "$SCRIPTDIR/$grammar" ]]; then
-		cp "$SCRIPTDIR/../$grammar" $SCRIPTDIR
-	fi
-	if [[ ! -a "$SCRIPTDIR/${gramname}Lexer.java" && ! -a "$SCRIPTDIR/${gramname}Parser.java" ]]; then
-		java -Xmx1024m org.antlr.Tool -Xconversiontimeout 20000 $SCRIPTDIR/$grammar
-		if [[ ! -a "$SCRIPTDIR/${gramname}Lexer.java" && ! -a "$SCRIPTDIR/${gramname}Parser.java" ]]; then
-			freason="Grammar generation failure"
-		fi
-	fi
-	if [[ $freason == "" && ! -a "$SCRIPTDIR/${gramname}Lexer.class" && ! -a "$SCRIPTDIR/${gramname}Parser.class" ]]; then
-		javac $SCRIPTDIR/*.java 2> /dev/null
-		if [[ ! -a "$SCRIPTDIR/${gramname}Lexer.class" && ! -a "$SCRIPTDIR/${gramname}Parser.class" ]]; then
-			freason="Compilation failure"
-		fi
-	fi
-	java org.antlr.gunit.Interp $1 > $1.output
-	failed=`cat $1.output|grep "Failures:"|awk -F: '{print $3}'|awk '{print $1}'`
-
-	if [[ $freason == "" && failed -ne '0' ]]; then
-		freason="Unit test failure"
-	fi
-	if [[ $freason == "" ]]; then
-		printf "\e[0;0m$1:\e[0;32m passed\e[0;0m\n"
-		rm $1.output
-	else
-		printf "\e[0;0m$1:\e[0;31m fail\e[0m: $freason\n"
-		((failedtests++))
-	fi
-}
-
-#Get the directory of the script
-SCRIPTDIR=`dirname $0`
-#set up the classpath
-if type -p java-config > /dev/null; then
-	export CLASSPATH=".:$SCRIPTDIR:$(java-config -dp antlr-3)"
-else
-	export CLASSPATH=".:$SCRIPTDIR:/usr/share/java/antlr-3.2.jar:/Applications/ANTLRWorks.app/Contents/Resources/Java/antlrworks.jar"
-fi
-
-if [[ $# -eq 0  ]]; then
-	for gtest in `ls ${SCRIPTDIR}|grep gunit`; do
-		rtest ${SCRIPTDIR}/$gtest
-	done
-else
-	for gtest in "$@"; do
-		if [[ -a $gtest ]]; then
-			rtest $gtest
-		else
-			echo "gunit file not found: $gtest"
-		fi
-	done
-	cat $SCRIPTDIR/*.output 2> /dev/null
-	rm $SCRIPTDIR/*.output 2> /dev/null
-fi
-if [[ $# -gt 0 ]]; then
-	testsrun=$#
-else
-	testsrun=`ls $SCRIPTDIR | grep gunit | wc -l`
-fi
-echo "==========================="
-printf "Test summary:\n\e[0;32mPass:\e[0;0m $(($testsrun-$failedtests))\n\e[0;31mFail: \e[0;0m$failedtests\n"
-
-rm $SCRIPTDIR/*.output 2> /dev/null
-rm $SCRIPTDIR/*.java 2> /dev/null
-rm $SCRIPTDIR/*.class 2> /dev/null
-rm $SCRIPTDIR/*.tokens 2> /dev/null
-rm $SCRIPTDIR/*.g 2> /dev/null
-exit $failedtests
+exec java -cp "${1}" org.antlr.gunit.Interp $2



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-17  9:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-17  9:44 [gentoo-commits] proj/libbash:master commit in: /, bashast/gunit/ Petteri Räty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox