diff --git a/Makefile.am b/Makefile.am index 14d5430..72b3030 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,22 @@ ## ease.js Makefile.am +# +# Copyright (C) 2013 Mike Gerwitz +# +# This file is part of GNU ease.js. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +## # see README SUBDIRS = doc @@ -16,23 +34,20 @@ path_lib = $(top_builddir)/lib path_test = $(top_builddir)/test path_doc = $(top_builddir)/doc -path_perf_test = $(path_test)/perf path_combine_output = $(path_build)/ease.js path_combine_output_full = $(path_build)/ease-full.js path_browser_test = $(path_tools)/browser-test.html src_js = @SRC_JS@ -perf_tests = @PERF_TESTS@ path_externs_internal = $(path_build)/externs-internal.js combine = $(path_tools)/combine compiler = @CCJAR@ MKDIR_P = @MKDIR_P@ -.PHONY: mkbuild combine min doc test perf +.PHONY: mkbuild combine min doc check test test-suite perf FORCE -default: all-local -all-local: combine min +default: combine mkbuild: $(path_build) @@ -83,12 +98,11 @@ doc: $(MAKE) -C "$(path_doc)" test: check -check: default - $(MAKE) -C "$(path_test)" +check: @SRC_TESTS@ test-suite # performance tests -perf: default $(perf_tests) -perf-%.js: default +perf: @PERF_TESTS@ +perf-%.js: FORCE if HAS_NODE @$(NODE) $@ else @@ -96,6 +110,24 @@ else @exit 1 endif +# test cases (old format) +test/%.js: FORCE + NODE_PATH="$(path_test):$(NODE_PATH)" $(NODE) --stack_trace_limit=20 "$@" +test/test-%: FORCE + ./"$@" + +# test suite (new format) +test-suite: +if HAS_NODE + @echo "ease.js Test Suite" + @echo + @NODE_PATH="$(path_test):$(NODE_PATH)" $(NODE) --stack_trace_limit=20 \ + $(path_test)/runner.js @TEST_CASES@ +else + @echo "Node.js must be installed in order to run the test suite" + @exit 1 +endif + # generate the familiar files that automake normally checks for dist-hook: AUTHORS NEWS ChangeLog cp $? $(distdir) diff --git a/configure.ac b/configure.ac index 1d7356d..41fe91f 100644 --- a/configure.ac +++ b/configure.ac @@ -57,30 +57,6 @@ else AC_MSG_ERROR(failed!) fi -# unit tests -AC_MSG_CHECKING([for unit tests]) -SRC_TESTS="$( find test/ -name test-* \ - -o -name *Test* \ - -o -name inc-*.js \ - | tr '\n' ' ' \ -)" -AC_SUBST(SRC_TESTS) -if test "$SRC_TESTS"; then - AC_MSG_RESULT(ok) -else - AC_MSG_WARN(none found) -fi - -# check for performance tests -AC_MSG_CHECKING([for performance tests]) -PERF_TESTS=$( find test/perf -name 'perf-*.js' | tr '\n' ' ' ) -AC_SUBST(PERF_TESTS) -if test "$PERF_TESTS"; then - AC_MSG_RESULT(ok) -else - AC_MSG_WARN(none found) -fi - # Java is used for Closure Compiler AC_ARG_VAR([JAVA], [The Java executable]) AC_ARG_VAR([CCJAR], [The Clojure Compiler jar file]) @@ -105,5 +81,23 @@ AS_IF(test "$JAVA" -a ! "$CCJAR", AM_CONDITIONAL(HAS_CCJAR, [test "$CCJAR"]) +# unit tests (old test system; refactoring needed) +AC_MSG_CHECKING([for unit tests]) +SRC_TESTS="$( find test/ -name test-* | tr '\n' ' ' )" +AC_SUBST(SRC_TESTS) +AS_IF([test "$SRC_TESTS"], [AC_MSG_RESULT(ok)], [AC_MSG_WARN(none found)]) + +# test cases (new test system) +AC_MSG_CHECKING([for test cases]) +TEST_CASES="$( find test/ -name '*Test.*' | tr '\n' ' ' )" +AC_SUBST(TEST_CASES) +AS_IF([test "$TEST_CASES"], [AC_MSG_RESULT(ok)], [AC_MSG_WARN(none found)]) + +# check for performance tests +AC_MSG_CHECKING([for performance tests]) +PERF_TESTS=$( find test/perf -name 'perf-*.js' | tr '\n' ' ' ) +AC_SUBST(PERF_TESTS) +AS_IF([test "$PERF_TESTS"], [AC_MSG_RESULT(ok)], [AC_MSG_WARN(none found)]) + AC_CONFIG_FILES([Makefile doc/Makefile package.json lib/version.js]) AC_OUTPUT diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index cbc2652..0000000 --- a/test/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -## -# ease.js test Makefile -# -# Responsible for running the ease.js test suite. -# -# Copyright (C) 2011, 2012 Mike Gerwitz -# -# This file is part of GNU ease.js -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -## - -tests := $(shell find . \ - -name 'test-*' \ - -a ! -name 'test-combine*.js'\ -) -cases := $(shell find . \ - -name '*Test.*' \ -) -tests_combine := test-combine*.js - -.PHONY: FORCE test test-combine suite - - -default: $(tests) suite combine -combine: $(tests_combine) - -suite: - @echo "ease.js Test Suite" - @echo - @NODE_PATH=".:$(NODE_PATH)" node --stack_trace_limit=20 runner.js ${cases} -%.js: FORCE - NODE_PATH=".:$(NODE_PATH)" node --stack_trace_limit=20 "$@" -test-%: FORCE - ./$@ diff --git a/test/runner.js b/test/runner.js index 264c47d..487fbc3 100644 --- a/test/runner.js +++ b/test/runner.js @@ -40,7 +40,7 @@ process.argv.forEach( function( val, i ) } // the tests will run themselves; we need only require 'em - require( __dirname + '/' + val ); + require( val ); } ); // output statistics