skia2/modules/canvaskit/karma.conf.js
Kevin Lubick 9c2b7cfe90 [canvaskit] Try some things to reduce GPU test flakiness
1) some flags that "The Internet" says may help
2) retry running the test script up to 3 times.

I wasn't able to reproduce the crashes with a non-Docker
Chrome, only in the Docker container, which was
very hard to debug.

Change-Id: I87f31c32f63b2770d8d5afa6a8e4b90c35dbf0bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255820
Reviewed-by: Eric Boren <borenet@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2019-11-21 20:56:42 +00:00

83 lines
2.6 KiB
JavaScript

const isDocker = require('is-docker')();
module.exports = function(config) {
// Set the default values to be what are needed when testing the
// WebAssembly build locally.
let cfg = {
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
{ pattern: 'canvaskit/bin/canvaskit.wasm', included:false, served:true},
{ pattern: 'tests/assets/*', included:false, served:true},
'../../modules/pathkit/tests/testReporter.js',
'canvaskit/bin/canvaskit.js',
'tests/canvaskitinit.js',
'tests/util.js',
'tests/*.spec.js'
],
proxies: {
'/assets/': '/base/tests/assets/',
'/canvaskit/': '/base/canvaskit/bin/',
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 4444,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
browserDisconnectTimeout: 20000,
browserNoActivityTimeout: 20000,
// start these browsers
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
};
if (isDocker) {
// See https://hackernoon.com/running-karma-tests-with-headless-chrome-inside-docker-ae4aceb06ed3
cfg.browsers = ['ChromeHeadlessNoSandbox'],
cfg.customLaunchers = {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: [
// Without this flag, we see an error:
// Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
'--no-sandbox',
// may help tests be less flaky
// https://peter.sh/experiments/chromium-command-line-switches/#browser-test
'--browser-test',
// This can also help avoid crashes/timeouts:
// https://github.com/GoogleChrome/puppeteer/issues/1834
'--disable-dev-shm-usage',
],
},
};
}
config.set(cfg);
}