2011-12-15 07:51:10 +09:00
|
|
|
# Create temporary profile directory name.
|
2011-12-21 08:21:15 +09:00
|
|
|
TEMP_PROFILE_DIR:=./test_reports/temp_profile
|
2011-12-15 07:51:10 +09:00
|
|
|
|
|
|
|
# These are the Firefox command line arguments.
|
2011-12-21 08:21:15 +09:00
|
|
|
FIREFOX_ARGS:=-no-remote -profile $(TEMP_PROFILE_DIR)
|
2011-12-15 07:51:10 +09:00
|
|
|
|
|
|
|
# These are the Chrome command line arguments.
|
2011-12-21 08:21:15 +09:00
|
|
|
CHROME_ARGS:=--user-data-dir=$(TEMP_PROFILE_DIR) --no-first-run --disable-sync
|
2011-12-15 07:51:10 +09:00
|
|
|
|
|
|
|
# Unit test uses the manifest from ref test to determine which browsers will
|
|
|
|
# be used for running the unit tests.
|
2011-12-21 08:21:15 +09:00
|
|
|
MANIFEST:=../resources/browser_manifests/browser_manifest.json
|
2011-12-15 07:51:10 +09:00
|
|
|
|
2011-11-27 03:24:39 +09:00
|
|
|
# Fetch the paths to browsers that are going to be used in testing.
|
2011-12-21 08:15:51 +09:00
|
|
|
# For OS X the path to the binary needs to be added.
|
|
|
|
# Add the browser arguments for each browser.
|
|
|
|
# Create random profile directory for each browser.
|
|
|
|
# Replace " with @@@@ so that echoing do not destroy the quotation marks.
|
2011-12-21 08:21:15 +09:00
|
|
|
BROWSERS_WITH_UKNOWN_RANDOM_PROFILE_PATHS:=$(shell echo `\
|
2011-12-16 07:23:23 +09:00
|
|
|
sed -n 's|.*"path":\(.*\)|\1,|p' $(MANIFEST) | \
|
|
|
|
sed 's|\(Aurora\.app\)|\1/Contents/MacOS/firefox-bin|' | \
|
|
|
|
sed 's|\(Firefox.*\.app\)|\1/Contents/MacOS/firefox-bin|' | \
|
|
|
|
sed 's|\(Google Chrome\.app\)|\1/Contents/MacOS/Google Chrome|' | \
|
|
|
|
sed "s|\(irefox.*\)\",|\1;$(FIREFOX_ARGS)\",|" | \
|
|
|
|
sed "s|\(hrome.*\)\",|\1;$(CHROME_ARGS)\",|" | \
|
2011-12-21 08:15:51 +09:00
|
|
|
sed 's|\(temp_profile\)|\1_$$(echo $$RANDOM$$RANDOM)|' | \
|
|
|
|
sed 's|"|@@@@|g' | \
|
2011-12-16 07:23:23 +09:00
|
|
|
tr -d '\n' \
|
2011-12-11 21:18:40 +09:00
|
|
|
`)
|
2011-11-27 03:24:39 +09:00
|
|
|
|
2011-12-21 08:15:51 +09:00
|
|
|
# Echo the variable so that the unknown random directories become known.
|
|
|
|
# Replace @@@@ with " so that jsTestDriver will work properly.
|
|
|
|
BROWSERS:=$(shell echo "$(BROWSERS_WITH_UKNOWN_RANDOM_PROFILE_PATHS)" | \
|
|
|
|
sed 's|@@@@|"|g' \
|
|
|
|
)
|
|
|
|
|
|
|
|
# Split the browsers to separate lines.
|
|
|
|
# Get the known random directories for browsers. This information will be used
|
|
|
|
# to create the profile directories beforehand.
|
|
|
|
# Join the separate lines back together.
|
|
|
|
PROFILES:=$(shell echo $(BROWSERS) | \
|
|
|
|
sed 's|,|\n|g' | \
|
|
|
|
sed -n "s|.*\(\..*_[0-9]\+\).*|\1 |p" | \
|
|
|
|
tr -d '\n' \
|
|
|
|
)
|
|
|
|
|
2011-12-15 07:51:10 +09:00
|
|
|
# This is the command to invoke the unit test.
|
|
|
|
PROG:=java \
|
2011-11-27 03:24:39 +09:00
|
|
|
-Xms512m \
|
|
|
|
-Xmx1024m \
|
|
|
|
-jar ../../external/jsTestDriver/JsTestDriver-1.3.3d.jar \
|
2011-12-13 05:31:10 +09:00
|
|
|
--config ./jsTestDriver.conf \
|
2011-11-27 03:24:39 +09:00
|
|
|
--reset \
|
|
|
|
--port 4224 \
|
|
|
|
--browser $(BROWSERS) \
|
|
|
|
--tests all \
|
|
|
|
--testOutput ./test_reports/
|
2011-11-24 07:03:17 +09:00
|
|
|
|
|
|
|
test:
|
2011-12-23 05:33:16 +09:00
|
|
|
@echo 'Debug random profile paths: $(BROWSERS_WITH_UKNOWN_RANDOM_PROFILE_PATHS)'
|
|
|
|
@echo
|
|
|
|
@echo 'Debug browsers: $(BROWSERS)'
|
|
|
|
@echo
|
|
|
|
@echo 'Debug profiles: $(PROFILES)'
|
|
|
|
@echo
|
|
|
|
@echo 'About to run command: mkdir -p $(PROFILES)'
|
2011-12-21 08:15:51 +09:00
|
|
|
@mkdir -p $(PROFILES)
|
2011-12-23 05:33:16 +09:00
|
|
|
@echo
|
|
|
|
@echo 'About to run command: $(PROG)'
|
2011-11-27 03:24:39 +09:00
|
|
|
$(PROG)
|
2011-12-23 05:33:16 +09:00
|
|
|
@echo
|
|
|
|
@echo 'About to run command: @rm -rf $(PROFILES)'
|
2011-12-21 08:15:51 +09:00
|
|
|
@rm -rf $(PROFILES)
|
2011-11-24 07:03:17 +09:00
|
|
|
|
|
|
|
.phony:: test
|
|
|
|
|