Add --downloadOnly flag to test.js

This commit is contained in:
Rob Wu 2015-07-06 17:17:11 +02:00
parent 67816bd085
commit c7a5da332c

View File

@ -38,7 +38,7 @@ function parseOptions() {
var yargs = require('yargs') var yargs = require('yargs')
.usage('Usage: $0') .usage('Usage: $0')
.boolean(['help', 'masterMode', 'reftest', 'unitTest', 'fontTest', .boolean(['help', 'masterMode', 'reftest', 'unitTest', 'fontTest',
'noPrompts', 'noDownload']) 'noPrompts', 'noDownload', 'downloadOnly'])
.string(['manifestFile', 'browser', 'browserManifestFile', .string(['manifestFile', 'browser', 'browserManifestFile',
'port', 'statsFile', 'statsDelay']) 'port', 'statsFile', 'statsDelay'])
.alias('browser', 'b').alias('help', 'h').alias('masterMode', 'm') .alias('browser', 'b').alias('help', 'h').alias('masterMode', 'm')
@ -59,6 +59,7 @@ function parseOptions() {
.describe('unitTest', 'Run the unit tests.') .describe('unitTest', 'Run the unit tests.')
.describe('fontTest', 'Run the font tests.') .describe('fontTest', 'Run the font tests.')
.describe('noDownload', 'Skips test PDFs downloading.') .describe('noDownload', 'Skips test PDFs downloading.')
.describe('downloadOnly', 'Download test PDFs without running the tests.')
.describe('statsFile', 'The file where to store stats.') .describe('statsFile', 'The file where to store stats.')
.describe('statsDelay', 'The amount of time in milliseconds the browser ' + .describe('statsDelay', 'The amount of time in milliseconds the browser ' +
'should wait before starting stats.') 'should wait before starting stats.')
@ -68,6 +69,9 @@ function parseOptions() {
argv.masterMode <= 1; argv.masterMode <= 1;
}, '--reftest, --unitTest, --fontTest and --masterMode must not be ' + }, '--reftest, --unitTest, --fontTest and --masterMode must not be ' +
'specified at the same time.')) 'specified at the same time.'))
.check(describeCheck(function (argv) {
return !argv.noDownload || !argv.downloadOnly;
}, '--noDownload and --downloadOnly cannot be used together.'))
.check(describeCheck(function (argv) { .check(describeCheck(function (argv) {
return !argv.masterMode || argv.manifestFile === 'test_manifest.json'; return !argv.masterMode || argv.manifestFile === 'test_manifest.json';
}, 'when --masterMode is specified --manifestFile shall be equal ' + }, 'when --masterMode is specified --manifestFile shall be equal ' +
@ -692,7 +696,9 @@ function main() {
stats = []; stats = [];
} }
if (!options.browser && !options.browserManifestFile) { if (options.downloadOnly) {
ensurePDFsDownloaded(function() {});
} else if (!options.browser && !options.browserManifestFile) {
startServer(); startServer();
} else if (options.unitTest) { } else if (options.unitTest) {
startUnitTest('/test/unit/unit_test.html', 'unit'); startUnitTest('/test/unit/unit_test.html', 'unit');