Skip to content

Commit

Permalink
Merge pull request #9960 from brendandahl/strict-verify
Browse files Browse the repository at this point in the history
Fail when MD5 of test files fails on bots.
  • Loading branch information
timvandermeij authored Aug 5, 2018
2 parents 444976b + 482ea2a commit b65d045
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
15 changes: 9 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ function getTempFile(prefix, suffix) {
return path;
}

function createTestSource(testsName) {
function createTestSource(testsName, bot) {
var source = stream.Readable({ objectMode: true, });
source._read = function () {
console.log();
Expand Down Expand Up @@ -394,6 +394,9 @@ function createTestSource(testsName) {
return null;
}
args.push('--browserManifestFile=' + PDF_BROWSERS);
if (bot) {
args.push('--strictVerify');
}

var testProcess = spawn('node', args, { cwd: TEST_DIR, stdio: 'inherit', });
testProcess.on('close', function (code) {
Expand All @@ -403,7 +406,7 @@ function createTestSource(testsName) {
return source;
}

function makeRef(done, noPrompts) {
function makeRef(done, bot) {
console.log();
console.log('### Creating reference images');

Expand All @@ -420,8 +423,8 @@ function makeRef(done, noPrompts) {
}

var args = ['test.js', '--masterMode'];
if (noPrompts) {
args.push('--noPrompts');
if (bot) {
args.push('--noPrompts', '--strictVerify');
}
args.push('--browserManifestFile=' + PDF_BROWSERS);
var testProcess = spawn('node', args, { cwd: TEST_DIR, stdio: 'inherit', });
Expand Down Expand Up @@ -980,8 +983,8 @@ gulp.task('test', ['testing-pre', 'generic', 'components'], function() {

gulp.task('bottest', ['testing-pre', 'generic', 'components'], function() {
return streamqueue({ objectMode: true, },
createTestSource('unit'), createTestSource('font'),
createTestSource('browser (no reftest)'));
createTestSource('unit', true), createTestSource('font', true),
createTestSource('browser (no reftest)', true));
});

gulp.task('browsertest', ['testing-pre', 'generic', 'components'], function() {
Expand Down
6 changes: 5 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function parseOptions() {
var yargs = require('yargs')
.usage('Usage: $0')
.boolean(['help', 'masterMode', 'reftest', 'unitTest', 'fontTest',
'noPrompts', 'noDownload', 'downloadOnly'])
'noPrompts', 'noDownload', 'downloadOnly', 'strictVerify'])
.string(['manifestFile', 'browser', 'browserManifestFile',
'port', 'statsFile', 'statsDelay', 'testfilter'])
.alias('browser', 'b').alias('help', 'h').alias('masterMode', 'm')
Expand All @@ -63,6 +63,7 @@ function parseOptions() {
.describe('fontTest', 'Run the font tests.')
.describe('noDownload', 'Skips test PDFs downloading.')
.describe('downloadOnly', 'Download test PDFs without running the tests.')
.describe('strictVerify', 'Error if verifying the manifest files fails.')
.describe('statsFile', 'The file where to store stats.')
.describe('statsDelay', 'The amount of time in milliseconds the browser ' +
'should wait before starting stats.')
Expand Down Expand Up @@ -716,6 +717,9 @@ function ensurePDFsDownloaded(callback) {
'used for testing.');
console.log('Please re-download the files, or adjust the MD5 ' +
'checksum in the manifest for the files listed above.\n');
if (options.strictVerify) {
process.exit(1);
}
}
callback();
});
Expand Down

0 comments on commit b65d045

Please sign in to comment.