mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
smoke - enable crash reporter (#152041)
* smoke - enable crash reporter * nix da only!
This commit is contained in:
parent
037af4beaf
commit
1ba0e7b601
|
@ -322,7 +322,7 @@ function configureCrashReporter() {
|
|||
|
||||
if (!fs.existsSync(crashReporterDirectory)) {
|
||||
try {
|
||||
fs.mkdirSync(crashReporterDirectory);
|
||||
fs.mkdirSync(crashReporterDirectory, { recursive: true });
|
||||
} catch (error) {
|
||||
console.error(`The path '${crashReporterDirectory}' specified for --crash-reporter-directory does not seem to exist or cannot be created.`);
|
||||
app.exit(1);
|
||||
|
|
|
@ -24,6 +24,7 @@ export interface LaunchOptions {
|
|||
readonly extensionsPath: string;
|
||||
readonly logger: Logger;
|
||||
logsPath: string;
|
||||
crashesPath: string;
|
||||
readonly verbose?: boolean;
|
||||
readonly extraArgs?: string[];
|
||||
readonly remote?: boolean;
|
||||
|
|
|
@ -19,7 +19,7 @@ export interface IElectronConfiguration {
|
|||
}
|
||||
|
||||
export async function resolveElectronConfiguration(options: LaunchOptions): Promise<IElectronConfiguration> {
|
||||
const { codePath, workspacePath, extensionsPath, userDataDir, remote, logger, logsPath, extraArgs } = options;
|
||||
const { codePath, workspacePath, extensionsPath, userDataDir, remote, logger, logsPath, crashesPath, extraArgs } = options;
|
||||
const env = { ...process.env };
|
||||
|
||||
const args = [
|
||||
|
@ -30,7 +30,7 @@ export async function resolveElectronConfiguration(options: LaunchOptions): Prom
|
|||
'--no-cached-data',
|
||||
'--disable-updates',
|
||||
'--disable-keytar',
|
||||
'--disable-crash-reporter',
|
||||
`--crash-reporter-directory=${crashesPath}`,
|
||||
'--disable-workspace-trust',
|
||||
`--extensions-dir=${extensionsPath}`,
|
||||
`--user-data-dir=${userDataDir}`,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { join } from 'path';
|
||||
import { Application, ApplicationOptions, Logger, Quality } from '../../../../automation';
|
||||
import { createApp, timeout, installDiagnosticsHandler, installAppAfterHandler, getRandomUserDataDir, suiteLogsPath } from '../../utils';
|
||||
import { createApp, timeout, installDiagnosticsHandler, installAppAfterHandler, getRandomUserDataDir, suiteLogsPath, suiteCrashPath } from '../../utils';
|
||||
|
||||
export function setup(ensureStableCode: () => string | undefined, logger: Logger) {
|
||||
describe('Data Loss (insiders -> insiders)', () => {
|
||||
|
@ -19,7 +19,8 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
|
|||
it('verifies opened editors are restored', async function () {
|
||||
app = createApp({
|
||||
...this.defaultOptions,
|
||||
logsPath: suiteLogsPath(this.defaultOptions, 'test_verifies_opened_editors_are_restored')
|
||||
logsPath: suiteLogsPath(this.defaultOptions, 'test_verifies_opened_editors_are_restored'),
|
||||
crashesPath: suiteCrashPath(this.defaultOptions, 'test_verifies_opened_editors_are_restored')
|
||||
});
|
||||
await app.start();
|
||||
|
||||
|
@ -44,7 +45,8 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
|
|||
it('verifies editors can save and restore', async function () {
|
||||
app = createApp({
|
||||
...this.defaultOptions,
|
||||
logsPath: suiteLogsPath(this.defaultOptions, 'test_verifies_editors_can_save_and_restore')
|
||||
logsPath: suiteLogsPath(this.defaultOptions, 'test_verifies_editors_can_save_and_restore'),
|
||||
crashesPath: suiteCrashPath(this.defaultOptions, 'test_verifies_editors_can_save_and_restore')
|
||||
});
|
||||
await app.start();
|
||||
|
||||
|
@ -84,7 +86,8 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
|
|||
async function testHotExit(title: string, restartDelay: number | undefined, autoSave: boolean | undefined) {
|
||||
app = createApp({
|
||||
...this.defaultOptions,
|
||||
logsPath: suiteLogsPath(this.defaultOptions, title)
|
||||
logsPath: suiteLogsPath(this.defaultOptions, title),
|
||||
crashesPath: suiteCrashPath(this.defaultOptions, title)
|
||||
});
|
||||
await app.start();
|
||||
|
||||
|
@ -153,12 +156,14 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
|
|||
|
||||
const userDataDir = getRandomUserDataDir(this.defaultOptions);
|
||||
const logsPath = suiteLogsPath(this.defaultOptions, 'test_verifies_opened_editors_are_restored_from_stable');
|
||||
const crashesPath = suiteCrashPath(this.defaultOptions, 'test_verifies_opened_editors_are_restored_from_stable');
|
||||
|
||||
const stableOptions: ApplicationOptions = Object.assign({}, this.defaultOptions);
|
||||
stableOptions.codePath = stableCodePath;
|
||||
stableOptions.userDataDir = userDataDir;
|
||||
stableOptions.quality = Quality.Stable;
|
||||
stableOptions.logsPath = logsPath;
|
||||
stableOptions.crashesPath = crashesPath;
|
||||
|
||||
stableApp = new Application(stableOptions);
|
||||
await stableApp.start();
|
||||
|
@ -176,6 +181,7 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
|
|||
const insiderOptions: ApplicationOptions = Object.assign({}, this.defaultOptions);
|
||||
insiderOptions.userDataDir = userDataDir;
|
||||
insiderOptions.logsPath = logsPath;
|
||||
insiderOptions.crashesPath = crashesPath;
|
||||
|
||||
insidersApp = new Application(insiderOptions);
|
||||
await insidersApp.start();
|
||||
|
@ -205,12 +211,14 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
|
|||
|
||||
const userDataDir = getRandomUserDataDir(this.defaultOptions);
|
||||
const logsPath = suiteLogsPath(this.defaultOptions, title);
|
||||
const crashesPath = suiteCrashPath(this.defaultOptions, title);
|
||||
|
||||
const stableOptions: ApplicationOptions = Object.assign({}, this.defaultOptions);
|
||||
stableOptions.codePath = stableCodePath;
|
||||
stableOptions.userDataDir = userDataDir;
|
||||
stableOptions.quality = Quality.Stable;
|
||||
stableOptions.logsPath = logsPath;
|
||||
stableOptions.crashesPath = crashesPath;
|
||||
|
||||
stableApp = new Application(stableOptions);
|
||||
await stableApp.start();
|
||||
|
@ -240,6 +248,7 @@ export function setup(ensureStableCode: () => string | undefined, logger: Logger
|
|||
const insiderOptions: ApplicationOptions = Object.assign({}, this.defaultOptions);
|
||||
insiderOptions.userDataDir = userDataDir;
|
||||
insiderOptions.logsPath = logsPath;
|
||||
insiderOptions.crashesPath = crashesPath;
|
||||
|
||||
insidersApp = new Application(insiderOptions);
|
||||
await insidersApp.start();
|
||||
|
|
|
@ -77,6 +77,21 @@ const logsRootPath = (() => {
|
|||
return path.join(logsParentPath, logsName);
|
||||
})();
|
||||
|
||||
const crashesRootPath = (() => {
|
||||
const crashesParentPath = path.join(rootPath, '.build', 'crashes');
|
||||
|
||||
let crashesName: string;
|
||||
if (opts.web) {
|
||||
crashesName = 'smoke-tests-browser';
|
||||
} else if (opts.remote) {
|
||||
crashesName = 'smoke-tests-remote';
|
||||
} else {
|
||||
crashesName = 'smoke-tests-electron';
|
||||
}
|
||||
|
||||
return path.join(crashesParentPath, crashesName);
|
||||
})();
|
||||
|
||||
const logger = createLogger();
|
||||
|
||||
function createLogger(): Logger {
|
||||
|
@ -342,6 +357,7 @@ before(async function () {
|
|||
extensionsPath,
|
||||
logger,
|
||||
logsPath: path.join(logsRootPath, 'suite_unknown'),
|
||||
crashesPath: path.join(crashesRootPath, 'suite_unknown'),
|
||||
verbose: opts.verbose,
|
||||
remote: opts.remote,
|
||||
web: opts.web,
|
||||
|
|
|
@ -88,18 +88,24 @@ export function installDiagnosticsHandler(logger: Logger, appFn?: () => Applicat
|
|||
}
|
||||
|
||||
let logsCounter = 1;
|
||||
let crashCounter = 1;
|
||||
|
||||
export function suiteLogsPath(options: ApplicationOptions, suiteName: string): string {
|
||||
return join(dirname(options.logsPath), `${logsCounter++}_suite_${suiteName.replace(/[^a-z0-9\-]/ig, '_')}`);
|
||||
}
|
||||
|
||||
export function suiteCrashPath(options: ApplicationOptions, suiteName: string): string {
|
||||
return join(dirname(options.crashesPath), `${crashCounter++}_suite_${suiteName.replace(/[^a-z0-9\-]/ig, '_')}`);
|
||||
}
|
||||
|
||||
function installAppBeforeHandler(optionsTransform?: (opts: ApplicationOptions) => ApplicationOptions) {
|
||||
before(async function () {
|
||||
const suiteName = this.test?.parent?.title ?? 'unknown';
|
||||
|
||||
this.app = createApp({
|
||||
...this.defaultOptions,
|
||||
logsPath: suiteLogsPath(this.defaultOptions, suiteName)
|
||||
logsPath: suiteLogsPath(this.defaultOptions, suiteName),
|
||||
crashesPath: suiteCrashPath(this.defaultOptions, suiteName)
|
||||
}, optionsTransform);
|
||||
await this.app.start();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue