Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Revert "Bug 1006357 - make test agent to run tests from all apps loca…
Browse files Browse the repository at this point in the history
…lly and in travis" for build failures

This reverts commit 0b23225.
  • Loading branch information
Ed Morley committed May 22, 2014
1 parent 8c81118 commit 41e1c20
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 75 deletions.
5 changes: 1 addition & 4 deletions Makefile
Expand Up @@ -360,8 +360,6 @@ GAIA_APP_CONFIG := /tmp/gaia-apps-temp.list
$(warning GAIA_APP_SRCDIRS is deprecated, please use GAIA_APP_CONFIG)
endif

GAIA_ALLAPPDIRS=$(shell find $(PWD)/apps $(PWD)/dev_apps -maxdepth 1 -mindepth 1 -type d)

GAIA_APPDIRS=$(shell while read LINE; do \
if [ "$${LINE\#$${LINE%?}}" = "*" ]; then \
srcdir="`echo "$$LINE" | sed 's/.\{2\}$$//'`"; \
Expand Down Expand Up @@ -464,7 +462,6 @@ define BUILD_CONFIG
"GAIA_ENGINE" : "xpcshell", \
"GAIA_DISTRIBUTION_DIR" : "$(GAIA_DISTRIBUTION_DIR)", \
"GAIA_APPDIRS" : "$(GAIA_APPDIRS)", \
"GAIA_ALLAPPDIRS" : "$(GAIA_ALLAPPDIRS)", \
"GAIA_DEVICE_TYPE" : "$(GAIA_DEVICE_TYPE)", \
"NOFTU" : "$(NOFTU)", \
"REMOTE_DEBUGGER" : "$(REMOTE_DEBUGGER)", \
Expand Down Expand Up @@ -853,7 +850,7 @@ ifeq ($(BUILD_APP_NAME),*)
@touch $(TEST_AGENT_CONFIG)
@rm -f /tmp/test-agent-config;
@# Build json array of all test files
@for d in ${GAIA_ALLAPPDIRS}; \
@for d in ${GAIA_APPDIRS}; \
do \
parent="`dirname $$d`"; \
pathlen=`expr $${#parent} + 2`; \
Expand Down
19 changes: 13 additions & 6 deletions build/preferences.js
Expand Up @@ -34,11 +34,12 @@ PreferencesBuilder.prototype.preparePref = function() {
}
this.prefs['browser.homescreenURL'] = this.homescreen;

this.domains = [this.config.GAIA_DOMAIN];
this.config.GAIA_ALLAPPDIRS.split(' ').forEach(function(appdir) {
this.domains.push(utils.getFile(appdir).leafName + '.' +
this.config.GAIA_DOMAIN);
}, this);
this.domains = [];
this.domains.push(this.config.GAIA_DOMAIN);

this.gaia.webapps.forEach(function(webapp) {
this.domains.push(webapp.domain);
}.bind(this));

this.prefs['network.http.max-connections-per-server'] = 15;
this.prefs['dom.mozInputMethod.enabled'] = true;
Expand Down Expand Up @@ -183,7 +184,6 @@ PreferencesBuilder.prototype.setDebugPref = function() {
this.prefs['extensions.gaia.port'] =
parseInt(this.config.GAIA_PORT.replace(/:/g, ''), 10);
this.prefs['extensions.gaia.appdirs'] = this.config.GAIA_APPDIRS;
this.prefs['extensions.gaia.allappdirs'] = this.config.GAIA_ALLAPPDIRS;
this.prefs['extensions.gaia.locales_debug_path'] =
this.config.GAIA_LOCALES_PATH;
this.prefs['extensions.gaia.official'] = Boolean(this.config.OFFICIAL);
Expand All @@ -195,6 +195,13 @@ PreferencesBuilder.prototype.setDebugPref = function() {
var suffix = this.config.GAIA_DEV_PIXELS_PER_PX === '1' ?
'' : '@' + this.config.GAIA_DEV_PIXELS_PER_PX + 'x';
this.prefs['extensions.gaia.device_pixel_suffix'] = suffix;

var appPathList = [];
this.gaia.webapps.forEach(function(webapp) {
appPathList.push(webapp.sourceAppDirectoryName + '/' +
webapp.sourceDirectoryName);
});
this.prefs['extensions.gaia.app_relative_path'] = appPathList.join(' ');
this.prefs['extensions.autoDisableScopes'] = 0;
};

Expand Down
2 changes: 1 addition & 1 deletion build/test-agent-bootstrap.js
Expand Up @@ -21,7 +21,7 @@ exports.execute = function(options) {
var sandboxFile = srcDir.clone();
sandboxFile.append('_sandbox.html');

options.GAIA_ALLAPPDIRS.split(' ').forEach(function(appPath) {
options.GAIA_APPDIRS.split(' ').forEach(function(appPath) {
var testDir = utils.getFile(appPath, 'test');
var unitDir = testDir.clone();
unitDir.append('unit');
Expand Down
109 changes: 53 additions & 56 deletions build/test/unit/preference.test.js
Expand Up @@ -199,61 +199,59 @@ suite('preferences.js', function() {
'font.name-list.sans-serif.x-western': 'Fira Sans, Roboto',
'extensions.autoDisableScopes': 0
});
});

test('editDebugPref', function () {
preferences.homescreen = 'testHomescreen';
preferences.config = {
GAIA_DIR: 'testGaiaDir',
GAIA_DOMAIN: 'testGaiaDomain',
GAIA_PORT: ':8080',
GAIA_APPDIRS: 'testAppDirs',
GAIA_ALLAPPDIRS: 'testAppDir1 testAppDir2',
GAIA_LOCALES_PATH: 'testLocalesPath',
OFFICIAL: 1,
LOCALES_FILE: 'testLocaleFile',
LOCALE_BASEDIR: 'testLocaleBaseDir',
GAIA_DEV_PIXELS_PER_PX: 2
};
preferences.gaia = {
webapps: [
{
sourceAppDirectoryName: 'testSourceName',
sourceDirectoryName: 'testDirName'
}
]
};
preferences.prefs = {};
preferences.setDebugPref();
assert.deepEqual(preferences.prefs, {
'docshell.device_size_is_page_size': true,
'marionette.defaultPrefs.enabled': true,
'nglayout.debug.disable_xul_cache': true,
'nglayout.debug.disable_xul_fastload': true,
'javascript.options.showInConsole': true,
'browser.dom.window.dump.enabled': true,
'dom.report_all_js_exceptions': true,
'dom.w3c_touch_events.enabled': 1,
'dom.promise.enabled': true,
'dom.wakelock.enabled': true,
'image.mozsamplesize.enabled': true,
'webgl.verbose': true,
'dom.max_script_run_time': 0,
'toolkit.identity.debug': true,
'network.http.use-cache': false,
'extensions.gaia.dir': preferences.config.GAIA_DIR,
'extensions.gaia.domain': preferences.config.GAIA_DOMAIN,
'extensions.gaia.port': 8080,
'extensions.gaia.appdirs': preferences.config.GAIA_APPDIRS,
'extensions.gaia.allappdirs': preferences.config.GAIA_ALLAPPDIRS,
'extensions.gaia.locales_debug_path':
preferences.config.GAIA_LOCALES_PATH,
'extensions.gaia.official': true,
'extensions.gaia.locales_file': preferences.config.LOCALES_FILE,
'extensions.gaia.locale_basedir': preferences.config.LOCALE_BASEDIR,
'extensions.gaia.device_pixel_suffix':
'@' + preferences.config.GAIA_DEV_PIXELS_PER_PX + 'x',
'extensions.autoDisableScopes': 0
test('editDebugPref', function () {
preferences.homescreen = 'testHomescreen';
preferences.config = {
GAIA_DIR: 'testGaiaDir',
GAIA_DOMAIN: 'testGaiaDomain',
GAIA_PORT: ':8080',
GAIA_APPDIRS: 'testAppDirs',
GAIA_LOCALES_PATH: 'testLocalesPath',
OFFICIAL: 1,
LOCALES_FILE: 'testLocaleFile',
LOCALE_BASEDIR: 'testLocaleBaseDir',
GAIA_DEV_PIXELS_PER_PX: 2
};
preferences.gaia = {
webapps: [
{
sourceAppDirectoryName: 'testSourceName',
sourceDirectoryName: 'testDirName'
}
]
};
preferences.prefs = {};
preferences.setDebugPref();
assert.deepEqual(preferences.prefs, {
'docshell.device_size_is_page_size': true,
'marionette.defaultPrefs.enabled': true,
'nglayout.debug.disable_xul_cache': true,
'nglayout.debug.disable_xul_fastload': true,
'javascript.options.showInConsole': true,
'browser.dom.window.dump.enabled': true,
'dom.report_all_js_exceptions': true,
'dom.w3c_touch_events.enabled': 1,
'dom.promise.enabled': true,
'dom.wakelock.enabled': true,
'image.mozsamplesize.enabled': true,
'webgl.verbose': true,
'dom.max_script_run_time': 0,
'network.http.use-cache': false,
'extensions.gaia.dir': preferences.config.GAIA_DIR,
'extensions.gaia.domain': preferences.config.GAIA_DOMAIN,
'extensions.gaia.port': 8080,
'extensions.gaia.appdirs': preferences.config.GAIA_APPDIRS,
'extensions.gaia.locales_debug_path':
preferences.config.GAIA_LOCALES_PATH,
'extensions.gaia.official': true,
'extensions.gaia.locales_file': preferences.config.LOCALES_FILE,
'extensions.gaia.locale_basedir': preferences.config.LOCALE_BASEDIR,
'extensions.gaia.device_pixel_suffix':
'@' + preferences.config.GAIA_DEV_PIXELS_PER_PX + 'x',
'extensions.gaia.app_relative_path': 'testSourceName/testDirName',
'extensions.autoDisableScopes': 0
});
});
});

Expand Down Expand Up @@ -303,8 +301,7 @@ suite('preferences.js', function() {
preferences.config = {
HOMESCREEN: 'app://homescreen',
GAIA_PORT: 8000,
GAIA_DOMAIN: 'domain',
GAIA_ALLAPPDIRS: 'testAppDir1 testAppDir2'
GAIA_DOMAIN: 'domain'
};

preferences.prefs = {};
Expand Down
3 changes: 1 addition & 2 deletions tools/extensions/httpd/bootstrap.js
Expand Up @@ -27,7 +27,6 @@ function startup(data, reason) {
const LANG_EN = 'en-US';
const GAIA_DOMAIN = Services.prefs.getCharPref("extensions.gaia.domain");
const GAIA_APPDIRS = Services.prefs.getCharPref("extensions.gaia.appdirs");
const GAIA_ALLAPPDIRS = Services.prefs.getCharPref("extensions.gaia.allappdirs");
const GAIA_DIR = Services.prefs.getCharPref("extensions.gaia.dir");
const GAIA_PORT = Services.prefs.getIntPref("extensions.gaia.port");
const GAIA_OFFICIAL = Services.prefs.getBoolPref("extensions.gaia.official");
Expand Down Expand Up @@ -74,7 +73,7 @@ function startup(data, reason) {
let host = GAIA_DOMAIN;
identity.add(scheme, host, port);

let directories = getDirectories(GAIA_ALLAPPDIRS.split(' '));
let directories = getDirectories(GAIA_APPDIRS.split(' '));
directories.forEach(function appendDir(name) {
// Some app names can cause a raise here, preventing other apps
// from being added.
Expand Down
11 changes: 5 additions & 6 deletions tools/extensions/httpd/content/httpd.js
Expand Up @@ -43,8 +43,7 @@
// GAIA-
Components.utils.import('resource://gre/modules/Services.jsm');
const GAIA_DOMAIN = Services.prefs.getCharPref("extensions.gaia.domain");
const GAIA_DIR = Services.prefs.getCharPref("extensions.gaia.dir");
const GAIA_ALLAPPDIRS = Services.prefs.getCharPref("extensions.gaia.allappdirs");
const GAIA_APP_RELATIVEPATH = Services.prefs.getCharPref("extensions.gaia.app_relative_path");
const GAIA_LOCALES_PATH = Services.prefs.getCharPref("extensions.gaia.locales_debug_path");
const GAIA_DEVICE_PIXEL_SUFFIX = Services.prefs.getCharPref("extensions.gaia.device_pixel_suffix");
// -GAIA
Expand Down Expand Up @@ -1524,6 +1523,7 @@ RequestReader.prototype =

/**
* Try to find out real path of apps,
* according to GAIA_APP_RELATIVEPATH provided by Makefile.
*/
_findRealPath: function(appName) {
if (this._realPath) {
Expand All @@ -1532,16 +1532,15 @@ RequestReader.prototype =

this._realPath = {};

var appPathList = GAIA_ALLAPPDIRS.trim().split(" ");
var appPathList = GAIA_APP_RELATIVEPATH.trim().split(" ");
for (var i = 0; i < appPathList.length; i++) {
var relativePath = appPathList[i].substr(GAIA_DIR.length + 1),
currentAppName = relativePath.split("/")[1];
var currentAppName = appPathList[i].split("/")[1];

if (!currentAppName) {
continue;
}

this._realPath[currentAppName] = relativePath;
this._realPath[currentAppName] = appPathList[i];
}
return "/" + this._realPath[appName];
},
Expand Down

0 comments on commit 41e1c20

Please sign in to comment.