Skip to content

Commit ed9b96c

Browse files
author
John Kleinschmidt
authored
ci: test on woa hardware (6-0-x) (electron#20092)
* ci: test on woa hardware * ci: run tests on WOA hardware (electron#20031) * ci: run tests on WOA hardware * Temporarily disable test until electron#20008 is resolved * deterministically run tests in sorted order (cherry picked from commit bedc5f7) * Disable test on WOA until electron#20008 is resolved * use request instead of blur to detect openExternal success * use blur event on mac, sigh * oh, right, still gotta open an actual url * Try to track down GPUinfo failure * Make function async * Check exitCode * Try to resolve bad exit code on GPUInfo test * Add logging to figure out failures on BrowserWindow.moveTop() * Revert "Add logging to figure out failures on BrowserWindow.moveTop()" This reverts commit e21ace3. * Disable test until electron#20110 is resolved * fix lint issue
1 parent 0f27712 commit ed9b96c

File tree

11 files changed

+71
-46
lines changed

11 files changed

+71
-46
lines changed

appveyor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,5 @@ deploy_script:
119119
& python script\upload.py
120120
}
121121
} elseif (Test-Path Env:\TEST_WOA) {
122-
# node script/release/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
123-
echo "Eventually run tests on WOA hardware at this step"
122+
node script/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
124123
}

azure-pipelines-woa.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ steps:
66

77
- script: |
88
cd src\electron
9-
npm install --verbose
10-
displayName: 'NPM install'
9+
node script/yarn.js install --frozen-lockfile
10+
displayName: 'Yarn install'
1111

1212
- powershell: |
1313
$localArtifactPath = "$pwd\dist.zip"
@@ -27,16 +27,6 @@ steps:
2727
env:
2828
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
2929

30-
- powershell: |
31-
$localArtifactPath = "$pwd\src\out\Default\mksnapshot.zip"
32-
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/mksnapshot.zip"
33-
Invoke-RestMethod -Method Get -Uri $serverArtifactPath -OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $env:APPVEYOR_TOKEN" }
34-
cd src\out\Default
35-
& "${env:ProgramFiles(x86)}\7-Zip\7z.exe" x -y mksnapshot.zip
36-
displayName: 'Download and unzip mksnapshot.zip for test'
37-
env:
38-
APPVEYOR_TOKEN: $(APPVEYOR_TOKEN)
39-
4030
- powershell: |
4131
$localArtifactPath = "$pwd\src\node_headers.zip"
4232
$serverArtifactPath = "$env:APPVEYOR_URL/buildjobs/$env:APPVEYOR_JOB_ID/artifacts/node_headers.zip"
@@ -70,6 +60,16 @@ steps:
7060
env:
7161
ELECTRON_OUT_DIR: Default
7262
IGNORE_YARN_INSTALL_ERROR: 1
63+
ELECTRON_TEST_RESULTS_DIR: junit
64+
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
65+
MOCHA_REPORTER: mocha-multi-reporters
66+
67+
- task: PublishTestResults@2
68+
displayName: 'Publish Test Results'
69+
inputs:
70+
testResultsFiles: '*.xml'
71+
searchFolder: '$(System.DefaultWorkingDirectory)/src/junit/'
72+
condition: always()
7373

7474
- script: |
7575
cd src
@@ -78,7 +78,7 @@ steps:
7878
displayName: 'Verify ffmpeg'
7979

8080
- script: |
81-
cd src
82-
echo "Verifying mksnapshot"
83-
python electron\script\verify-mksnapshot.py --build-dir out\Default --source-root %cd%
84-
displayName: 'Verify mksnapshot'
81+
taskkill /F /IM electron.exe
82+
taskkill /F /IM MicrosoftEdge.exe
83+
displayName: 'Kill processes left running from last test run'
84+
condition: always()

script/spec-runner.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ async function main () {
6060
function generateTypeDefinitions () {
6161
const { status } = childProcess.spawnSync('npm', ['run', 'create-typescript-definitions'], {
6262
cwd: path.resolve(__dirname, '..'),
63-
stdio: 'inherit'
63+
stdio: 'inherit',
64+
shell: true
6465
})
6566
if (status !== 0) {
6667
throw new Error(`Electron typescript definition generation failed with exit code: ${status}.`)

script/verify-ffmpeg.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
import argparse
33
import os
4+
import platform
45
import shutil
56
import subprocess
67
import sys
@@ -45,7 +46,10 @@ def main():
4546
env['ELECTRON_ENABLE_STACK_DUMPING'] = 'true'
4647
# FIXME: Enable after ELECTRON_ENABLE_LOGGING works again
4748
# env['ELECTRON_ENABLE_LOGGING'] = 'true'
48-
subprocess.check_call([electron, test_path] + sys.argv[1:], env=env)
49+
testargs = [electron, test_path]
50+
if sys.platform == 'win32' and platform.machine() == 'ARM64':
51+
testargs.append('--disable-accelerated-video-decode')
52+
subprocess.check_call(testargs, env=env)
4953
except subprocess.CalledProcessError as e:
5054
returncode = e.returncode
5155
except KeyboardInterrupt:

spec-main/api-app-spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,9 @@ describe('app module', () => {
10341034
return JSON.parse(gpuInfoData)
10351035
} else {
10361036
// return error if not clean exit
1037+
console.log('Error getting GPU INFO, exit code is:', exitCode)
1038+
console.log('Error getting GPU INFO', errorData)
1039+
console.log('GPU data: ', gpuInfoData)
10371040
return Promise.reject(new Error(errorData))
10381041
}
10391042
}

spec-main/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,17 @@ app.whenReady().then(() => {
6666
? new RegExp(process.env.npm_config_match, 'g')
6767
: null
6868

69+
const testFiles = []
6970
walker.on('file', (file) => {
7071
if (/-spec\.[tj]s$/.test(file) &&
7172
(!moduleMatch || moduleMatch.test(file))) {
72-
mocha.addFile(file)
73+
testFiles.push(file)
7374
}
7475
})
7576

7677
walker.on('end', () => {
78+
testFiles.sort()
79+
testFiles.forEach((file) => mocha.addFile(file))
7780
const cb = () => {
7881
// Ensure the callback is called after runner is defined
7982
process.nextTick(() => {

spec/api-browser-window-spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,10 @@ describe('BrowserWindow module', () => {
514514
})
515515
})
516516

517-
describe('BrowserWindow.moveTop()', () => {
517+
// Temporarily disable on WOA until
518+
// https://github.com/electron/electron/issues/20110 is resolved
519+
const skip = process.platform === 'win32' && process.arch === 'arm64';
520+
(skip ? describe.skip : describe)('BrowserWindow.moveTop()', () => {
518521
it('should not steal focus', async () => {
519522
const posDelta = 50
520523
const wShownInactive = emittedOnce(w, 'show')

spec/api-shell-spec.js

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ const assert = require('assert')
22
const fs = require('fs')
33
const path = require('path')
44
const os = require('os')
5+
const http = require('http')
56
const { shell, remote } = require('electron')
67
const { BrowserWindow } = remote
78

89
const { closeWindow } = require('./window-helpers')
10+
const { emittedOnce } = require('./events-helpers')
911

1012
describe('shell module', () => {
1113
const fixtures = path.resolve(__dirname, 'fixtures')
@@ -42,32 +44,34 @@ describe('shell module', () => {
4244
}
4345
})
4446

45-
it('opens an external link asynchronously', done => {
46-
const url = 'http://www.example.com'
47+
it('opens an external link asynchronously', async () => {
48+
let url = 'http://127.0.0.1'
49+
let requestReceived
4750
if (process.platform === 'linux') {
4851
process.env.BROWSER = '/bin/true'
4952
process.env.DE = 'generic'
5053
process.env.DISPLAY = ''
54+
requestReceived = Promise.resolve()
55+
} else if (process.platform === 'darwin') {
56+
// On the Mac CI machines, Safari tries to ask for a password to the
57+
// code signing keychain we set up to test code signing (see
58+
// https://github.com/electron/electron/pull/19969#issuecomment-526278890),
59+
// so use a blur event as a crude proxy.
60+
w = new BrowserWindow({ show: true })
61+
requestReceived = emittedOnce(w, 'blur')
62+
} else {
63+
const server = http.createServer((req, res) => {
64+
res.end()
65+
})
66+
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve))
67+
requestReceived = new Promise(resolve => server.on('connection', () => resolve()))
68+
url = `http://127.0.0.1:${server.address().port}`
5169
}
5270

53-
// Ensure an external window is activated via a new window's blur event
54-
w = new BrowserWindow()
55-
let promiseResolved = false
56-
let blurEventEmitted = false
57-
58-
w.on('blur', () => {
59-
blurEventEmitted = true
60-
if (promiseResolved) {
61-
done()
62-
}
63-
})
64-
65-
shell.openExternal(url).then(() => {
66-
promiseResolved = true
67-
if (blurEventEmitted || process.platform === 'linux') {
68-
done()
69-
}
70-
})
71+
await Promise.all([
72+
shell.openExternal(url),
73+
requestReceived
74+
])
7175
})
7276

7377
it('opens an external link synchronously', () => {

spec/api-web-contents-spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ describe('webContents module', () => {
5555
.and.have.property('code', 'ERR_FILE_NOT_FOUND')
5656
})
5757

58-
it('rejects when loading fails due to DNS not resolved', async () => {
58+
// Temporarily disable on WOA until
59+
// https://github.com/electron/electron/issues/20008 is resolved
60+
const testFn = (process.platform === 'win32' && process.arch === 'arm64' ? it.skip : it)
61+
testFn('rejects when loading fails due to DNS not resolved', async () => {
5962
await expect(w.loadURL('https://err.name.not.resolved')).to.eventually.be.rejected
6063
.and.have.property('code', 'ERR_NAME_NOT_RESOLVED')
6164
})

spec/fixtures/api/gpu-info.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ app.on('ready', () => {
66
const infoType = process.argv.pop()
77
app.getGPUInfo(infoType).then(
88
(gpuInfo) => {
9-
console.log(JSON.stringify(gpuInfo))
10-
app.exit(0)
9+
setImmediate(() => {
10+
console.log(JSON.stringify(gpuInfo))
11+
app.exit(0)
12+
})
1113
},
1214
(error) => {
1315
console.error(error)

0 commit comments

Comments
 (0)