forked from microsoft/playwright
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
devops: teach buildbots to run sanity check script (microsoft#2064)
This should make sure that build actually runs.
- Loading branch information
1 parent
7051c0b
commit 4c2c485
Showing
5 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
set -e | ||
set +x | ||
|
||
trap "cd $(pwd -P)" EXIT | ||
cd "$(dirname $0)" | ||
|
||
if [[ "$(uname)" == "Darwin" ]]; then | ||
node ./sanity.js | ||
elif [[ "$(uname)" == "Linux" ]]; then | ||
xvfb-run --auto-servernum node ./sanity.js | ||
elif [[ "$(uname)" == MINGW* ]]; then | ||
node ./sanity.js | ||
else | ||
echo "ERROR: cannot check sanity on this platform!" 1>&2 | ||
exit 1; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const {firefox} = require('../..'); | ||
const os = require('os'); | ||
const path = require('path'); | ||
|
||
const executablePath = { | ||
'darwin': path.join(__dirname, 'checkout', 'obj-build-playwright', 'dist', 'Nightly.app', 'Contents', 'MacOS', 'firefox'), | ||
'linux': path.join(__dirname, 'checkout', 'obj-build-playwright', 'dist', 'bin', 'firefox'), | ||
'win32': path.join(__dirname, 'checkout', 'obj-build-playwright', 'dist', 'bin', 'firefox.exe'), | ||
}[os.platform()]; | ||
|
||
async function checkSanity(options) { | ||
const browser = await firefox.launch({...options, executablePath}); | ||
const context = await browser.newContext(); | ||
const page = await context.newPage(); | ||
const result = await page.evaluate(() => 6 * 7); | ||
await browser.close(); | ||
if (result !== 42) | ||
throw new Error(`ERROR: computation failed!`); | ||
console.log(`SUCCESS: ran firefox with options = ${JSON.stringify(options)}`); | ||
} | ||
|
||
Promise.all([ | ||
checkSanity({headless: true}), | ||
checkSanity({headless: false}), | ||
]).catch(e => { | ||
console.error(e); | ||
process.exitCode = 1; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
set -e | ||
set +x | ||
|
||
trap "cd $(pwd -P)" EXIT | ||
cd "$(dirname $0)" | ||
|
||
if [[ "$(uname)" == "Darwin" ]]; then | ||
node ./sanity.js | ||
elif [[ "$(uname)" == "Linux" ]]; then | ||
xvfb-run --auto-servernum node ./sanity.js | ||
elif [[ "$(uname)" == MINGW* ]]; then | ||
echo "Sanity check on windows is not supported" | ||
else | ||
echo "ERROR: cannot check sanity on this platform!" 1>&2 | ||
exit 1; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const {firefox} = require('../..'); | ||
const os = require('os'); | ||
const path = require('path'); | ||
|
||
const executablePath = { | ||
'darwin': path.join(__dirname, 'pw_run.sh'), | ||
'linux': path.join(__dirname, 'pw_run.sh'), | ||
'win32': undefined, | ||
}[os.platform()]; | ||
|
||
// TODO: verify build on windows. | ||
if (!executablePath) | ||
return; | ||
|
||
async function checkSanity(options) { | ||
const browser = await firefox.launch({...options, executablePath}); | ||
const context = await browser.newContext(); | ||
const page = await context.newPage(); | ||
const result = await page.evaluate(() => 7 * 8); | ||
await browser.close(); | ||
if (result !== 56) | ||
throw new Error(`ERROR: computation failed!`); | ||
console.log(`SUCCESS: ran webkit with options = ${JSON.stringify(options)}`); | ||
} | ||
|
||
Promise.all([ | ||
checkSanity({headless: true}), | ||
checkSanity({headless: false}), | ||
]).catch(e => { | ||
console.error(e); | ||
process.exitCode = 1; | ||
}); | ||
|