Skip to content

Commit

Permalink
master: GoogleTest fix and gutter change
Browse files Browse the repository at this point in the history
  • Loading branch information
Mate Pek committed Jan 9, 2022
1 parent b173fe5 commit 4cbc5ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
14 changes: 8 additions & 6 deletions src/AbstractExecutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AbstractTest } from './AbstractTest';
import { TaskPool } from './util/TaskPool';
import { ExecutableRunResultValue, RunningExecutable } from './RunningExecutable';
import { promisify } from 'util';
import { Version, getAbsolutePath, CancellationToken, reindentStr } from './Util';
import { Version, getAbsolutePath, CancellationToken, reindentStr, parseLine } from './Util';
import {
resolveOSEnvironmentVariables,
createPythonIndexerForPathVariable,
Expand Down Expand Up @@ -186,6 +186,8 @@ export abstract class AbstractExecutable<TestT extends AbstractTest = AbstractTe

tags.sort();

const aboveLineInFile = parseLine(lineInFile, undefined, -1);

const tagsResolveRule: ResolveRuleAsync<string> = {
resolve: AbstractExecutable._tagVar,
rule: '', // will be filled soon enough
Expand Down Expand Up @@ -250,7 +252,7 @@ export abstract class AbstractExecutable<TestT extends AbstractTest = AbstractTe
description,
varsToResolve,
resolvedFile,
lineInFile,
aboveLineInFile,
);
} else if (g.groupUngroupedTo) {
itemOfLevel = await this._resolveAndGetOrCreateChildGroup(
Expand Down Expand Up @@ -284,7 +286,7 @@ export abstract class AbstractExecutable<TestT extends AbstractTest = AbstractTe
description,
varsToResolve,
resolvedFile,
lineInFile,
aboveLineInFile,
);

// special item handling for exec
Expand All @@ -305,7 +307,7 @@ export abstract class AbstractExecutable<TestT extends AbstractTest = AbstractTe
description,
varsToResolve,
resolvedFile,
lineInFile,
aboveLineInFile,
);
} else if (g.groupUngroupedTo) {
itemOfLevel = await this._resolveAndGetOrCreateChildGroup(
Expand Down Expand Up @@ -334,7 +336,7 @@ export abstract class AbstractExecutable<TestT extends AbstractTest = AbstractTe
g.description,
varsToResolve,
resolvedFile,
lineInFile,
aboveLineInFile,
);
} else if (g.groupUngroupedTo) {
itemOfLevel = await this._resolveAndGetOrCreateChildGroup(
Expand All @@ -358,7 +360,7 @@ export abstract class AbstractExecutable<TestT extends AbstractTest = AbstractTe
g.description,
varsToResolve,
resolvedFile,
lineInFile,
aboveLineInFile,
);
} else if (g.groupUngroupedTo) {
itemOfLevel = await this._resolveAndGetOrCreateChildGroup(
Expand Down
32 changes: 8 additions & 24 deletions src/framework/GoogleTestExecutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SharedVarOfExec } from '../SharedVarOfExec';
import { RunningExecutable } from '../RunningExecutable';
import { AbstractTest } from '../AbstractTest';
import { CancellationToken } from '../Util';
import { TestGroupingConfig, testGroupIterator } from '../TestGroupingInterface';
import { TestGroupingConfig } from '../TestGroupingInterface';
import { TestResultBuilder } from '../TestResultBuilder';
import { XmlParser, XmlTag, XmlTagProcessor } from '../util/XmlParser';
import { LineProcessor, TextStreamParser } from '../util/TextStreamParser';
Expand Down Expand Up @@ -174,30 +174,14 @@ export class GoogleTestExecutable extends AbstractExecutable<GoogleTestTest> {
}
};

// for gtest the source file is only available in the xml output file
let canLoadOutput = true;
for (const [groupingType] of testGroupIterator(this.getTestGrouping())) {
if (groupingType === 'groupBySource') {
canLoadOutput = false;
break;
}
}

try {
if (canLoadOutput) {
await this._reloadFromString(googleTestListProcess.stdout, googleTestListProcess.stderr, cancellationToken);
await loadFromFileIfHas();
} else {
const closedP = new Promise(r => googleTestListProcess.once('close', r));
const [stdout, stderr] = await pipeOutputStreams2String(
googleTestListProcess.stdout,
googleTestListProcess.stderr,
);
await closedP;
const loadedFromFile = await loadFromFileIfHas();
if (!loadedFromFile) {
await this._reloadFromString(stdout, stderr, cancellationToken);
}
const [stdout, stderr] = await pipeOutputStreams2String(
googleTestListProcess.stdout,
googleTestListProcess.stderr,
);
const loadedFromFile = await loadFromFileIfHas();
if (!loadedFromFile) {
await this._reloadFromString(stdout, stderr, cancellationToken);
}
} catch (e) {
this.shared.log.warn('reloadChildren error:', e);
Expand Down

0 comments on commit 4cbc5ac

Please sign in to comment.