Separate unit test Makefile commands to separate variables for readability.
Also add more debug info for the make.
This commit is contained in:
parent
43b57f9e49
commit
58a2919ef7
@ -1,47 +1,79 @@
|
|||||||
# Create temporary profile directory name.
|
# Create temporary profile directory name.
|
||||||
TEMP_PROFILE_DIR:=./test_reports/temp_profile
|
TEMP_PROFILE:=./test_reports/temp_profile
|
||||||
|
|
||||||
# These are the Firefox command line arguments.
|
# These are the Firefox command line arguments.
|
||||||
FIREFOX_ARGS:=-no-remote -profile $(TEMP_PROFILE_DIR)
|
FIREFOX_ARGS:=-no-remote -profile $(TEMP_PROFILE)
|
||||||
|
|
||||||
# These are the Chrome command line arguments.
|
# These are the Chrome command line arguments.
|
||||||
CHROME_ARGS:=--user-data-dir=$(TEMP_PROFILE_DIR) --no-first-run --disable-sync
|
CHROME_ARGS:=--user-data-dir=$(TEMP_PROFILE) --no-first-run --disable-sync
|
||||||
|
|
||||||
# Unit test uses the manifest from ref test to determine which browsers will
|
# Unit test uses the manifest from ref test to determine which browsers will
|
||||||
# be used for running the unit tests.
|
# be used for running the unit tests.
|
||||||
MANIFEST:=../resources/browser_manifests/browser_manifest.json
|
MANIFEST:=../resources/browser_manifests/browser_manifest.json
|
||||||
|
|
||||||
|
# This is a helper function to separate multiple browsers to their own lines
|
||||||
|
# for an easier sed operation.
|
||||||
|
SPLIT_LINES:=sed 's|,|,\n|g'
|
||||||
|
|
||||||
|
# This is a helper function to join multiple lines together.
|
||||||
|
JOIN_LINES:=tr -d '\n'
|
||||||
|
|
||||||
# Fetch the paths to browsers that are going to be used in testing.
|
# Fetch the paths to browsers that are going to be used in testing.
|
||||||
# For OS X the path to the binary needs to be added.
|
# For OS X the path to the binary needs to be added.
|
||||||
# Add the browser arguments for each browser.
|
# Add the browser arguments for each browser.
|
||||||
# Create random profile directory for each browser.
|
# Create random profile directory for each browser.
|
||||||
# Replace " with @@@@ so that echoing do not destroy the quotation marks.
|
BROWSERS_PATHS:=$(shell echo `\
|
||||||
BROWSERS_WITH_UKNOWN_RANDOM_PROFILE_PATHS:=$(shell echo `\
|
|
||||||
sed -n 's|.*"path":\(.*\)|\1,|p' $(MANIFEST) | \
|
sed -n 's|.*"path":\(.*\)|\1,|p' $(MANIFEST) | \
|
||||||
|
$(JOIN_LINES) \
|
||||||
|
`)
|
||||||
|
|
||||||
|
# The browser_manifest.json file has only the app directory for mac browsers.
|
||||||
|
# The absolute path to the browser binary needs to be used.
|
||||||
|
BROWSERS_PATHS_WITH_MAC_CORRECTION:=$(shell echo '$(BROWSERS_PATHS)' | \
|
||||||
|
$(SPLIT_LINES) | \
|
||||||
sed 's|\(Aurora\.app\)|\1/Contents/MacOS/firefox-bin|' | \
|
sed 's|\(Aurora\.app\)|\1/Contents/MacOS/firefox-bin|' | \
|
||||||
sed 's|\(Firefox.*\.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|\(Google Chrome\.app\)|\1/Contents/MacOS/Google Chrome|' | \
|
||||||
sed "s|\(irefox.*\)\",|\1;$(FIREFOX_ARGS)\",|" | \
|
$(JOIN_LINES) \
|
||||||
sed "s|\(hrome.*\)\",|\1;$(CHROME_ARGS)\",|" | \
|
)
|
||||||
|
|
||||||
|
# Replace " with @@@@ so that echoing do not destroy the quotation marks.
|
||||||
|
QUOTATION_MARK:=\"
|
||||||
|
SUBSTITUTE_FOR_QUOTATION_MARK:=@@@@
|
||||||
|
|
||||||
|
# Each of the browser can have their ow separate arguments.
|
||||||
|
BROWSERS_WITH_ARGUMENTS:=$(shell echo '$(BROWSERS_PATHS_WITH_MAC_CORRECTION)' | \
|
||||||
|
$(SPLIT_LINES) | \
|
||||||
|
sed "s|\(irefox.*\)\($(QUOTATION_MARK)\),|\1;$(FIREFOX_ARGS)\2,|" | \
|
||||||
|
sed "s|\(hrome.*\)\($(QUOTATION_MARK)\),|\1;$(CHROME_ARGS)\2,|" | \
|
||||||
|
$(JOIN_LINES) \
|
||||||
|
)
|
||||||
|
|
||||||
|
# A temporary profile directory is needed for each of the browser. In this way
|
||||||
|
# a unit test run will not disturb the main browsing session of the user. The
|
||||||
|
# $RANDOM shell variable is used to generate non-conflicting temporary
|
||||||
|
# directories.
|
||||||
|
BROWSERS_WITH_UKNOWN_RANDOM_PROFILE_PATHS:=$(shell echo '$(BROWSERS_WITH_ARGUMENTS)' | \
|
||||||
|
$(SPLIT_LINES) | \
|
||||||
sed 's|\(temp_profile\)|\1_$$(echo $$RANDOM$$RANDOM)|' | \
|
sed 's|\(temp_profile\)|\1_$$(echo $$RANDOM$$RANDOM)|' | \
|
||||||
sed 's|"|@@@@|g' | \
|
sed "s|$(QUOTATION_MARK)|$(SUBSTITUTE_FOR_QUOTATION_MARK)|g" | \
|
||||||
tr -d '\n' \
|
$(JOIN_LINES) \
|
||||||
`)
|
)
|
||||||
|
|
||||||
# Echo the variable so that the unknown random directories become known.
|
# Echo the variable so that the unknown random directories become known.
|
||||||
# Replace @@@@ with " so that jsTestDriver will work properly.
|
# Replace @@@@ with " so that jsTestDriver will work properly.
|
||||||
BROWSERS:=$(shell echo "$(BROWSERS_WITH_UKNOWN_RANDOM_PROFILE_PATHS)" | \
|
BROWSERS:=$(shell echo "$(BROWSERS_WITH_UKNOWN_RANDOM_PROFILE_PATHS)" | \
|
||||||
sed 's|@@@@|"|g' \
|
sed "s|$(SUBSTITUTE_FOR_QUOTATION_MARK)|$(QUOTATION_MARK)|g" \
|
||||||
)
|
)
|
||||||
|
|
||||||
# Split the browsers to separate lines.
|
|
||||||
# Get the known random directories for browsers. This information will be used
|
# Get the known random directories for browsers. This information will be used
|
||||||
# to create the profile directories beforehand.
|
# to create the profile directories beforehand. Create also the dummy temp
|
||||||
# Join the separate lines back together.
|
# profile directory so that the mkdir command would not fail for browsers that
|
||||||
PROFILES:=$(shell echo $(BROWSERS) | \
|
# do not need it.
|
||||||
sed 's|,|\n|g' | \
|
PROFILES:=$(TEMP_PROFILE) $(shell echo '$(BROWSERS)' | \
|
||||||
|
$(SPLIT_LINES) | \
|
||||||
sed -n "s|.*\(\..*_[0-9]\+\).*|\1 |p" | \
|
sed -n "s|.*\(\..*_[0-9]\+\).*|\1 |p" | \
|
||||||
tr -d '\n' \
|
$(JOIN_LINES) \
|
||||||
)
|
)
|
||||||
|
|
||||||
# This is the command to invoke the unit test.
|
# This is the command to invoke the unit test.
|
||||||
@ -57,7 +89,13 @@ PROG:=java \
|
|||||||
--testOutput ./test_reports/
|
--testOutput ./test_reports/
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@echo 'Debug random profile paths: $(BROWSERS_WITH_UKNOWN_RANDOM_PROFILE_PATHS)'
|
@echo 'Debug browsers paths: $(BROWSERS_PATHS)'
|
||||||
|
@echo
|
||||||
|
@echo 'Debug browsers paths with mac correction: $(BROWSERS_PATHS_WITH_MAC_CORRECTION)'
|
||||||
|
@echo
|
||||||
|
@echo 'Debug browsers with arguments: $(BROWSERS_WITH_ARGUMENTS)'
|
||||||
|
@echo
|
||||||
|
@echo 'Debug browsers random profile paths: $(BROWSERS_WITH_UKNOWN_RANDOM_PROFILE_PATHS)'
|
||||||
@echo
|
@echo
|
||||||
@echo 'Debug browsers: $(BROWSERS)'
|
@echo 'Debug browsers: $(BROWSERS)'
|
||||||
@echo
|
@echo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user