Skip to content

Commit

Permalink
smoke: save logs as artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Jun 5, 2018
1 parent 6a586e3 commit 29a8be3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/smoke/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export class Application {
extensionsPath: this.options.extensionsPath,
logger: this.options.logger,
verbose: this.options.verbose,
log: this.options.log,
extraArgs,
});

Expand Down
14 changes: 13 additions & 1 deletion test/smoke/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as minimist from 'minimist';
import * as tmp from 'tmp';
import * as rimraf from 'rimraf';
import * as mkdirp from 'mkdirp';
import { ncp } from 'ncp';
import { Application, Quality } from './application';

import { setup as setupDataMigrationTests } from './areas/workbench/data-migration.test';
Expand Down Expand Up @@ -210,8 +211,11 @@ function createApp(quality: Quality): Application {
loggers.push(new ConsoleLogger());
}

let log: string | undefined = undefined;

if (opts.log) {
loggers.push(new FileLogger(opts.log));
log = 'verbose';
}

return new Application({
Expand All @@ -223,7 +227,8 @@ function createApp(quality: Quality): Application {
workspaceFilePath,
waitTime: parseInt(opts['wait-time'] || '0') || 20,
logger: new MultiLogger(loggers),
verbose: opts.verbose
verbose: opts.verbose,
log
});
}

Expand All @@ -235,6 +240,13 @@ before(async function () {

after(async function () {
await new Promise(c => setTimeout(c, 500)); // wait for shutdown

if (opts.log) {
const logsDir = path.join(userDataDir, 'logs');
const destLogsDir = path.join(path.dirname(opts.log), 'logs');
await new Promise((c, e) => ncp(logsDir, destLogsDir, err => err ? e(err) : c()));
}

await new Promise((c, e) => rimraf(testDataPath, { maxBusyTries: 10 }, err => err ? e(err) : c()));
});

Expand Down
5 changes: 5 additions & 0 deletions test/smoke/src/vscode/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export interface SpawnOptions {
logger: Logger;
verbose?: boolean;
extraArgs?: string[];
log?: string;
}

async function createDriverHandle(): Promise<string> {
Expand Down Expand Up @@ -127,6 +128,10 @@ export async function spawn(options: SpawnOptions): Promise<Code> {
args.push('--driver-verbose');
}

if (options.log) {
args.push('--log', options.log);
}

if (options.extraArgs) {
args.push(...options.extraArgs);
}
Expand Down

0 comments on commit 29a8be3

Please sign in to comment.