1
0
Fork 0

Tests now work properly with auto* and no longer require minified files

perfodd
Mike Gerwitz 2013-12-22 22:44:41 -05:00
parent 8b83add95f
commit 897b68e3e0
4 changed files with 60 additions and 80 deletions

View File

@ -1,4 +1,22 @@
## ease.js Makefile.am ## 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 <http://www.gnu.org/licenses/>.
##
# see README # see README
SUBDIRS = doc SUBDIRS = doc
@ -16,23 +34,20 @@ path_lib = $(top_builddir)/lib
path_test = $(top_builddir)/test path_test = $(top_builddir)/test
path_doc = $(top_builddir)/doc path_doc = $(top_builddir)/doc
path_perf_test = $(path_test)/perf
path_combine_output = $(path_build)/ease.js path_combine_output = $(path_build)/ease.js
path_combine_output_full = $(path_build)/ease-full.js path_combine_output_full = $(path_build)/ease-full.js
path_browser_test = $(path_tools)/browser-test.html path_browser_test = $(path_tools)/browser-test.html
src_js = @SRC_JS@ src_js = @SRC_JS@
perf_tests = @PERF_TESTS@
path_externs_internal = $(path_build)/externs-internal.js path_externs_internal = $(path_build)/externs-internal.js
combine = $(path_tools)/combine combine = $(path_tools)/combine
compiler = @CCJAR@ compiler = @CCJAR@
MKDIR_P = @MKDIR_P@ 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 default: combine
all-local: combine min
mkbuild: $(path_build) mkbuild: $(path_build)
@ -83,12 +98,11 @@ doc:
$(MAKE) -C "$(path_doc)" $(MAKE) -C "$(path_doc)"
test: check test: check
check: default check: @SRC_TESTS@ test-suite
$(MAKE) -C "$(path_test)"
# performance tests # performance tests
perf: default $(perf_tests) perf: @PERF_TESTS@
perf-%.js: default perf-%.js: FORCE
if HAS_NODE if HAS_NODE
@$(NODE) $@ @$(NODE) $@
else else
@ -96,6 +110,24 @@ else
@exit 1 @exit 1
endif 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 # generate the familiar files that automake normally checks for
dist-hook: AUTHORS NEWS ChangeLog dist-hook: AUTHORS NEWS ChangeLog
cp $? $(distdir) cp $? $(distdir)

View File

@ -57,30 +57,6 @@ else
AC_MSG_ERROR(failed!) AC_MSG_ERROR(failed!)
fi 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 # Java is used for Closure Compiler
AC_ARG_VAR([JAVA], [The Java executable]) AC_ARG_VAR([JAVA], [The Java executable])
AC_ARG_VAR([CCJAR], [The Clojure Compiler jar file]) 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"]) 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_CONFIG_FILES([Makefile doc/Makefile package.json lib/version.js])
AC_OUTPUT AC_OUTPUT

View File

@ -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 <http://www.gnu.org/licenses/>.
##
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
./$@

View File

@ -40,7 +40,7 @@ process.argv.forEach( function( val, i )
} }
// the tests will run themselves; we need only require 'em // the tests will run themselves; we need only require 'em
require( __dirname + '/' + val ); require( val );
} ); } );
// output statistics // output statistics