Skip to content

Commit 57f21c8

Browse files
committed
Profile automation for tests + Travis build.
Incidentally fix a regex that generates 'nothing to repeat' error on Python 2.7.8.
1 parent a930329 commit 57f21c8

File tree

8 files changed

+113
-18
lines changed

8 files changed

+113
-18
lines changed

.travis.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1+
# Config copied from
2+
# http://www.theautomatedtester.co.uk/blog/2012/using-travis-ci-for-building-and-testing-firefox-addons.html
3+
# Use node_js because there are maybe more workers?
14
language: python
25
python:
36
- "2.7"
7+
addons:
8+
firefox: "30.0"
49
before_install:
5-
- "sudo apt-get -qq update"
6-
install:
7-
- "sudo apt-get -qq install libxml2-dev libxslt-dev python-dev"
8-
- "pip install -r requirements.txt"
9-
script: "./makexpi.sh"
10+
- wget -q https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/addon-sdk-1.16.tar.gz
11+
- tar xpzf addon-sdk-1.16.tar.gz
12+
- cd addon-sdk-1.16; source bin/activate; cd -
13+
- sudo apt-get install python-lxml
14+
#- pip install --user -r requirements.txt
15+
before_script:
16+
- sh -e /etc/init.d/xvfb start
17+
env:
18+
- DISPLAY=':99.0'
19+
script: ./test.sh
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[ExtensionDirs]
2+
Extension0=/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/ubufox@ubuntu.com
3+
Extension1=/usr/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/{2e1445b0-2682-11e1-bfc2-0800200c9a66}
4+
Extension2=/usr/lib/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/online-accounts@lists.launchpad.net
5+
6+
[ThemeDirs]
7+
Extension0=/usr/lib/firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"addons": [
3+
{
4+
"aboutURL": "chrome://https-everywhere/content/about.xul",
5+
"active": false,
6+
"appDisabled": false,
7+
"applyBackgroundUpdates": 1,
8+
"bootstrap": false,
9+
"defaultLocale": {
10+
"creator": "Mike Perry & Peter Eckersley",
11+
"description": "Encrypt the Web! Automatically use HTTPS security on many sites.",
12+
"homepageURL": "https://www.eff.org/https-everywhere",
13+
"name": "HTTPS-Everywhere"
14+
},
15+
"descriptor": "/home/jsha/https-everywhere/https-everywhere-tests/test_profile/extensions/https-everywhere@eff.org",
16+
"foreignInstall": true,
17+
"hasBinaryComponents": false,
18+
"icon64URL": null,
19+
"iconURL": "chrome://https-everywhere/skin/https-everywhere.png",
20+
"id": "https-everywhere@eff.org",
21+
"installDate": 1407525887000,
22+
"internalName": null,
23+
"locales": [],
24+
"location": "app-profile",
25+
"optionsType": null,
26+
"optionsURL": "chrome://https-everywhere/content/meta-preferences.xul",
27+
"releaseNotesURI": null,
28+
"size": 5133044,
29+
"softDisabled": false,
30+
"sourceURI": null,
31+
"strictCompatibility": false,
32+
"syncGUID": "PbynBLfrwhTP",
33+
"targetApplications": [
34+
{
35+
"id": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
36+
"maxVersion": "99.*",
37+
"minVersion": "20"
38+
},
39+
{
40+
"id": "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}",
41+
"maxVersion": "99.*",
42+
"minVersion": "2.17"
43+
},
44+
{
45+
"id": "{3550f703-e582-4d05-9a08-453d09bdfdc6}",
46+
"maxVersion": "99.*",
47+
"minVersion": "17.0.5"
48+
},
49+
{
50+
"id": "{a79fe89b-6662-4ff4-8e88-09950ad4dfde}",
51+
"maxVersion": "99.*",
52+
"minVersion": "0.1"
53+
}
54+
],
55+
"targetPlatforms": [],
56+
"type": "extension",
57+
"updateDate": 1407525887000,
58+
"updateKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbqOzQb2eyW15YFjDDEMI0ZOzt8f504obNs920lDnpPD2/KqgsfjOgw2K7xWDJIj/18xUvWPk3LDkrnokNiRkA3KOx3W6fHycKL+zID7zy+xZYBuh2fLyQtWV1VGQ45iNRp9+Zo7rH86cdfgkdnWTlNSHyTLW9NbXvyv/E12bppPcEvgCTAQXgnDVJ0/sqmeiijn9tTFh03aM+R2V/21h8aTraAS24qiPCz6gkmYGC8yr6mglcnNoYbsLNYZ69zF1XHcXPduCPdPdfLlzVlKK1/U7hkA28eG3BIAMh6uJYBRJTpiGgaGdPd7YekUB8S6cy+CQIDAQAB",
59+
"updateURL": "https://www.eff.org/files/https-everywhere-devel-update-2048.rdf",
60+
"userDisabled": false,
61+
"version": "5.0development.0",
62+
"visible": true
63+
}],
64+
"schemaVersion": 16
65+
}

https-everywhere-tests/test_profile_skeleton/extensions/placeholder

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
user_pref("extensions.https_everywhere._observatory.enabled", true);
2+
user_pref("extensions.https_everywhere._observatory.popup_shown", true);
3+
user_pref("extensions.https_everywhere.toolbar_hint_shown", true);
4+
user_pref("extensions.https_everywhere.LogLevel", 0);

makexpi.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash -e
22
APP_NAME=https-everywhere
33

44
# builds a .xpi from the git repository, placing the .xpi in the root

src/chrome/content/rules/Joyent.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<target host="www.no.de"/>
2828

2929
<securecookie host="^(.*\.)?(joyent\.com|no\.de)$" name=".*"/>
30-
<exclusion pattern="^http://pkgsrc(?:[\w\-]*)?\.joyent\.com/"/>
30+
<exclusion pattern="^http://pkgsrc[\w\-]*\.joyent\.com/"/>
3131

3232
<rule from="^http://joyent\.com/"
3333
to="https://www.joyent.com/"/>

test.sh

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
#!/bin/bash
2-
3-
set -e
1+
#!/bin/bash -ex
42
cd "`dirname $0`"
53

64
# dummy Jetpack addon that contains tests
75
TEST_ADDON_PATH=./https-everywhere-tests/
86
LATEST_SDK_VERSION=1.16
97

10-
# firefox profile that has HTTPS Everywhere installed
11-
PROFILE_DIRECTORY=./test_profile
12-
HTTPSE_INSTALL_DIRECTORY=./test_profile/extensions/https-everywhere@eff.org
8+
# We'll create a Firefox profile here and install HTTPS Everywhere into it.
9+
PROFILE_DIRECTORY="$(mktemp -d)"
10+
trap 'rm -r "$PROFILE_DIRECTORY"' EXIT
11+
HTTPSE_INSTALL_DIRECTORY=$PROFILE_DIRECTORY/extensions/https-everywhere@eff.org
12+
13+
# Build the XPI to run all the validations in makexpi.sh, and to ensure that
14+
# we test what is actually getting built.
15+
./makexpi.sh
16+
XPI_NAME="pkg/`ls -tr pkg/ | tail -1`"
17+
18+
# Set up a skeleton profile and then install into it.
19+
# The skeleton contains a few files required to trick Firefox into thinking
20+
# that the extension was fully installed rather than just unpacked.
21+
rsync -a https-everywhere-tests/test_profile_skeleton/ $PROFILE_DIRECTORY
22+
unzip -qd $HTTPSE_INSTALL_DIRECTORY $XPI_NAME
1323

1424
if [ ! -d "$TEST_ADDON_PATH" ]; then
1525
echo "Test addon path does not exist"
@@ -28,6 +38,8 @@ fi
2838

2939
if ! type cfx > /dev/null; then
3040
echo "Please activate the Firefox Addon SDK before running this script."
41+
echo "https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/addon-sdk-1.16.tar.gz"
42+
echo "Unpack and run 'source addon-adk-1.16/bin/activate'"
3143
exit 1
3244
fi
3345

@@ -36,9 +48,6 @@ if ! cfx --version | grep -q "$LATEST_SDK_VERSION"; then
3648
exit 1
3749
fi
3850

39-
cd src/
40-
rsync -av --exclude-from="../.build_exclusions" . ../$HTTPSE_INSTALL_DIRECTORY
41-
42-
cd ../$TEST_ADDON_PATH
51+
cd $TEST_ADDON_PATH
4352
echo "running tests"
44-
cfx test --profiledir="../$PROFILE_DIRECTORY" --verbose
53+
cfx test --profiledir="$PROFILE_DIRECTORY" --verbose

0 commit comments

Comments
 (0)