ci: enable crashReporter tests on mac (#19582)
This commit is contained in:
parent
fe956f87ec
commit
2470ef2e91
3 changed files with 35 additions and 91 deletions
|
@ -149,9 +149,6 @@ env-mac-large: &env-mac-large
|
||||||
env-mac-large-release: &env-mac-large-release
|
env-mac-large-release: &env-mac-large-release
|
||||||
NUMBER_OF_NINJA_PROCESSES: 8
|
NUMBER_OF_NINJA_PROCESSES: 8
|
||||||
|
|
||||||
env-disable-crash-reporter-tests: &env-disable-crash-reporter-tests
|
|
||||||
DISABLE_CRASH_REPORTER_TESTS: true
|
|
||||||
|
|
||||||
env-ninja-status: &env-ninja-status
|
env-ninja-status: &env-ninja-status
|
||||||
NINJA_STATUS: "[%r processes, %f/%t @ %o/s : %es] "
|
NINJA_STATUS: "[%r processes, %f/%t @ %o/s : %es] "
|
||||||
|
|
||||||
|
@ -1690,7 +1687,6 @@ jobs:
|
||||||
environment:
|
environment:
|
||||||
<<: *env-mac-large
|
<<: *env-mac-large
|
||||||
<<: *env-stack-dumping
|
<<: *env-stack-dumping
|
||||||
<<: *env-disable-crash-reporter-tests
|
|
||||||
<<: *steps-tests
|
<<: *steps-tests
|
||||||
|
|
||||||
osx-release-tests:
|
osx-release-tests:
|
||||||
|
@ -1699,7 +1695,6 @@ jobs:
|
||||||
<<: *env-mac-large
|
<<: *env-mac-large
|
||||||
<<: *env-stack-dumping
|
<<: *env-stack-dumping
|
||||||
<<: *env-send-slack-notifications
|
<<: *env-send-slack-notifications
|
||||||
<<: *env-disable-crash-reporter-tests
|
|
||||||
<<: *steps-tests
|
<<: *steps-tests
|
||||||
|
|
||||||
osx-verify-ffmpeg:
|
osx-verify-ffmpeg:
|
||||||
|
|
|
@ -8,6 +8,7 @@ const path = require('path')
|
||||||
const temp = require('temp').track()
|
const temp = require('temp').track()
|
||||||
const url = require('url')
|
const url = require('url')
|
||||||
const { closeWindow } = require('./window-helpers')
|
const { closeWindow } = require('./window-helpers')
|
||||||
|
const { ifit, ifdescribe } = require('./spec-helpers')
|
||||||
|
|
||||||
const { remote } = require('electron')
|
const { remote } = require('electron')
|
||||||
const { app, BrowserWindow, crashReporter } = remote
|
const { app, BrowserWindow, crashReporter } = remote
|
||||||
|
@ -15,15 +16,11 @@ const { app, BrowserWindow, crashReporter } = remote
|
||||||
const { expect } = chai
|
const { expect } = chai
|
||||||
chai.use(dirtyChai)
|
chai.use(dirtyChai)
|
||||||
|
|
||||||
describe('crashReporter module', () => {
|
// TODO(alexeykuzmin): [Ch66] Fails on linux. Fix it and enable back.
|
||||||
if (process.mas || process.env.DISABLE_CRASH_REPORTER_TESTS) return
|
ifdescribe(!process.mas && process.platform !== 'linux')('crashReporter module', () => {
|
||||||
|
|
||||||
// TODO(alexeykuzmin): [Ch66] Fails. Fix it and enable back.
|
|
||||||
if (process.platform === 'linux') return
|
|
||||||
|
|
||||||
let originalTempDirectory = null
|
let originalTempDirectory = null
|
||||||
let tempDirectory = null
|
let tempDirectory = null
|
||||||
const specTimeout = 180000
|
const specTimeout = 10000
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
tempDirectory = temp.mkdirSync('electronCrashReporterSpec-')
|
tempDirectory = temp.mkdirSync('electronCrashReporterSpec-')
|
||||||
|
@ -68,19 +65,21 @@ describe('crashReporter module', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should send minidump when node processes crash', function (done) {
|
ifit(!browserWindowOpts.webPreferences.sandbox)('should send minidump when node processes crash', function (done) {
|
||||||
this.timeout(specTimeout)
|
this.timeout(specTimeout)
|
||||||
|
|
||||||
stopServer = startServer({
|
stopServer = startServer({
|
||||||
callback (port) {
|
callback (port) {
|
||||||
const crashesDir = path.join(app.getPath('temp'), `${app.name} Crashes`)
|
const crashesDir = path.join(app.getPath('temp'), `${app.name} Crashes`)
|
||||||
const version = app.getVersion()
|
const version = app.getVersion()
|
||||||
const crashPath = path.join(fixtures, 'module', 'crash.js')
|
const crashPath = path.join(fixtures, 'module', 'crash.js')
|
||||||
|
w.loadFile(path.join(fixtures, 'api', 'crash_child.html'), { query: { port, crashesDir, crashPath, version } })
|
||||||
childProcess.fork(crashPath, [port, version, crashesDir], { silent: true })
|
|
||||||
},
|
},
|
||||||
processType: 'node',
|
processType: 'node',
|
||||||
done: done
|
done: done,
|
||||||
|
preAssert: fields => {
|
||||||
|
expect(String(fields.newExtra)).to.equal('newExtra')
|
||||||
|
expect(fields.removeExtra).to.be.undefined()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -150,44 +149,6 @@ describe('crashReporter module', () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should send minidump with updated extra parameters when node processes crash', function (done) {
|
|
||||||
if (process.platform === 'linux') {
|
|
||||||
// FIXME(alexeykuzmin): Skip the test.
|
|
||||||
// this.skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// TODO(alexeykuzmin): Skip the test instead of marking it as passed.
|
|
||||||
if (process.platform === 'win32') return done()
|
|
||||||
this.timeout(specTimeout)
|
|
||||||
stopServer = startServer({
|
|
||||||
callback (port) {
|
|
||||||
const crashesDir = path.join(app.getPath('temp'), `${process.platform === 'win32' ? 'Zombies' : app.getName()} Crashes`)
|
|
||||||
const version = app.getVersion()
|
|
||||||
const crashPath = path.join(fixtures, 'module', 'crash.js')
|
|
||||||
if (process.platform === 'win32') {
|
|
||||||
const crashServiceProcess = childProcess.spawn(process.execPath, [
|
|
||||||
`--reporter-url=http://127.0.0.1:${port}`,
|
|
||||||
'--application-name=Zombies',
|
|
||||||
`--crashes-directory=${crashesDir}`
|
|
||||||
], {
|
|
||||||
env: {
|
|
||||||
ELECTRON_INTERNAL_CRASH_SERVICE: 1
|
|
||||||
},
|
|
||||||
detached: true
|
|
||||||
})
|
|
||||||
remote.process.crashServicePid = crashServiceProcess.pid
|
|
||||||
}
|
|
||||||
childProcess.fork(crashPath, [port, version, crashesDir], { silent: true })
|
|
||||||
},
|
|
||||||
processType: 'browser',
|
|
||||||
done: done,
|
|
||||||
preAssert: fields => {
|
|
||||||
expect(String(fields.newExtra)).to.equal('newExtra')
|
|
||||||
expect(String(fields.removeExtra)).to.equal(undefined)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should send minidump with updated extra parameters', function (done) {
|
it('should send minidump with updated extra parameters', function (done) {
|
||||||
this.timeout(specTimeout)
|
this.timeout(specTimeout)
|
||||||
|
|
||||||
|
@ -305,12 +266,6 @@ describe('crashReporter module', () => {
|
||||||
expect(() => require('electron').crashReporter.getUploadToServer()).to.throw()
|
expect(() => require('electron').crashReporter.getUploadToServer()).to.throw()
|
||||||
})
|
})
|
||||||
it('returns true when uploadToServer is set to true', function () {
|
it('returns true when uploadToServer is set to true', function () {
|
||||||
if (process.platform === 'linux') {
|
|
||||||
// FIXME(alexeykuzmin): Skip the test.
|
|
||||||
// this.skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
crashReporter.start({
|
crashReporter.start({
|
||||||
companyName: 'Umbrella Corporation',
|
companyName: 'Umbrella Corporation',
|
||||||
submitURL: 'http://127.0.0.1/crashes',
|
submitURL: 'http://127.0.0.1/crashes',
|
||||||
|
@ -319,12 +274,6 @@ describe('crashReporter module', () => {
|
||||||
expect(crashReporter.getUploadToServer()).to.be.true()
|
expect(crashReporter.getUploadToServer()).to.be.true()
|
||||||
})
|
})
|
||||||
it('returns false when uploadToServer is set to false', function () {
|
it('returns false when uploadToServer is set to false', function () {
|
||||||
if (process.platform === 'linux') {
|
|
||||||
// FIXME(alexeykuzmin): Skip the test.
|
|
||||||
// this.skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
crashReporter.start({
|
crashReporter.start({
|
||||||
companyName: 'Umbrella Corporation',
|
companyName: 'Umbrella Corporation',
|
||||||
submitURL: 'http://127.0.0.1/crashes',
|
submitURL: 'http://127.0.0.1/crashes',
|
||||||
|
@ -340,12 +289,6 @@ describe('crashReporter module', () => {
|
||||||
expect(() => require('electron').crashReporter.setUploadToServer('arg')).to.throw()
|
expect(() => require('electron').crashReporter.setUploadToServer('arg')).to.throw()
|
||||||
})
|
})
|
||||||
it('sets uploadToServer false when called with false', function () {
|
it('sets uploadToServer false when called with false', function () {
|
||||||
if (process.platform === 'linux') {
|
|
||||||
// FIXME(alexeykuzmin): Skip the test.
|
|
||||||
// this.skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
crashReporter.start({
|
crashReporter.start({
|
||||||
companyName: 'Umbrella Corporation',
|
companyName: 'Umbrella Corporation',
|
||||||
submitURL: 'http://127.0.0.1/crashes',
|
submitURL: 'http://127.0.0.1/crashes',
|
||||||
|
@ -355,12 +298,6 @@ describe('crashReporter module', () => {
|
||||||
expect(crashReporter.getUploadToServer()).to.be.false()
|
expect(crashReporter.getUploadToServer()).to.be.false()
|
||||||
})
|
})
|
||||||
it('sets uploadToServer true when called with true', function () {
|
it('sets uploadToServer true when called with true', function () {
|
||||||
if (process.platform === 'linux') {
|
|
||||||
// FIXME(alexeykuzmin): Skip the test.
|
|
||||||
// this.skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
crashReporter.start({
|
crashReporter.start({
|
||||||
companyName: 'Umbrella Corporation',
|
companyName: 'Umbrella Corporation',
|
||||||
submitURL: 'http://127.0.0.1/crashes',
|
submitURL: 'http://127.0.0.1/crashes',
|
||||||
|
@ -382,12 +319,6 @@ describe('crashReporter module', () => {
|
||||||
expect(parameters).to.be.an('object')
|
expect(parameters).to.be.an('object')
|
||||||
})
|
})
|
||||||
it('adds a parameter to current parameters', function () {
|
it('adds a parameter to current parameters', function () {
|
||||||
if (process.platform === 'linux') {
|
|
||||||
// FIXME(alexeykuzmin): Skip the test.
|
|
||||||
// this.skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
crashReporter.start({
|
crashReporter.start({
|
||||||
companyName: 'Umbrella Corporation',
|
companyName: 'Umbrella Corporation',
|
||||||
submitURL: 'http://127.0.0.1/crashes'
|
submitURL: 'http://127.0.0.1/crashes'
|
||||||
|
@ -397,12 +328,6 @@ describe('crashReporter module', () => {
|
||||||
expect(crashReporter.getParameters()).to.have.a.property('hello')
|
expect(crashReporter.getParameters()).to.have.a.property('hello')
|
||||||
})
|
})
|
||||||
it('removes a parameter from current parameters', function () {
|
it('removes a parameter from current parameters', function () {
|
||||||
if (process.platform === 'linux') {
|
|
||||||
// FIXME(alexeykuzmin): Skip the test.
|
|
||||||
// this.skip()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
crashReporter.start({
|
crashReporter.start({
|
||||||
companyName: 'Umbrella Corporation',
|
companyName: 'Umbrella Corporation',
|
||||||
submitURL: 'http://127.0.0.1/crashes'
|
submitURL: 'http://127.0.0.1/crashes'
|
||||||
|
|
24
spec/fixtures/api/crash_child.html
vendored
Normal file
24
spec/fixtures/api/crash_child.html
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
|
||||||
|
const query = new URLSearchParams(location.search)
|
||||||
|
const port = query.get('port')
|
||||||
|
const version = query.get('version')
|
||||||
|
const crashesDir = query.get('crashesDir')
|
||||||
|
const crashPath = query.get('crashPath')
|
||||||
|
|
||||||
|
const { crashReporter } = require('electron');
|
||||||
|
|
||||||
|
crashReporter.start({
|
||||||
|
productName: 'Zombies',
|
||||||
|
companyName: 'Umbrella Corporation',
|
||||||
|
submitURL: 'http://127.0.0.1:' + port
|
||||||
|
})
|
||||||
|
|
||||||
|
require('child_process').fork(crashPath, [port, version, crashesDir])
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in a new issue