Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eng: add io warmup for webkit tests in ci #193711

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import * as assert from 'assert';
import { Event } from 'vs/base/common/event';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { isWeb } from 'vs/base/common/platform';
import { mock } from 'vs/base/test/common/mock';
import { assertSnapshot } from 'vs/base/test/common/snapshot';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
Expand All @@ -20,8 +19,7 @@ import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { createNotebookCellList, setupInstantiationService, withTestNotebook } from 'vs/workbench/contrib/notebook/test/browser/testNotebookEditor';
import { OutlineTarget } from 'vs/workbench/services/outline/browser/outline';


(isWeb ? suite.skip : suite)('NotebookEditorStickyScroll', () => {
suite('NotebookEditorStickyScroll', () => {
let disposables: DisposableStore;
let instantiationService: TestInstantiationService;

Expand Down
16 changes: 9 additions & 7 deletions test/unit/browser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,15 @@ async function runTestsInBrowser(testModules, browserType) {
const page = await context.newPage();
const target = url.pathToFileURL(path.join(__dirname, 'renderer.html'));
if (argv.build) {
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
target.search = `?build=true&ci=true`;
} else {
target.search = `?build=true`;
}
} else if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
target.search = `?ci=true`;
target.searchParams.set('build', 'true');
}
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
target.searchParams.set('ci', 'true');
}

// see comment on warmupExposedMethods in renderer.html for what's going on
if (browserType === 'webkit') {
target.searchParams.set('ioWarmup', __dirname);
}

const emitter = new events.EventEmitter();
Expand Down
20 changes: 19 additions & 1 deletion test/unit/browser/renderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,25 @@
}
}

/**
* There is some bug in WebKit on macOS in CI only that causes the first
* invokation of the file functions to (sometimes) take an inordinately
* long period of time to run. Get around this by invoking them here.
*/
async function doIoWarmup() {
const dir = url.searchParams.get('ioWarmup');
if (!dir) {
return;
}

// these are the only two functions actually used in CI presently:
await __readFileInTests(dir + '/' + 'renderer.html');
await __readDirInTests(dir);
}

window.loadAndRun = async function loadAndRun({ modules, grep }, manual = false) {
// load
await doIoWarmup();
await loadModules(modules);
// await new Promise((resolve, reject) => {
// require(modules, resolve, err => {
Expand All @@ -152,7 +169,8 @@
});
}

const modules = new URL(window.location.href).searchParams.getAll('m');
const url = new URL(window.location.href);
const modules = url.searchParams.getAll('m');
if (Array.isArray(modules) && modules.length > 0) {
console.log('MANUALLY running tests', modules);

Expand Down