Bug 989137 - Part 6: Create experiment XPIs during the build; r=bsmedberg

Instead of checking in binary .xpi files, we now have the source files
under source control and generate the .xpi as part of the build.

The build system mechanism to generate the .xpi files is hacky. But it's
similar to what existing processes use. Bug 988938 will eventually make
this more sane.

Since the produced .xpi files no longer have stable content, the SHA-1s
of the experiments are now calculated at test run time.

--HG--
extra : rebase_source : 85ae5a6c480a5add173b639f06b3ee404c5c6686
This commit is contained in:
Gregory Szorc 2014-03-29 18:10:11 -07:00
Родитель 20fd1dc8f4
Коммит 85b0cb2485
9 изменённых файлов: 132 добавлений и 6 удалений

Просмотреть файл

@ -0,0 +1,17 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include $(topsrcdir)/config/rules.mk
# This is so hacky. Waiting on bug 988938.
addondir = $(srcdir)/test/addons
testdir = $(abspath $(DEPTH)/_tests/xpcshell/browser/experiments/test/xpcshell)
libs::
$(EXIT_ON_ERROR) \
$(NSINSTALL) -D $(testdir); \
for dir in $(addondir)/*; do \
base=`basename $$dir`; \
(cd $$dir && zip -qr $(testdir)/$$base.xpi *); \
done

Просмотреть файл

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>test-experiment-1@tests.mozilla.org</em:id>
<em:version>1</em:version>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Test experiment 1</em:name>
<em:description>Yet another experiment that experiments experimentally.</em:description>
<em:bootstrap>true</em:bootstrap>
<em:type>128</em:type>
</Description>
</RDF>

Просмотреть файл

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>test-experiment-1@tests.mozilla.org</em:id>
<em:version>1.1</em:version>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Test experiment 1.1</em:name>
<em:description>And yet another experiment that experiments experimentally.</em:description>
<em:bootstrap>true</em:bootstrap>
<em:type>128</em:type>
</Description>
</RDF>

Просмотреть файл

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>test-experiment-2@tests.mozilla.org</em:id>
<em:version>1</em:version>
<em:targetApplication>
<Description>
<em:id>toolkit@mozilla.org</em:id>
<em:minVersion>0</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</Description>
</em:targetApplication>
<!-- Front End MetaData -->
<em:name>Test experiment 2</em:name>
<em:description>And yet another experiment that experiments experimentally.</em:description>
<em:bootstrap>true</em:bootstrap>
<em:type>128</em:type>
</Description>
</RDF>

Двоичные данные
browser/experiments/test/experiment-1.xpi

Двоичный файл не отображается.

Двоичные данные
browser/experiments/test/experiment-1a.xpi

Двоичный файл не отображается.

Двоичные данные
browser/experiments/test/experiment-2.xpi

Двоичный файл не отображается.

Просмотреть файл

@ -12,18 +12,48 @@ Cu.import("resource://services-sync/healthreport.jsm", this);
Cu.import("resource://testing-common/services/healthreport/utils.jsm", this);
Cu.import("resource://gre/modules/services/healthreport/providers.jsm");
function getExperimentPath(base) {
let p = do_get_cwd();
p.append(base);
return p.path;
}
function sha1File(path) {
let f = Cc["@mozilla.org/file/local;1"]
.createInstance(Ci.nsILocalFile);
f.initWithPath(path);
let hasher = Cc["@mozilla.org/security/hash;1"]
.createInstance(Ci.nsICryptoHash);
hasher.init(hasher.SHA1);
let is = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
is.init(f, -1, 0, 0);
hasher.updateFromStream(is, Math.pow(2, 32) - 1);
is.close();
let bytes = hasher.finish(false);
return [("0" + bytes.charCodeAt(byte).toString(16)).slice(-2)
for (byte in bytes)]
.join("");
}
const EXPERIMENT1_ID = "test-experiment-1@tests.mozilla.org";
const EXPERIMENT1_XPI_SHA1 = "sha1:0f15ee3677ffbf1e82367069fe4e8fe8e2ad838f";
const EXPERIMENT1_XPI_NAME = "experiment-1.xpi";
const EXPERIMENT1_NAME = "Test experiment 1";
const EXPERIMENT1_PATH = getExperimentPath(EXPERIMENT1_XPI_NAME);
const EXPERIMENT1_XPI_SHA1 = "sha1:" + sha1File(EXPERIMENT1_PATH);
const EXPERIMENT1A_XPI_SHA1 = "sha1:b938f1b4f0bf466a67257aff26d4305ac24231eb";
const EXPERIMENT1A_XPI_NAME = "experiment-1a.xpi";
const EXPERIMENT1A_NAME = "Test experiment 1.1";
const EXPERIMENT1A_PATH = getExperimentPath(EXPERIMENT1A_XPI_NAME);
const EXPERIMENT1A_XPI_SHA1 = "sha1:" + sha1File(EXPERIMENT1A_PATH);
const EXPERIMENT2_ID = "test-experiment-2@tests.mozilla.org"
const EXPERIMENT2_XPI_SHA1 = "sha1:9d23425421941e1d1e2037232cf5aeae82dbd4e4";
const EXPERIMENT2_XPI_NAME = "experiment-2.xpi";
const EXPERIMENT2_PATH = getExperimentPath(EXPERIMENT2_XPI_NAME);
const EXPERIMENT2_XPI_SHA1 = "sha1:" + sha1File(EXPERIMENT2_PATH);
const EXPERIMENT3_ID = "test-experiment-3@tests.mozilla.org";
const EXPERIMENT4_ID = "test-experiment-4@tests.mozilla.org";

Просмотреть файл

@ -4,9 +4,13 @@ tail =
firefox-appdir = browser
support-files =
experiments_1.manifest
../experiment-1.xpi
../experiment-1a.xpi
../experiment-2.xpi
experiment-1.xpi
experiment-1a.xpi
experiment-2.xpi
generated-files =
experiment-1.xpi
experiment-1a.xpi
experiment-2.xpi
[test_activate.js]
[test_api.js]