Skip to content

Commit

Permalink
Merge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaadhina committed Feb 7, 2017
1 parent b52a24c commit b24dbe2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 39 deletions.
4 changes: 2 additions & 2 deletions Tasks/VsTest/distributedTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class DistributedTest {
//Modify settings file to enable configurations and data collectors.
var settingsFile = this.dtaTestConfig.settingsFile;
try {
settingsFile = await settingsHelper.updateSettingsFileAsRequired(this.dtaTestConfig.settingsFile, this.dtaTestConfig.runInParallel, this.dtaTestConfig.tiaConfig, false);
settingsFile = await settingsHelper.updateSettingsFileAsRequired(this.dtaTestConfig.settingsFile, this.dtaTestConfig.runInParallel, this.dtaTestConfig.tiaConfig, null, false);
} catch (error) {
tl.warning(tl.loc('ErrorWhileUpdatingSettings'));
tl.debug(error);
Expand Down Expand Up @@ -119,7 +119,7 @@ export class DistributedTest {
//Ignore.
}
}

}
private dtaTestConfig: models.DtaTestConfigurations;
private dtaPid: number;
}
16 changes: 10 additions & 6 deletions Tasks/VsTest/settingsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ const runSettingsTemplate = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"</DataCollectionRunSettings>" +
"</RunSettings>";

export async function updateSettingsFileAsRequired(settingsFile: string, isParallelRun: boolean, tiaConfig: models.TiaConfiguration, videoCollector: boolean) : Promise<string>
{
videoCollector = false;
export async function updateSettingsFileAsRequired(settingsFile: string, isParallelRun: boolean, tiaConfig: models.TiaConfiguration, vsVersion: any, videoCollector: boolean) : Promise<string>
{
var defer=Q.defer<string>();
var result: any;

Expand Down Expand Up @@ -121,7 +120,7 @@ export async function updateSettingsFileAsRequired(settingsFile: string, isParal
}
testImpactCollectorNode = data;
if(tiaConfig.useNewCollector) {
testImpactCollectorNode.DataCollector.$.codebase = getTraceCollectorUri();
testImpactCollectorNode.DataCollector.$.codebase = getTraceCollectorUri(vsVersion);
}
testImpactCollectorNode.DataCollector.Configuration[0].ImpactLevel = getTIALevel(tiaConfig);
if (getTIALevel(tiaConfig) === 'file') {
Expand Down Expand Up @@ -274,8 +273,13 @@ function setupTestSettingsFileForRunConfig(result: any, innerNode: any) : Q.Prom
return defer.promise;
}

function getTraceCollectorUri(): string {
return "file://" + path.join(__dirname, "TestSelector/Microsoft.VisualStudio.TraceCollector.dll");
function getTraceCollectorUri(vsVersion: any): string {
if(vsVersion === 15) {
return "file://" + path.join(__dirname, "TestSelector/Microsoft.VisualStudio.TraceCollector.dll");
}
else {
return "file://" + path.join(__dirname, "TestSelector/14.0/Microsoft.VisualStudio.TraceCollector.dll");
}
}

function getTIALevel(tiaConfig: models.TiaConfiguration) {
Expand Down
32 changes: 1 addition & 31 deletions Tasks/VsTest/vstest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,36 +758,6 @@ function invokeVSTest(testResultsDirectory: string): Q.Promise<number> {
tl.error(e.message);
defer.resolve(1);
return defer.promise;
}
setRunInParallellIfApplicable(vsVersion);
var newSettingsFile = overriddenSettingsFile;
try {
settingsHelper.updateSettingsFileAsRequired(overriddenSettingsFile, vstestConfig.runInParallel, vstestConfig.tiaConfig, false).
then(function(ret) {
newSettingsFile = ret;
if(newSettingsFile != overriddenSettingsFile) {
cleanUp(overriddenSettingsFile);
}
runVStest(testResultsDirectory, newSettingsFile, vsVersion)
.then(function (code) {
defer.resolve(code);
})
.fail(function (code) {
defer.resolve(code);
});

})
} catch (error) {
tl.warning(tl.loc('ErrorWhileUpdatingSettings'));
tl.debug(error);
//Should continue to run without the selected configurations.
runVStest(testResultsDirectory, newSettingsFile, vsVersion)
.then(function (code) {
defer.resolve(code);
})
.fail(function (code) {
defer.resolve(code);
});
}

// We need to use private data collector dll
Expand All @@ -798,7 +768,7 @@ function invokeVSTest(testResultsDirectory: string): Q.Promise<number> {
setRunInParallellIfApplicable(vsVersion);
var newSettingsFile = overriddenSettingsFile;
try {
settingsHelper.updateSettingsFileAsRequired(overriddenSettingsFile, vstestConfig.runInParallel, vstestConfig.tiaConfig, false).
settingsHelper.updateSettingsFileAsRequired(overriddenSettingsFile, vstestConfig.runInParallel, vstestConfig.tiaConfig, vsVersionDetails.version, false).
then(function(ret) {
newSettingsFile = ret;
if(newSettingsFile != overriddenSettingsFile) {
Expand Down

0 comments on commit b24dbe2

Please sign in to comment.