Repository navigation
Expand file tree
/
Copy pathgaia-marionette
More file actions
executable file
·131 lines (110 loc) · 4.48 KB
/
Copy pathgaia-marionette
File metadata and controls
executable file
·131 lines (110 loc) · 4.48 KB
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
#!/bin/bash
# All options are passed to `./node_modules/.bin/marionette-mocha` so
# you can also use mocha commands like `--grep`, `--timeout` see `--help`
# for more options.
# Find the source of this file
SOURCE="${BASH_SOURCE[0]}"
# Make it an absolute path
DIR="$( cd "$( dirname "$SOURCE" )" && pwd )"
# where all gaia specific customizations for mocha-marionette live.
SHARED=$DIR/../shared/test/integration
# Go to the isolated Python environment if we already setup the virtualenv.
VIRTUALENV=$(which virtualenv)
JS_MARIONETTE_ENV=$(find $DIR/.. -path "*/js-marionette-env")
if [ -x "$VIRTUALENV" -a -x "$JS_MARIONETTE_ENV" ]; then
source ./js-marionette-env/bin/activate
fi
# We skip the related tests if the Radicale CalDAV server is not installed.
if [ ! -x "$VIRTUALENV" -o ! -x "$JS_MARIONETTE_ENV" -o ! -x "$(which radicale)" ]; then
echo -e "The Radicale CalDAV server is not installed in the virtualenv, we will skip the CalDAV tests.\n \
\rIf you want to run the CalDAV tests, please run |make caldav-server-install| first."
CALDAV_RELATED_TESTS="apps/calendar/test/marionette/caldav_test.js apps/calendar/test/marionette/server_test.js"
SKIP_TEST_FILES="$SKIP_TEST_FILES $CALDAV_RELATED_TESTS"
fi
# Build the script string of skipping test files.
if [ -n "$SKIP_TEST_FILES" ]; then
for FILE in $SKIP_TEST_FILES
do
SKIP_TEST_FILES_SCRIPT="$SKIP_TEST_FILES_SCRIPT ! -path */$FILE"
done
SKIP_TEST_FILES="$SKIP_TEST_FILES_SCRIPT"
fi
# make sure node_modules are 100% up to date
make node_modules
# download b2g-desktop (if its not present)
make -C $DIR/../ b2g
# tests can timeout without the profile-test folder so build it here.
if [ ! -d $DIR/../profile-test ]; then
PROFILE_FOLDER=profile-test make -C $DIR/../
fi
if [ -z "$TEST_FILES" ]; then
if [ -z "$APP" ]; then
if [ -z "$SKIP_TEST_FILES" ]; then
TEST_FILES=$(find $DIR/.. -path "*/apps/*/test/marionette/*_test.js" \
-or -path "*/dev_apps/*/test/marionette/*_test.js" \
-or -path "*/tests/integration/*/*_test.js")
else
TEST_FILES=$(find $DIR/.. -path "*/apps/*/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/dev_apps/*/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/tests/integration/*/*_test.js" $SKIP_TEST_FILES)
fi
else
if [ -z "$SKIP_TEST_FILES" ]; then
TEST_FILES=$(find $DIR/.. -path "*/apps/$APP/test/marionette/*_test.js" \
-or -path "*/dev_apps/$APP/test/marionette/*_test.js" \
-or -path "*/tests/integration/$APP/*_test.js")
else
TEST_FILES=$(find $DIR/.. -path "*/apps/$APP/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/dev_apps/$APP/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/tests/integration/$APP/*_test.js" $SKIP_TEST_FILES)
fi
fi
fi
if [ -n "$PART" ] ; then
if [ -z "$NBPARTS" ] ; then
echo "You need to specify the number of parts using the env variable NBPARTS"
exit 1
fi
TEMP_FILE=$(mktemp)
# the quotes are important here, otherwise bash replace newlines characters by
# spaces
echo "$TEST_FILES" | sort > $TEMP_FILE
TEST_FILES=$(split -n l/$PART/$NBPARTS $TEMP_FILE)
echo -e "------- Will run the following test files:\n$TEST_FILES\n-------"
rm -f $TEMP_FILE
fi
if [ -z "$XULRUNNER_DIRECTORY" ] ; then
# the xulrunner directory isn't in the environment
XULRUNNER_DIRECTORY=`ls -d "$DIR/../xulrunner-sdk"*/xulrunner-sdk | sort -nr | head -n1 2> /dev/null`
fi
if [ -z "$XULRUNNER_DIRECTORY" ] ; then
echo "Couldn't find XULrunner. Please execute this file from 'make' or install XULrunner yourself."
exit 1
fi
# find xpcshell and put it in the path
XPCSHELL_DIR=$(dirname $(find "$XULRUNNER_DIRECTORY"/bin -type f -name "xpcshell" | head -n 1));
VERBOSE_OPTS=""
if [ "$VERBOSE" ]; then
VERBOSE_OPTS="--verbose"
fi
OOP_OPTS=""
if [ "$OOP" ]; then
OOP_OPTS="--b2g-desktop-oop"
fi
RUNTIME_OPTS=""
if [ "$RUNTIME" ]; then
RUNTIME_OPTS="--runtime=$RUNTIME"
fi
# wrap marionette-mocha with gaia's defaults. We also need to alter the paths to
# xpcshell in available for email fake servers.
PATH=$XPCSHELL_DIR:$PATH $DIR/../node_modules/.bin/marionette-mocha \
$VERBOSE_OPTS \
$OOP_OPTS \
$RUNTIME_OPTS \
--timeout 60s \
--ui tdd \
--profile-builder $SHARED/profile_builder.js \
--profile-base $SHARED/profile.js \
$SHARED/setup.js \
$TEST_FILES \
$@