Mercurial > hg > ThermostatQA
view Makefile @ 167:7baba5d67a16
Fixes of gui tests and web storage tests, making tests more independent
* Makefile: added possibility to change backend for making screenshots
* Makefile: fixed problem with web storage (content of thermostat webapp
direcory is copied in /webaps/thermostat instead of *.war)
* Makefile: add coping configuration files to thermostat user directory,
which fixed problem of some tests relying on leftower configuration and
make it possible run them independently
* README.md: new informations about screenshot backends included
* src/org/thermostat/qa/framework/Patterns.java: new possible patterns for
some tabs added (versions of tabs highlighted under cursor)
* src/org/thermostat/qa/framework/ThermostatUtilities.java: thermostats jaas
configruation file is now passed to tomcat
* src/org/thermostat/qa/testsuites/GuiClientSmokeTest.java: adding 1 second
delay fixed problem, when test sometimes failed
* src/org/thermostat/qa/testsuites/GuiHostViewSmokeTest.java: window is now
not resized more than necessary (caused problem where part of the window
did not fit in lower resolution (1024x768) displays/vncs and test failed)
* patterns/1.1.0/noAA/ClientPreferencesDialog/connection_info_label.png:
added/updated pattern
* patterns/1.1.0/noAA/HostView/memory_tab_chsen.png: same as previous
* patterns/1.1.0/noAA/HostView/notes_tab.png: same as previous
* patterns/1.1.0/noAA/HostView/notes_tab_chosen.png: same as previous
* patterns/1.1.0/noAA/HostView/memory_tab_chosen2.png: same as previous
* patterns/1.1.0/noAA/HostView/numa_tab_chosen2.png: same as previous
* patterns/1.1.0/noAA/HostView/processor_tab_chosen2.png: same as previous
author | Zdenek Zambersky <zzambers@redhat.com> |
---|---|
date | Fri, 21 Nov 2014 10:50:09 +0100 |
parents | e8ad3e5e4893 |
children | 1d7ab9111fd2 |
line wrap: on
line source
# ThermostatQA # # Copyright (C) 2013 Red Hat # SOURCE_DIR=src BUILD_DIR=bin CLASSES_DIR=$(BUILD_DIR)/classes CLASSES_TEMP_DIR=$(BUILD_DIR)/.classes REPORT_DIR=reports LOGS_DIR=logs TEMPLATE_DIR=templates SCREENSHOTS_DIR=screenshots JAVAC=javac JAVA=java DAILY_REPORT_NAME=daily_report.txt #JAVA=/opt/jdk1.7.0_07/bin/java ROOT_PACKAGE=org/thermostat/qa ANNOTATIONS_PACKAGE=$(ROOT_PACKAGE)/annotations COMMON_PACKAGE=$(ROOT_PACKAGE)/common FRAMEWORK_PACKAGE=$(ROOT_PACKAGE)/framework REPORTER_PACKAGE=$(ROOT_PACKAGE)/reporter TEST_PACKAGE=$(ROOT_PACKAGE)/testsuites FLOTR_NAME=prototype.flotr-0.2.0-alpha FLOTR_ARCHIVE=$(FLOTR_NAME).zip FLOTR_ADDRESS=http://flotr.googlecode.com/files/$(FLOTR_ARCHIVE) FLOTR_DIR=$(BUILD_DIR)/flotr FLOTR_LIB_DIR=$(FLOTR_DIR)/lib TOMCAT_VERSION=7.0.56 TOMCAT_NAME=apache-tomcat-$(TOMCAT_VERSION) TOMCAT_ARCHIVE=$(TOMCAT_NAME).tar.gz 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) 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 SCREENSHOT_SOURCE=robot GNOME_KEYRING_USER_DATA_DIR=$(shell realpath -m "$(BUILD_DIR)/.gnome-keyring" ) JAVADOC_DIR=$(REPORT_DIR)/javadoc KILL_DAEMONS=0 DATE=`date +%Y-%0m-%0d` # all *.java files in src directory ALL_SOURCES = $(shell find src -name *.java | tr '\n' ' ') # all testsuites ( in $(SOURCE_DIR)/$(TEST_PACKAGE) package ) TESTS = $(shell ls -1 $(SOURCE_DIR)/$(TEST_PACKAGE) | sed -n -e 's/\([A-Za-z0-9]*\)\.java/\1/p') .PHONY: all all: build runtests #### clean #### clean: rm -rf $(JAVADOC_DIR) rm -rf $(BUILD_DIR) cleanlogs: clean_logs clean_logs: rm -rf $(LOGS_DIR)/$(DATE) clean_all_logs: rm -rf $(LOGS_DIR) clean_all: rm -rf $(JAVADOC_DIR) rm -rf $(BUILD_DIR) rm -rf $(SCREENSHOTS_DIR) rm -rf $(LOGS_DIR) #### build #### .PHONY: build build: $(CLASSES_DIR) $(BUILD_DIR): mkdir -p $(BUILD_DIR) $(CLASSES_DIR): | ${BUILD_DIR} rm -rf $(CLASSES_TEMP_DIR) mkdir -p $(CLASSES_TEMP_DIR) $(JAVAC) -d $(CLASSES_TEMP_DIR) -sourcepath $(SOURCE_DIR)/ $(ALL_SOURCES) mkdir -p $(shell dirname $(CLASSES_DIR) ) mv -T $(CLASSES_TEMP_DIR) $(CLASSES_DIR) #### test #### .PHONY: runtests runtests: $(TESTS) $(TESTS): build tomcat thermostat testwarning | $(GNOME_KEYRING_USER_DATA_DIR) mkdir -p $(SCREENSHOTS_DIR) mkdir -p $(LOGS_DIR) mkdir -p $(LOGS_DIR)/$(DATE) # stop mongo database if running killall mongod || true # copy storage config files cp storageconfig/$(THERMOSTAT_VERSION)/db-mongodb/agent.auth \ $(THERMOSTAT_USER_DIR)/etc/ cp storageconfig/$(THERMOSTAT_VERSION)/db-mongodb/agent.properties \ $(THERMOSTAT_USER_DIR)/etc/ cp storageconfig/$(THERMOSTAT_VERSION)/db-mongodb/client.properties \ $(THERMOSTAT_USER_DIR)/etc/ # (re)start gnome-keyring-daemon with custom configuration killall gnome-keyring-daemon || true export XDG_DATA_HOME="$(GNOME_KEYRING_USER_DATA_DIR)" ; \ gnome-keyring-daemon --start --components=secrets # start test with overwriten USER_THERMOSTAT_HOME and required parameters USER_THERMOSTAT_HOME=$(THERMOSTAT_USER_DIR) \ $(JAVA) -cp $(CLASSES_DIR) \ -Dtomcat.home=$(TOMCAT_DIR) \ -Dthermostat.home=$(THERMOSTAT_DIR)/distribution/target/image \ -Dthermostat.user.home=$(THERMOSTAT_USER_DIR) \ -Dthermostat.executable.name=thermostat \ -Dthermostat.executable.path=$(THERMOSTAT_DIR)/distribution/target/image/bin \ -Dthermostat.version=$(THERMOSTAT_VERSION) \ -Dscreenshot.source=$(SCREENSHOT_SOURCE) \ -Dclean.after.gui.test=true \ $(TEST_PACKAGE).$@ 2>&1 | tee $(LOGS_DIR)/$(DATE)/$@.log # stop gnome-keyring-daemon with custom config after test killall gnome-keyring-daemon; .PHONY: testwarning testwarning: @# if KILL_DAEMONS != 1 and mongo or gnome keyring is running @# warn user that they need to be killed @ps aux | grep -v "grep" | grep -q "mongod" ; \ mongo=$$? ; \ ps aux | grep -v "grep" | grep -q "gnome-keyring-daemon" ; \ gnomekeyring=$$? ; \ if [ $(KILL_DAEMONS) -eq 0 ] && [ $$mongo -eq 0 -o $$gnomekeyring -eq 0 ] ; then \ echo "--------------------------------------------------------------------" ; \ echo "This test suite runs mongo database and gnome-keyring daemons with" ; \ echo "custom configuration, so it will kill any running instance of these" ; \ echo "daemons before start of testing." ; \ echo ; \ while true; do \ echo "Do you want to continue? (yes/no)" ; \ read answer ; \ case "$${answer}" in \ yes) \ break \ ;; \ no) \ echo "Canelling ..." ; \ exit 1 \ ;; \ *) \ echo "unrecognized answer: $${answer}" ; \ echo ; \ ;; \ esac \ done \ fi ; \ true .PHONY: listtests listtests: for tst in $(TESTS); do \ echo $$tst ; \ done #### reports & javadoc #### report: $(ALL_CLASSES) flotr javadoc mkdir -p $(REPORT_DIR) cp -u $(TEMPLATE_DIR)/style.css $(REPORT_DIR)/style.css cp -r $(FLOTR_DIR) $(REPORT_DIR) $(JAVA) -cp $(CLASSES_DIR) org.thermostat.qa.reporter.Reporter -template-dir=$(TEMPLATE_DIR) -log-dir=$(LOGS_DIR) -report-dir=$(REPORT_DIR) -date=$(DATE) -tests="$(TESTS)" sed -i 's/ignored/not applicable/g' $(REPORT_DIR)/log_$(DATE).html sed -i 's/IGNORED/NOT APPLICABLE/g' $(REPORT_DIR)/log_$(DATE).html links -dump $(REPORT_DIR)/index.html 2>/dev/null > $(REPORT_DIR)/$(DAILY_REPORT_NAME) || \ w3m -dump $(REPORT_DIR)/index.html 2>/dev/null > $(REPORT_DIR)/$(DAILY_REPORT_NAME) || \ lynx -dump $(REPORT_DIR)/index.html -force_html 2>/dev/null > $(REPORT_DIR)/$(DAILY_REPORT_NAME) echo "" >> $(REPORT_DIR)/$(DAILY_REPORT_NAME) echo "" >> $(REPORT_DIR)/$(DAILY_REPORT_NAME) links -dump $(REPORT_DIR)/log_$(DATE).html 2>/dev/null >> $(REPORT_DIR)/$(DAILY_REPORT_NAME) || \ w3m -dump $(REPORT_DIR)/log_$(DATE).html 2>/dev/null >> $(REPORT_DIR)/$(DAILY_REPORT_NAME) || \ lynx -dump $(REPORT_DIR)/log_$(DATE).html -force_html 2>/dev/null >> $(REPORT_DIR)/$(DAILY_REPORT_NAME) echo "" >> $(REPORT_DIR)/$(DAILY_REPORT_NAME) echo "" >> $(REPORT_DIR)/$(DAILY_REPORT_NAME) links -dump $(REPORT_DIR)/hist_10.html 2>/dev/null >> $(REPORT_DIR)/$(DAILY_REPORT_NAME) || \ w3m -dump $(REPORT_DIR)/hist_10.html 2>/dev/null >> $(REPORT_DIR)/$(DAILY_REPORT_NAME) || \ lynx -dump $(REPORT_DIR)/hist_10.html -force_html 2>/dev/null >> $(REPORT_DIR)/$(DAILY_REPORT_NAME) javadoc: mkdir -p $(JAVADOC_DIR) javadoc -d $(JAVADOC_DIR) -classpath src org.thermostat.qa.testsuites cp -r patterns $(JAVADOC_DIR)/org/thermostat/qa/testsuites/ cp -r scripts $(JAVADOC_DIR)/org/thermostat/qa/testsuites/ #### other #### #create a directory outputtexts/versionN for the current version #of the output_texts (can be found in the test.properties) #generate output help messages into files generatetexts: $(ALL_CLASSES) mkdir -p outputtexts mkdir -p outputtexts/`cat test.properties | grep thermostat_version | sed -e 's/^.*=//g;s/$$//g'` $(JAVA) -cp $(CLASSES_DIR) org.thermostat.qa.framework.ThermostatOutputTextsGenerator #make icons in given dir smaller / remove unnecessary pixels cuticons: $(ALL_CLASSES) $(JAVA) -cp $(CLASSES_DIR) org.thermostat.qa.framework.IconCut #generate pattern defs on std output patternsdef: $(ALL_CLASSES) $(JAVA) -cp $(CLASSES_DIR) org.thermostat.qa.framework.PatternDefinitionsGenerator #### OTHER SOFTWARE #### #### FLOTR #### .PHONY: flotr flotr: $(FLOTR_DIR)/flotr-0.2.0-alpha.js $(FLOTR_LIB_DIR)/canvas2image.js $(FLOTR_LIB_DIR)/canvastext.js $(FLOTR_LIB_DIR)/prototype-1.6.0.2.js $(FLOTR_DIR)/flotr-0.2.0-alpha.js: $(BUILD_DIR)/$(FLOTR_ARCHIVE) mkdir -p $(FLOTR_DIR) unzip -j -o $? flotr-0.2.0-alpha/flotr/flotr-0.2.0-alpha.js -d $(FLOTR_DIR) $(FLOTR_LIB_DIR)/canvas2image.js: $(BUILD_DIR)/$(FLOTR_ARCHIVE) mkdir -p $(FLOTR_LIB_DIR) unzip -j -o $? flotr-0.2.0-alpha/flotr/lib/canvas2image.js -d $(FLOTR_LIB_DIR) $(FLOTR_LIB_DIR)/canvastext.js: $(BUILD_DIR)/$(FLOTR_ARCHIVE) mkdir -p $(FLOTR_LIB_DIR) unzip -j -o $? flotr-0.2.0-alpha/flotr/lib/canvastext.js -d $(FLOTR_LIB_DIR) $(FLOTR_LIB_DIR)/prototype-1.6.0.2.js: $(BUILD_DIR)/$(FLOTR_ARCHIVE) mkdir -p $(FLOTR_LIB_DIR) unzip -j -o $? flotr-0.2.0-alpha/flotr/lib/prototype-1.6.0.2.js -d $(FLOTR_LIB_DIR) $(BUILD_DIR)/$(FLOTR_ARCHIVE): wget -P $(BUILD_DIR) $(FLOTR_ADDRESS) #### TOMCAT #### .PHONY: tomcat tomcat: | $(TOMCAT_DIR) $(TOMCAT_DIR): | $(BUILD_DIR) wget -P $(BUILD_DIR) $(TOMCAT_URL) tar xf $(BUILD_DIR)/$(TOMCAT_ARCHIVE) -C $(BUILD_DIR) if [ "$(BUILD_DIR)/$(TOMCAT_NAME)" != "$(TOMCAT_DIR)" ] ; then \ mkdir -p "$(TOMCAT_DIR)" ; \ mv -T "$(BUILD_DIR)/$(TOMCAT_NAME)" "$(TOMCAT_DIR)" ; \ fi #### THERMOSTAT #### .PHONY: thermostat thermostat: thermostat-build thermostat-setup .PHONY: thermostat-setup thermostat-setup: $(THERMOSTAT_WEB_DEPLOY_DIR) | $(THERMOSTAT_USER_DIR)/data/setup-complete.stamp $(THERMOSTAT_USER_DIR)/data/setup-complete.stamp: | $(THERMOSTAT_USER_DIR) $(THERMOSTAT_DIR)/distribution/target/image # init storage and add agent-tester and client-tester users in custom user dir killall mongod || true export USER_THERMOSTAT_HOME=$(THERMOSTAT_USER_DIR) &&\ if [ -f "$(THERMOSTAT_DIR)/distribution/target/image/bin/thermostat-devsetup" ] ; then \ $(THERMOSTAT_DIR)/distribution/target/image/bin/thermostat-devsetup; \ fi &&\ $(THERMOSTAT_DIR)/distribution/target/image/bin/thermostat storage --start &&\ echo -e \ "use thermostat\n\ db.auth(\"mongodevuser\", \"mongodevpassword\")\n\ db.addUser(\"agent-tester\",\"heslo1\")\n\ db.addUser(\"client-tester\",\"heslo2\")\n\ exit\n" \ | mongo 127.0.0.1:27518; \ $(THERMOSTAT_DIR)/distribution/target/image/bin/thermostat storage --stop $(THERMOSTAT_USER_DIR): | $(THERMOSTAT_DIR) mkdir -p $(THERMOSTAT_USER_DIR) $(THERMOSTAT_WEB_DEPLOY_DIR): tomcat thermostat-build rm -rf $(THERMOSTAT_WEB_DEPLOY_DIR) mkdir -p $(THERMOSTAT_WEB_DEPLOY_DIR) cp -rT "$$( echo $(THERMOSTAT_DIR)/web/war/target/*.war | sed 's/.war$$//g' )" $(THERMOSTAT_WEB_DEPLOY_DIR) .PHONY: thermostat-build thermostat-build: | $(THERMOSTAT_DIR)/distribution/target/image $(THERMOSTAT_DIR)/distribution/target/image: | $(THERMOSTAT_DIR)/pom.xml cd $(THERMOSTAT_DIR) &&\ mvn -Dmaven.test.skip=true clean install $(THERMOSTAT_DIR)/pom.xml: | $(THERMOSTAT_DIR) hg clone $(THERMOSTAT_REPO_URL) $(THERMOSTAT_DIR) $(THERMOSTAT_DIR): | ${BUILD_DIR} mkdir -p $(THERMOSTAT_DIR) #### GNOME KEYRING #### $(GNOME_KEYRING_USER_DATA_DIR): # 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)