From 41e1c20d4f28cfccb6bfba72b69f9a06ef83d866 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Thu, 22 May 2014 16:10:14 +0100 Subject: [PATCH] Revert "Bug 1006357 - make test agent to run tests from all apps locally and in travis" for build failures This reverts commit 0b23225f42af1497d6f998ea49f43562285bd02b. --- Makefile | 5 +- build/preferences.js | 19 +++-- build/test-agent-bootstrap.js | 2 +- build/test/unit/preference.test.js | 109 ++++++++++++------------ tools/extensions/httpd/bootstrap.js | 3 +- tools/extensions/httpd/content/httpd.js | 11 ++- 6 files changed, 74 insertions(+), 75 deletions(-) diff --git a/Makefile b/Makefile index cc7a0783ab9f..0bc2cd30ef64 100644 --- a/Makefile +++ b/Makefile @@ -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\}$$//'`"; \ @@ -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)", \ @@ -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`; \ diff --git a/build/preferences.js b/build/preferences.js index 3f9dea553af1..5355dc39386c 100644 --- a/build/preferences.js +++ b/build/preferences.js @@ -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; @@ -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); @@ -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; }; diff --git a/build/test-agent-bootstrap.js b/build/test-agent-bootstrap.js index 6489079f2f91..04b14a7d1755 100644 --- a/build/test-agent-bootstrap.js +++ b/build/test-agent-bootstrap.js @@ -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'); diff --git a/build/test/unit/preference.test.js b/build/test/unit/preference.test.js index f960690726bf..b756e801d572 100644 --- a/build/test/unit/preference.test.js +++ b/build/test/unit/preference.test.js @@ -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 + }); }); }); @@ -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 = {}; diff --git a/tools/extensions/httpd/bootstrap.js b/tools/extensions/httpd/bootstrap.js index 6319308809e5..116ee230351e 100644 --- a/tools/extensions/httpd/bootstrap.js +++ b/tools/extensions/httpd/bootstrap.js @@ -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"); @@ -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. diff --git a/tools/extensions/httpd/content/httpd.js b/tools/extensions/httpd/content/httpd.js index aada08ea5d9c..dd4f2737ab1e 100644 --- a/tools/extensions/httpd/content/httpd.js +++ b/tools/extensions/httpd/content/httpd.js @@ -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 @@ -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) { @@ -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]; },