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).
This commit is contained in:
Dan Stillman 2015-04-16 17:35:38 -04:00
parent 0154e44c2f
commit 51c7ae6e5c
4 changed files with 18 additions and 1 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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",

View file

@ -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