Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore ember-extension-support phantom crashes #12879

Merged
merged 2 commits into from
Jan 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,33 @@ cache:
- node_modules
- bower_components
- persistent-filter-caches
- phantomjs

before_install:
- "npm config set spin false"
- "npm --version"
- "phantomjs --version"
- "rm -f /tmp/*.dmp"
- "mkdir -p phantomjs"
- >
if [ ! -d ./phantomjs/`phantomjs --version`-linux-x86_64-symbols ]; then
wget -O /tmp/phantomjs-`phantomjs --version`-linux-x86_64-symbols.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-`phantomjs --version`-linux-x86_64-symbols.tar.bz2 &&
tar -xjvf /tmp/phantomjs-`phantomjs --version`-linux-x86_64-symbols.tar.bz2 -C ./phantomjs;
fi

install:
- "npm install"

after_success:
- "./bin/publish_builds"

after_script:
- "cd ./phantomjs/phantomjs-`phantomjs --version`-linux-x86_64-symbols"
- >
for i in /tmp/*.dmp; do
./minidump_stackwalk $i . 2>/dev/null;
done

script:
- npm test

Expand Down
98 changes: 52 additions & 46 deletions bin/run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@ var chalk = require('chalk');
var packages = require('../lib/packages');
var runInSequence = require('../lib/run-in-sequence');

function shouldPrint(inputString) {
var skipStrings = [
"*** WARNING: Method userSpaceScaleFactor",
"CoreText performance note:",
];

for (var i = 0; i < skipStrings.length; i++) {
if (inputString.indexOf(skipStrings[i])) {
return false;
}
}

return true;
}

var finalhandler = require('finalhandler')
var http = require('http')
var serveStatic = require('serve-static')
Expand All @@ -40,48 +25,69 @@ server.listen(PORT);

function run(queryString) {
return new RSVP.Promise(function(resolve, reject) {
var args = [
'bower_components/qunit-phantom-runner/runner.js',
'http://localhost:' + PORT + '/tests/?' + queryString
];

console.log('Running: phantomjs ' + args.join(' '));
var url = 'http://localhost:' + PORT + '/tests/?' + queryString;
runInPhantom(url, 3, resolve, reject);
});
}

var child = spawn('phantomjs', args);
var result = {output: [], errors: [], code: null};
function runInPhantom(url, retries, resolve, reject) {
var args = ['bower_components/qunit-phantom-runner/runner.js', url];

child.stdout.on('data', function (data) {
var string = data.toString();
var lines = string.split('\n');
console.log('Running: phantomjs ' + args.join(' '));

lines.forEach(function(line) {
if (line.indexOf('0 failed.') > -1) {
console.log(chalk.green(line));
} else {
console.log(line);
}
});
result.output.push(string);
});
var crashed = false;
var child = spawn('phantomjs', args);
var result = {output: [], errors: [], code: null};

child.stderr.on('data', function (data) {
var string = data.toString();
child.stdout.on('data', function (data) {
var string = data.toString();
var lines = string.split('\n');

if (shouldPrint(string)) {
result.errors.push(string);
console.error(chalk.red(string));
lines.forEach(function(line) {
if (line.indexOf('0 failed.') > -1) {
console.log(chalk.green(line));
} else {
console.log(line);
}
});
result.output.push(string);
});

child.on('close', function (code) {
result.code = code;
child.stderr.on('data', function (data) {
var string = data.toString();

if (code === 0) {
resolve(result);
if (string.indexOf('PhantomJS has crashed.') > -1) {
crashed = true;
}

result.errors.push(string);
console.error(chalk.red(string));
});

child.on('close', function (code) {
result.code = code;

if (!crashed && code === 0) {
resolve(result);
} else if (crashed) {
console.log(chalk.red('Phantom crashed with exit code ' + code));

if (retries > 1) {
console.log(chalk.yellow('Retrying... ¯\_(ツ)_/¯'));
runInPhantom(url, retries - 1, resolve, reject);
} else {
reject(result);
console.log(chalk.red('Giving up! (╯°□°)╯︵ ┻━┻'));

if (url.indexOf('ember-extension-support') > -1) {
console.log(chalk.yellow('This might be a known issue with PhantomJS 1.9.8, skipping for now'));
resolve(result);
} else {
reject(result);
}
}
});
} else {
reject(result);
}
});
}

Expand Down