From 51c7ae6e5cd9709f4df91a6cab1ef6cc63b4895c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 16 Apr 2015 17:35:38 -0400 Subject: [PATCH] Add -b option to skip translator/style installation in tests 'b' for *b*undled files Translators and styles take a long time to install and initialize in source installations, and they're unnecessary for many tests. This shaves about 10 seconds off each test run for me on one system (and that's with some help from filesystem caching). --- chrome/content/zotero/xpcom/schema.js | 5 +++++ chrome/content/zotero/xpcom/zotero.js | 1 + components/zotero-service.js | 3 +++ test/runtests.sh | 10 +++++++++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index f3bf64879..557153047 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -397,6 +397,11 @@ Zotero.Schema = new function(){ * @return {Promise} */ this.updateBundledFiles = Zotero.Promise.coroutine(function* (mode) { + if (Zotero.skipBundledFiles) { + Zotero.debug("Skipping bundled file installation"); + return; + } + if (_localUpdateInProgress) { Zotero.debug("Bundled file update already in progress", 2); return; diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 18ce38d53..32955d704 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -172,6 +172,7 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); if (options) { if (options.openPane) this.openPane = true; if (options.noUserInput) this.noUserInput = true; + if (options.skipBundledFiles) this.skipBundledFiles = true; } this.mainThread = Services.tm.mainThread; diff --git a/components/zotero-service.js b/components/zotero-service.js index 72c157f9e..2da408918 100644 --- a/components/zotero-service.js +++ b/components/zotero-service.js @@ -465,6 +465,9 @@ ZoteroCommandLineHandler.prototype = { if (cmdLine.handleFlag("ZoteroNoUserInput", false)) { zInitOptions.noUserInput = true; } + if (cmdLine.handleFlag("ZoteroSkipBundledFiles", false)) { + zInitOptions.skipBundledFiles = true; + } }, contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=zotero", diff --git a/test/runtests.sh b/test/runtests.sh index d62b31800..5ac1ef4e3 100755 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -29,12 +29,13 @@ Options -x FX_EXECUTABLE path to Firefox executable (default: $FX_EXECUTABLE) -d enable debug logging -c open JavaScript console and don't quit on completion + -b skip bundled translator/style installation TESTS set of tests to run (default: all) DONE exit 1 } -while getopts "x:dc" opt; do +while getopts "x:dcb" opt; do case $opt in x) FX_EXECUTABLE="$OPTARG" @@ -45,6 +46,9 @@ while getopts "x:dc" opt; do c) FX_ARGS="-jsconsole -noquit" ;; + b) + SKIP_BUNDLED=true + ;; *) usage ;; @@ -90,6 +94,10 @@ if [ "$TRAVIS" = true ]; then FX_ARGS="$FX_ARGS --ZoteroNoUserInput" fi +if [ "$SKIP_BUNDLED" = true ]; then + FX_ARGS="$FX_ARGS -ZoteroSkipBundledFiles" +fi + makePath FX_PROFILE "$PROFILE" MOZ_NO_REMOTE=1 NO_EM_RESTART=1 "$FX_EXECUTABLE" -profile "$FX_PROFILE" \ -chrome chrome://zotero-unit/content/runtests.html -test "$TESTS" $FX_ARGS