# HG changeset patch # User Zdenek Zambersky # Date 1426764306 -3600 # Node ID 661ca2d7795ff5133b91245e14ad15238138eafb # Parent 1d7ab9111fd225cf034499e4c7a73bdf437b48c9 Added makefile target to test API compatibility of two versions of thermostat diff -r 1d7ab9111fd2 -r 661ca2d7795f Makefile --- a/Makefile Tue Mar 10 13:48:12 2015 +0100 +++ b/Makefile Thu Mar 19 12:25:06 2015 +0100 @@ -38,12 +38,23 @@ TOMCAT_URL=http://apache.mirror.rafal.ca/tomcat/tomcat-$(shell echo "$(TOMCAT_VERSION)" | sed 's/\..*//g' )/v$(TOMCAT_VERSION)/bin/$(TOMCAT_ARCHIVE) TOMCAT_DIR=$(BUILD_DIR)/$(TOMCAT_NAME) +# refers to tested thermostat THERMOSTAT_VERSION=1.1.0 THERMOSTAT_REPO_URL=http://icedtea.classpath.org/hg/thermostat/ THERMOSTAT_USER_DIR=$(BUILD_DIR)/.thermostat THERMOSTAT_DIR=$(BUILD_DIR)/thermostat THERMOSTAT_WEB_DEPLOY_DIR=$(TOMCAT_DIR)/webapps/thermostat +# refers to thermostat against which compatibility is tested +THERMOSTAT_OTHER_VERSION=1.0 +THERMOSTAT_OTHER_DIR=$(BUILD_DIR)/thermostat-other +THERMOSTAT_OTHER_REPO_URL=http://icedtea.classpath.org/hg/release/thermostat-1.0/ + +JAPI_COMPILANCE_CHECKER_VERSION=1.3.7 +JAPI_COMPILANCE_CHECKER_NAME=japi-compliance-checker-$(JAPI_COMPILANCE_CHECKER_VERSION) +JAPI_COMPILANCE_CHECKER_URL=https://github.com/lvc/japi-compliance-checker/archive/$(JAPI_COMPILANCE_CHECKER_VERSION).tar.gz +JAPI_COMPILANCE_CHECKER_DIR=$(BUILD_DIR)/$(JAPI_COMPILANCE_CHECKER_NAME) + SCREENSHOT_SOURCE=xvfb GNOME_KEYRING_USER_DATA_DIR=$(shell realpath -m "$(BUILD_DIR)/.gnome-keyring" ) @@ -172,6 +183,9 @@ echo $$tst ; \ done +run-api-test: japi-compilance-checker | $(BUILD_DIR)/thermostat-tested.xml $(BUILD_DIR)/thermostat-other.xml + perl $(JAPI_COMPILANCE_CHECKER_DIR)/japi-compliance-checker.pl -lib Thermostat -old $(BUILD_DIR)/thermostat-other.xml -new $(BUILD_DIR)/thermostat-tested.xml || true + #### reports & javadoc #### report: $(CLASSES_DIR) flotr javadoc @@ -305,6 +319,19 @@ $(THERMOSTAT_DIR): | ${BUILD_DIR} mkdir -p $(THERMOSTAT_DIR) + +.PHONY: thermostat-other-build +thermostat-other-build: | $(THERMOSTAT_OTHER_DIR)/distribution/target/image + +$(THERMOSTAT_OTHER_DIR)/distribution/target/image: | $(THERMOSTAT_OTHER_DIR)/pom.xml + cd $(THERMOSTAT_OTHER_DIR) &&\ + mvn -Dmaven.test.skip=true clean install + +$(THERMOSTAT_OTHER_DIR)/pom.xml: | $(THERMOSTAT_OTHER_DIR) + hg clone $(THERMOSTAT_OTHER_REPO_URL) $(THERMOSTAT_OTHER_DIR) + +$(THERMOSTAT_OTHER_DIR): | ${BUILD_DIR} + mkdir -p $(THERMOSTAT_OTHER_DIR) #### GNOME KEYRING #### @@ -312,3 +339,37 @@ # create custom config directory for gnome-keyring and copy data there mkdir -p $(GNOME_KEYRING_USER_DATA_DIR) cp -r storageconfig/keyrings $(GNOME_KEYRING_USER_DATA_DIR) + +#### Java API Compliance Checker #### + +.PHONY: japi-compilance-checker +japi-compilance-checker: | $(JAPI_COMPILANCE_CHECKER_DIR)/japi-compliance-checker.pl + +$(JAPI_COMPILANCE_CHECKER_DIR)/japi-compliance-checker.pl: | $(BUILD_DIR)/$(JAPI_COMPILANCE_CHECKER_VERSION).tar.gz + mkdir -p $(JAPI_COMPILANCE_CHECKER_DIR) + tar xf $(BUILD_DIR)/$(JAPI_COMPILANCE_CHECKER_VERSION).tar.gz -C $(BUILD_DIR) + +$(BUILD_DIR)/$(JAPI_COMPILANCE_CHECKER_VERSION).tar.gz: + wget -P $(BUILD_DIR) $(JAPI_COMPILANCE_CHECKER_URL) + +$(BUILD_DIR)/thermostat-template.xml: thermostat-other-build + @# fill template with public packages listed in README.api of "other" thermostat + packages="$$( cat $(THERMOSTAT_OTHER_DIR)/README.api \ + | sed -n '1,/^Internal/p' \ + | grep com.redhat.thermostat \ + | sed "s/^.*com.redhat.thermostat/com.redhat.thermostat/g" )" ; \ + version="\$${version}" ; \ + archives="\$${archives}" ; \ + eval echo \""$$(cat $(TEMPLATE_DIR)/japi-compliance-checker-template.xml)"\" > $@ + +$(BUILD_DIR)/thermostat-other.xml: $(BUILD_DIR)/thermostat-template.xml thermostat-build thermostat-other-build + @# create xml for "other" thermostat by filling common template with its version and jars + version="$(THERMOSTAT_OTHER_VERSION)" ; \ + archives="$$( find $(THERMOSTAT_OTHER_DIR)/distribution/target/image/libs -name "*thermostat*.jar")" ; \ + eval echo \""$$(cat $(BUILD_DIR)/thermostat-template.xml)"\" > $@ + +$(BUILD_DIR)/thermostat-tested.xml: $(BUILD_DIR)/thermostat-template.xml thermostat-build thermostat-other-build + @# create xml for tested thermostat by filling common template with with its version and jars + version="$(THERMOSTAT_VERSION)" ; \ + archives="$$( find $(THERMOSTAT_DIR)/distribution/target/image/libs -name "*thermostat*.jar")" ; \ + eval echo \""$$(cat $(BUILD_DIR)/thermostat-template.xml)"\" > $@ diff -r 1d7ab9111fd2 -r 661ca2d7795f README.md --- a/README.md Tue Mar 10 13:48:12 2015 +0100 +++ b/README.md Thu Mar 19 12:25:06 2015 +0100 @@ -37,26 +37,31 @@ Important makefile targets -------------------------- -all builds project an runs tests +all builds project an runs tests + +build builds all classes -build builds all classes +runtests executes all test (automaticaly builds project and download + necessary software if needed) -runtests executes all test (automaticaly builds project and download - necessary software if needed) +listtests lists all available tests -listtests lists all available tests - - runs single test of that name + runs single test of that name + +run-api-test run test which checks api compatibility of tested thermostat + against "other" thermostat using Java API Compliance Checker + (also see THERMOSTAT_OTHER_* in "Important makefile variables" + section) -report generates report from tests (runtests is needed to be executed before) +report generates report from tests (runtests is needed to be + executed before) -javadoc generages javadoc +javadoc generages javadoc -thermostat clones, builds and sets-up thermostat (if necessary) +thermostat clones, builds and sets-up thermostat (if necessary) -tomcat downloads and unpacks apache-tomcat (if necessary) - +tomcat downloads and unpacks apache-tomcat (if necessary) Important makefile variables @@ -73,7 +78,9 @@ THERMOSTAT_REPO_URL : repository used to clone Thermostat for testing (default: http://icedtea.classpath.org/hg/thermostat/ ) -THERMOSTAT_VERSION : version for which ThermostatQA is configured +THERMOSTAT_VERSION : version for which ThermostatQA is configured. It is also + used to refer tested thermostat in api compatibility + report. (default: 1.1.0) THERMOSTAT_USER_DIR : directory used for thermostat user configuration during testing @@ -82,7 +89,15 @@ THERMOSTAT_DIR : directory with thermostat for testing (if present) or directory where to clone thermostat (if not present) - (default: /thermostat) + (default: /thermostat) + +THERMOSTAT_OTHER_* : same as THERMOSTAT_* but refers to thermostat against which + compatibility is tested. + (defaults: + THERMOSTAT_OTHER_DIR: /thermostat-other + THERMOSTAT_OTHER_VERSION: 1.0 + THERMOSTAT__OTHER_REPO_URL: + http://icedtea.classpath.org/hg/release/thermostat-1.0/) TOMCAT_DIR : directory with apache-tomcat used for testing (if present) or directory where to download thermostat (if not present) @@ -115,9 +130,23 @@ make THERMOSTAT_REPO_URL= -testing thermostat stored at custom path, using custom tomcat +testing thermostat stored at custom path, using custom tomcat: make THERMOSTAT_DIR= TOMCAT_DIR= + +testing api compatibility of tested thermostat against "other" version: + + make run-api-test THERMOSTAT_REPO_URL= \ + THERMOSTAT_OTHER_REPO_URL= \ + THERMOSTAT_OTHER_VERSION= + +same as previous but using previously downloaded thermostats: + + make run-api-test THERMOSTAT_DIR= \ + THERMOSTAT_OTHER_DIR= \ + THERMOSTAT_OTHER_VERSION= + +(urls and paths can also be combined) Side Effects diff -r 1d7ab9111fd2 -r 661ca2d7795f templates/japi-compliance-checker-template.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/japi-compliance-checker-template.xml Thu Mar 19 12:25:06 2015 +0100 @@ -0,0 +1,16 @@ + + + + +${version} + + + +${archives} + + + +${packages} + + +