view Makefile @ 368:7d807b490b62 draft default tip

Seven new tests added into ScriptContextTest.
author ptisnovs
date Tue, 27 May 2014 08:54:25 +0200
parents dea9193daa78
children
line wrap: on
line source

#   Rhino test framework
# 
#    Copyright (C) 2011, 2012  Red Hat
# 
# This file is part of IcedTea.
# 
# IcedTea 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 2, or (at your option)
# any later version.
# 
# IcedTea 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 IcedTea; see the file COPYING.  If not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
# 
# Linking this library statically or dynamically with other modules is
# making a combined work based on this library.  Thus, the terms and
# conditions of the GNU General Public License cover the whole
# combination.
# 
# As a special exception, the copyright holders of this library give you
# permission to link this library with independent modules to produce an
# executable, regardless of the license terms of these independent
# modules, and to copy and distribute the resulting executable under
# terms of your choice, provided that you also meet, for each linked
# independent module, the terms and conditions of the license of that
# module.  An independent module is a module which is not derived from
# or based on this library.  If you modify this library, you may extend
# this exception to your version of the library, but you are not
# obligated to do so.  If you do not wish to do so, delete this
# exception statement from your version.

SOURCE_DIR=src
BUILD_DIR=build
SCRIPTS=scripts
OUTPUT_DIR=output
REPORT_DIR=reports
LOGS_DIR=logs
TEMPLATE_DIR=templates
JAVAC=javac
JAVA=java
TEST_PACKAGE=org/RhinoTests
TEST_CLASSES_PACKAGE=org/RhinoTests/TestClasses
REPORTER_PACKAGE=org/RhinoTests/Reporter
DATE=`date +%Y-%0m-%0d`

TESTS = \
	ScriptEngineManagerTest \
	ScriptEngineManagerClassTest \
	ScriptEngineTest \
	ScriptEngineClassTest \
	ScriptEngineFactoryTest \
	ScriptEngineFactoryClassTest \
	JavaScriptsTest \
	BindingsTest \
	BindingsClassTest \
	CompilableTest \
	CompilableClassTest \
	CompiledScriptTest \
	CompiledScriptClassTest \
	InvocableTest \
	InvocableClassTest \
	ScriptContextTest \
	ScriptContextClassTest \
	ScriptExceptionTest \
	ScriptExceptionClassTest \
	SimpleBindingsTest \
	SimpleBindingsClassTest \
	SimpleScriptContextTest \
	SimpleScriptContextClassTest \
	AbstractScriptEngineClassTest

ALL_CLASSES = \
	$(BUILD_DIR)/$(TEST_CLASSES_PACKAGE)/TestClass.class \
	$(BUILD_DIR)/$(REPORTER_PACKAGE)/CommandLineParameters.class \
	$(BUILD_DIR)/$(REPORTER_PACKAGE)/FileUtils.class \
	$(BUILD_DIR)/$(REPORTER_PACKAGE)/GraphPagesGenerator.class \
	$(BUILD_DIR)/$(REPORTER_PACKAGE)/HistoryPagesGenerator.class \
	$(BUILD_DIR)/$(REPORTER_PACKAGE)/IndexPageGenerator.class \
	$(BUILD_DIR)/$(REPORTER_PACKAGE)/LogPagesGenerator.class \
	$(BUILD_DIR)/$(REPORTER_PACKAGE)/StringUtils.class \
	$(BUILD_DIR)/$(REPORTER_PACKAGE)/TestResult.class \
	$(BUILD_DIR)/$(REPORTER_PACKAGE)/Reporter.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/Constants.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/BaseRhinoTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/BindingsTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/BindingsClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/CompilableTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/CompilableClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/CompiledScriptTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/CompiledScriptClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/InvocableTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/InvocableClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/JavaScriptsTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/ScriptContextTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/ScriptContextClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/ScriptEngineFactoryTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/ScriptEngineFactoryClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/ScriptEngineManagerTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/ScriptEngineManagerClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/ScriptEngineTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/ScriptEngineClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/ScriptExceptionTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/ScriptExceptionClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/SimpleBindingsTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/SimpleBindingsClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/SimpleScriptContextTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/SimpleScriptContextClassTest.class \
	$(BUILD_DIR)/$(TEST_PACKAGE)/AbstractScriptEngineClassTest.class

ALL_SCRIPTS = \
	$(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)/test_hello_world.js \
	$(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)/test_empty_script_1.js \
	$(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)/test_invalid_command_1.js \
	$(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)/test_invalid_command_2.js \
	$(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)/test_invalid_command_3.js \
	$(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)/test_invalid_parameter.js \
	$(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)/test_unknown_function.js

all:	build runtests

build:	builddir $(ALL_CLASSES) $(ALL_SCRIPTS)

builddir:
	mkdir -p build

runtests:	$(ALL_CLASSES)
	mkdir -p $(LOGS_DIR)
	mkdir -p $(LOGS_DIR)/$(DATE)
	for tst in $(TESTS); do \
	$(JAVA) -cp $(BUILD_DIR) org.RhinoTests.$$tst 2>&1 | tee $(LOGS_DIR)/$(DATE)/$$tst.log ; \
	done

# targets for all test suites
TESTSUITES = $(shell ls -1 $(SOURCE_DIR)/$(TEST_PACKAGE) | sed -n -e 's/\([A-Za-z0-9]*\)\.java/\1/p')

$(TESTSUITES):	build
	mkdir -p $(LOGS_DIR)
	mkdir -p $(LOGS_DIR)/$(DATE)
	$(JAVA) -cp $(BUILD_DIR) $(TEST_PACKAGE).$@ 2>&1 | tee $(LOGS_DIR)/$(DATE)/$@.log

listtests:
	for tst in $(TESTS); do \
	echo $$tst ; \
	done

report:	$(ALL_CLASSES)
	mkdir -p $(REPORT_DIR)
	cp -u $(TEMPLATE_DIR)/style.css $(REPORT_DIR)/style.css
	$(JAVA) -cp $(BUILD_DIR) org.RhinoTests.Reporter.Reporter -template-dir=$(TEMPLATE_DIR) -log-dir=$(LOGS_DIR) -report-dir=$(REPORT_DIR) -date=$(DATE) -tests="$(TESTS)"

clean:
	rm -rf $(BUILD_DIR)/org
	rmdir build

cleanlogs: clean_logs

clean_logs:
	rm -rf $(LOGS_DIR)/$(DATE)

clean_all_logs:
	rm -rf $(LOGS_DIR)

$(BUILD_DIR)/$(TEST_PACKAGE)/%.class:	$(SOURCE_DIR)/$(TEST_PACKAGE)/%.java
	$(JAVAC) -d $(BUILD_DIR) -sourcepath $(SOURCE_DIR)/ $<

$(BUILD_DIR)/$(REPORTER_PACKAGE)/%.class:	$(SOURCE_DIR)/$(REPORTER_PACKAGE)/%.java
	$(JAVAC) -d $(BUILD_DIR) -sourcepath $(SOURCE_DIR)/ $<

$(BUILD_DIR)/$(TEST_CLASSES_PACKAGE)/%.class:	$(SOURCE_DIR)/$(TEST_CLASSES_PACKAGE)/%.java
	$(JAVAC) -d $(BUILD_DIR) -sourcepath $(SOURCE_DIR)/ $<

$(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)/%.js:	 $(SCRIPTS)/%.js $(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)/stamp
	cp $< $@

$(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)/stamp:
	mkdir $(BUILD_DIR)/$(TEST_PACKAGE)/$(SCRIPTS)
	touch $@