Merge pull request #5358 from electron/windows-ci

Run tests on Windows CI machine
This commit is contained in:
Cheng Zhao 2016-04-30 21:18:23 +09:00
commit 5766f4703a
7 changed files with 52 additions and 16 deletions

View file

@ -14,10 +14,6 @@ install:
- cmd: SET PATH=C:\python27;%PATH%
- cmd: python script/cibuild
branches:
only:
- master
# disable build and test pahses
build: off
test: off

View file

@ -75,8 +75,10 @@ def main():
run_script('create-dist.py')
run_script('upload.py')
else:
if PLATFORM == 'win32':
os.environ['OUTPUT_TO_FILE'] = 'output.log'
run_script('build.py', ['-c', 'D'])
if PLATFORM != 'win32' and target_arch == 'x64':
if PLATFORM == 'win32' or target_arch == 'x64':
run_script('test.py', ['--ci'])

View file

@ -4,7 +4,7 @@ import os
import subprocess
import sys
from lib.util import atom_gyp
from lib.util import atom_gyp, rm_rf
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
@ -30,7 +30,20 @@ def main():
else:
atom_shell = os.path.join(SOURCE_ROOT, 'out', config, PROJECT_NAME)
subprocess.check_call([atom_shell, 'spec'] + sys.argv[1:])
returncode = 0
try:
subprocess.check_call([atom_shell, 'spec'] + sys.argv[1:])
except subprocess.CalledProcessError as e:
returncode = e.returncode
if os.environ.has_key('OUTPUT_TO_FILE'):
output_to_file = os.environ['OUTPUT_TO_FILE']
with open(output_to_file, 'r') as f:
print f.read()
rm_rf(output_to_file)
return returncode
if __name__ == '__main__':

View file

@ -173,11 +173,12 @@ describe('browser-window module', function () {
})
it('does not crash in did-fail-provisional-load handler', function (done) {
this.timeout(10000)
w.webContents.once('did-fail-provisional-load', function () {
w.loadURL('http://localhost:11111')
w.loadURL('http://127.0.0.1:11111')
done()
})
w.loadURL('http://localhost:11111')
w.loadURL('http://127.0.0.1:11111')
})
})

View file

@ -1,7 +1,13 @@
const assert = require('assert')
const desktopCapturer = require('electron').desktopCapturer
const isCI = require('electron').remote.getGlobal('isCi')
describe('desktopCapturer', function () {
if (isCI && process.platform === 'win32') {
return
}
it('should return a non-empty array of sources', function (done) {
desktopCapturer.getSources({
types: ['window', 'screen']

View file

@ -62,6 +62,10 @@ describe('chromium feature', function () {
w.loadURL(url)
})
if (isCI && process.platform === 'win32') {
return
}
it('is set correctly when window is inactive', function (done) {
w = new BrowserWindow({
show: false
@ -97,6 +101,9 @@ describe('chromium feature', function () {
if (isCI && process.platform === 'linux') {
return
}
if (isCI && process.platform === 'win32') {
return
}
it('can return labels of enumerated devices', function (done) {
navigator.mediaDevices.enumerateDevices().then((devices) => {
@ -327,6 +334,10 @@ describe('chromium feature', function () {
})
describe('webgl', function () {
if (isCI && process.platform === 'win32') {
return
}
it('can be get as context in canvas', function () {
if (process.platform === 'linux') return

View file

@ -7,8 +7,10 @@ const ipcMain = electron.ipcMain
const dialog = electron.dialog
const BrowserWindow = electron.BrowserWindow
const fs = require('fs')
const path = require('path')
const url = require('url')
const util = require('util')
var argv = require('yargs')
.boolean('ci')
@ -35,13 +37,18 @@ ipcMain.on('message', function (event, arg) {
event.sender.send('message', arg)
})
ipcMain.on('console.log', function (event, args) {
console.error.apply(console, args)
})
ipcMain.on('console.error', function (event, args) {
console.error.apply(console, args)
})
// Write output to file if OUTPUT_TO_FILE is defined.
const outputToFile = process.env.OUTPUT_TO_FILE
const print = function (_, args) {
let output = util.format.apply(null, args)
if (outputToFile) {
fs.appendFileSync(outputToFile, output + '\n')
} else {
console.error(output)
}
}
ipcMain.on('console.log', print)
ipcMain.on('console.error', print)
ipcMain.on('process.exit', function (event, code) {
process.exit(code)