forked from mozilla-b2g/gaia-email-libs-and-more
/
Makefile
145 lines (106 loc) · 4.84 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# full rsync
RSYNC=rsync -avL
# rsync JS files only, ignore jsdoc subdir.
RSYNC_JS=rsync -r -f "- jsdoc/" -f "+ */" -f "+ *.js" -f "- *" --prune-empty-dirs
VOLO=./scripts/volo
# Volo does its transformations in-place, so we need to copy junk across,
# transform it, then copy it to the destination dir.
NODE_PKGS := addressparser mailparser mailcomposer mimelib simplesmtp browserify-builtins
TRANS_NODE_PKGS := $(addprefix node-transformed-deps/,$(NODE_PKGS))
DEP_NODE_PKGS := $(addprefix data/deps/,$(NODE_PKGS))
node-transformed-deps:
mkdir -p node-transformed-deps
$(TRANS_NODE_PKGS): node-transformed-deps
$(RSYNC) node-deps/$(notdir $@) node-transformed-deps
$(VOLO) npmrel $@
touch $@
# the cp is for main shims created by volo
$(DEP_NODE_PKGS): $(TRANS_NODE_PKGS)
mkdir -p $@
-cp node-transformed-deps/$(notdir $@).js data/deps/
$(RSYNC_JS) node-transformed-deps/$(notdir $@)/ $@/
touch $@
OUR_JS_DEPS := $(wildcard data/lib/mailapi/*.js) $(wildcard data/lib/mailapi/imap/*.js) $(wildcard data/lib/mailapi/smtp*.js) $(wildcard data/lib/mailapi/activesync/*.js) $(wildcard data/deps/rdcommon/*.js)
install-into-gaia: gaia-symlink $(DEP_NODE_PKGS) $(OUR_JS_DEPS)
node scripts/copy-to-gaia.js gaia-symlink/apps/email
build: $(DEP_NODE_PKGS) $(OUR_JS_DEPS)
gaia-symlink:
echo "You need to create a symlink 'gaia-symlink' pointing at the gaia dir"
PYTHON=python
B2GSD := b2g-srcdir-symlink
B2GBD := b2g-builddir-symlink
ifeq ($(wildcard b2g-bindir-symlink),)
B2GBIND := $(B2GBD)/dist/bin
RUNB2G := $(B2GBIND)/b2g
else
B2GBIND := b2g-bindir-symlink
RUNB2G := $(B2GBIND)/b2g-bin
endif
ARBPLD=arbpl-dir-symlink
PYTHONINCDIRS=-I$(B2GSD)/build -I$(B2GBD)/_tests/mozbase/mozinfo
# common xpcshell args
RUNXPCARGS=--symbols-path=$(B2GBD)/dist/crashreporter-symbols \
--build-info-json=$(B2GBD)/mozinfo.json \
--testing-modules-dir=$(B2GBD)/_tests/modules
# Best effort use RUNMOZ if its available otherwise ignore it.
RUNMOZ := $(wildcard $(B2GBIND)/run-mozilla.sh)
# Common test running logic. Some test files are for both IMAP and ActiveSync.
# Some test files are just for one or the other. xpcshell has a mechanism for
# specifying constraings on test files in xpcshell.ini, and we are using that.
SOLO_FILE ?= $(error Specify a test filename in SOLO_FILE when using check-interactive or check-one)
define run-one-test
GELAM_TEST_ACCOUNT_TYPE=$(2) $(PYTHON) $(B2GSD)/config/pythonpath.py $(PYTHONINCDIRS) $(B2GSD)/testing/xpcshell/runxpcshelltests.py $(RUNXPCARGS) --build-info-json=test/config-$(1).json --test-path=$(SOLO_FILE) $(B2GBD)/dist/bin/xpcshell test/unit
endef
XPCWIN=node_modules/xpcwindow/bin/xpcwindow
TESTRUNNER=$(CURDIR)/test/loggest-runner.js
# run all the tests listed in a test config file
define run-tests # $(call run-tests,configName,accountType)
-rm -f test-logs/all-$(1).log
-rm -f test-logs/$(1)/*.log
-rm -rf test-profile
-mkdir -p test-profile/device-storage test-profile/fake-sdcard
-mkdir -p test-logs/$(1)
-GELAM_TEST_ACCOUNT_TYPE=$(2) $(RUNMOZ) $(RUNMOZFLAGS) $(RUNB2G) -app $(CURDIR)/test-runner/application.ini -no-remote -profile $(CURDIR)/test-profile --test-config $(CURDIR)/test/config-$(1).json
cat test-logs/$(1)/*.log > test-logs/all-$(1).log
endef
# run one test
define run-one-test
-rm -rf test-profile
-mkdir -p test-profile/device-storage test-profile/fake-sdcard
-mkdir -p test-logs/$(1)
-rm -f test-logs/$(1)/$(basename $(SOLO_FILE)).log
-GELAM_TEST_ACCOUNT_TYPE=$(2) $(RUNMOZ) $(RUNMOZFLAGS) $(RUNB2G) -app $(CURDIR)/test-runner/application.ini -no-remote -profile $(CURDIR)/test-profile --test-config $(CURDIR)/test/config-$(1).json --test-name $(basename $(SOLO_FILE))
endef
######################
# IMAP test variations
imap-tests: build
$(call run-tests,imap,imap)
one-imap-test: build
$(call run-one-test,imap,imap)
post-one-imap-test: one-imap-test
cd $(ARBPLD); ./logalchew $(CURDIR)/test-logs/imap/$(basename $(SOLO_FILE)).log
post-imap-tests: imap-tests
cd $(ARBPLD); ./logalchew $(CURDIR)/test-logs/all-imap.log
######################
# ActiveSync test variations
activesync-tests: build
$(call run-tests,activesync,activesync)
one-activesync-test: build
$(call run-one-test,activesync,activesync)
post-one-activesync-test: one-activesync-test
cd $(ARBPLD); ./logalchew $(CURDIR)/test-logs/activesync/$(basename $(SOLO_FILE)).log
post-activesync-tests: activesync-tests
cd $(ARBPLD); ./logalchew $(CURDIR)/test-logs/all-activesync.log
######################
# Bundle up all the tests!
all-tests: imap-tests activesync-tests
post-all-tests: post-imap-tests post-activesync-tests post-torture-tests
ACTIVESYNC_SERVER_PORT ?= 8880
activesync-server:
$(PYTHON) $(CURDIR)/test/run_server.py $(B2GSD) $(B2GBD) $(CURDIR) \
run_activesync_server.js --port $(ACTIVESYNC_SERVER_PORT)
clean:
rm -rf data/deps
rm -rf node-transformed-deps
.DEFAULT_GOAL=install-into-gaia
.PHONY: build install-into-gaia