Skip to content

Commit b0663cd

Browse files
authored
Fixing Warning for older version of TestPlat (#19488)
* Fixing Warning for older version of TestPlat * Version Bump * Updating helper function * Updating TaskInputParser Logic * Revert changes in VsTestV2 * Fix package-lock files in VsTestV2 * Fixing _generated Package-lock.json
1 parent 2293a1a commit b0663cd

21 files changed

+171
-156
lines changed

Tasks/VsTestV2/Tests/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/VsTestV2/_buildConfigs/Node20/Tests/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/VsTestV2/_buildConfigs/Node20/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/VsTestV2/helpers.ts

+24-22
Original file line numberDiff line numberDiff line change
@@ -208,34 +208,36 @@ export class Helper {
208208

209209
public static setProfilerVariables(envVars: { [key: string]: string; }) : { [key: string]: string; } {
210210
const vsTestPackageLocation = tl.getVariable(constants.VsTestToolsInstaller.PathToVsTestToolVariable);
211+
var splitString = vsTestPackageLocation.split('\\');
212+
var tpVer = parseInt(splitString[splitString.length - 2].split(".")[0],10);
213+
var profilerProxyLocation;
211214

212-
// get path to Microsoft.IntelliTrace.ProfilerProxy.dll (amd64)
213-
let amd64ProfilerProxy = tl.findMatch(vsTestPackageLocation, '**\\amd64\\Microsoft.IntelliTrace.ProfilerProxy.dll');
214-
if (amd64ProfilerProxy && amd64ProfilerProxy.length !== 0) {
215+
tl.debug("TestPlatform Version Detected :" + tpVer);
215216

216-
envVars.COR_PROFILER_PATH_64 = amd64ProfilerProxy[0];
217-
} else {
218-
// Look in x64 also for Microsoft.IntelliTrace.ProfilerProxy.dll (x64)
219-
amd64ProfilerProxy = tl.findMatch(vsTestPackageLocation, '**\\x64\\Microsoft.IntelliTrace.ProfilerProxy.dll');
220-
if (amd64ProfilerProxy && amd64ProfilerProxy.length !== 0) {
221-
222-
envVars.COR_PROFILER_PATH_64 = amd64ProfilerProxy[0];
217+
if(tpVer < 17){
218+
profilerProxyLocation = tl.findMatch(vsTestPackageLocation, '**\\amd64\\Microsoft.IntelliTrace.ProfilerProxy.dll');
219+
if (profilerProxyLocation && profilerProxyLocation.length !== 0) {
220+
envVars.COR_PROFILER_PATH_64 = profilerProxyLocation[0];
223221
} else {
224-
Helper.publishEventToCi(constants.AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1043, false);
225-
tl.warning(tl.loc('testImpactAndCCWontWork'));
222+
profilerProxyLocation = tl.findMatch(vsTestPackageLocation, '**\\x64\\Microsoft.IntelliTrace.ProfilerProxy.dll');
223+
if (profilerProxyLocation && profilerProxyLocation.length !== 0) {
224+
envVars.COR_PROFILER_PATH_64 = profilerProxyLocation[0];
225+
}
226+
else{
227+
Helper.publishEventToCi(constants.AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
228+
tl.warning(tl.loc('testImpactAndCCWontWork'));
229+
}
226230
}
227231

228-
Helper.publishEventToCi(constants.AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
229-
tl.warning(tl.loc('testImpactAndCCWontWork'));
230-
}
232+
profilerProxyLocation = tl.findMatch(vsTestPackageLocation, '**\\x86\\Microsoft.IntelliTrace.ProfilerProxy.dll');
231233

232-
// get path to Microsoft.IntelliTrace.ProfilerProxy.dll (x86)
233-
const x86ProfilerProxy = tl.findMatch(vsTestPackageLocation, '**\\x86\\Microsoft.IntelliTrace.ProfilerProxy.dll');
234-
if (x86ProfilerProxy && x86ProfilerProxy.length !== 0) {
235-
envVars.COR_PROFILER_PATH_32 = x86ProfilerProxy[0];
236-
} else {
237-
Helper.publishEventToCi(constants.AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1044, false);
238-
tl.warning(tl.loc('testImpactAndCCWontWork'));
234+
if(profilerProxyLocation && profilerProxyLocation.length !== 0){
235+
envVars.COR_PROFILER_PATH_32 = profilerProxyLocation[0];
236+
}
237+
else{
238+
Helper.publishEventToCi(constants.AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
239+
tl.warning(tl.loc('testImpactAndCCWontWork'));
240+
}
239241
}
240242

241243
return envVars;

Tasks/VsTestV2/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tasks/VsTestV2/task.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 2,
20-
"Minor": 234,
20+
"Minor": 235,
2121
"Patch": 0
2222
},
2323
"demands": [

Tasks/VsTestV2/task.loc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 2,
20-
"Minor": 234,
20+
"Minor": 235,
2121
"Patch": 0
2222
},
2323
"demands": [

Tasks/VsTestV2/taskinputparser.ts

+25-22
Original file line numberDiff line numberDiff line change
@@ -389,31 +389,34 @@ function getToolsInstallerConfiguration(): models.ToolsInstallerConfiguration {
389389
throw new Error(tl.loc('toolsInstallerPathNotSet'));
390390
}
391391

392-
// get path to Microsoft.IntelliTrace.ProfilerProxy.dll (amd64)
393-
var amd64ProfilerProxy = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\amd64\\Microsoft.IntelliTrace.ProfilerProxy.dll");
394-
if (amd64ProfilerProxy && amd64ProfilerProxy.length !== 0) {
395-
toolsInstallerConfiguration.x64ProfilerProxyDLLLocation = amd64ProfilerProxy[0];
396-
} else {
397-
// Look in x64 also for Microsoft.IntelliTrace.ProfilerProxy.dll (x64)
398-
amd64ProfilerProxy = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\x64\\Microsoft.IntelliTrace.ProfilerProxy.dll");
399-
if (amd64ProfilerProxy && amd64ProfilerProxy.length !== 0) {
400-
toolsInstallerConfiguration.x64ProfilerProxyDLLLocation = amd64ProfilerProxy[0];
392+
var splitString = toolsInstallerConfiguration.vsTestConsolePathFromPackageLocation.split('\\');
393+
var tpVer = parseInt(splitString[splitString.length - 2].split(".")[0],10);
394+
var profilerProxyLocation;
395+
396+
tl.debug("TestPlatform Version Detected :" + tpVer);
397+
398+
if(tpVer < 17){
399+
profilerProxyLocation = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\amd64\\Microsoft.IntelliTrace.ProfilerProxy.dll");
400+
if (profilerProxyLocation && profilerProxyLocation.length !== 0) {
401+
toolsInstallerConfiguration.x64ProfilerProxyDLLLocation = profilerProxyLocation[0];
401402
} else {
402-
utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1043, false);
403+
profilerProxyLocation = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\x64\\Microsoft.IntelliTrace.ProfilerProxy.dll");
404+
if (profilerProxyLocation && profilerProxyLocation.length !== 0) {
405+
toolsInstallerConfiguration.x64ProfilerProxyDLLLocation = profilerProxyLocation[0];
406+
}
407+
else{
408+
utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
409+
tl.warning(tl.loc('testImpactAndCCWontWork'));
410+
}
411+
}
412+
profilerProxyLocation = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\x86\\Microsoft.IntelliTrace.ProfilerProxy.dll");
413+
if(profilerProxyLocation && profilerProxyLocation.length !== 0){
414+
toolsInstallerConfiguration.x86ProfilerProxyDLLLocation = profilerProxyLocation[0];
415+
}
416+
else{
417+
utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1044, false);
403418
tl.warning(tl.loc('testImpactAndCCWontWork'));
404419
}
405-
406-
utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
407-
tl.warning(tl.loc('testImpactAndCCWontWork'));
408-
}
409-
410-
// get path to Microsoft.IntelliTrace.ProfilerProxy.dll (x86)
411-
var x86ProfilerProxy = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\x86\\Microsoft.IntelliTrace.ProfilerProxy.dll");
412-
if (x86ProfilerProxy && x86ProfilerProxy.length !== 0) {
413-
toolsInstallerConfiguration.x86ProfilerProxyDLLLocation = x86ProfilerProxy[0];
414-
} else {
415-
utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1044, false);
416-
tl.warning(tl.loc('testImpactAndCCWontWork'));
417420
}
418421

419422
return toolsInstallerConfiguration;

_generated/VsTestV2.versionmap.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Default|2.234.0
2-
Node20_229_4|2.234.1
1+
Default|2.235.0
2+
Node20_229_4|2.235.1

_generated/VsTestV2/Tests/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_generated/VsTestV2/helpers.ts

+24-22
Original file line numberDiff line numberDiff line change
@@ -208,34 +208,36 @@ export class Helper {
208208

209209
public static setProfilerVariables(envVars: { [key: string]: string; }) : { [key: string]: string; } {
210210
const vsTestPackageLocation = tl.getVariable(constants.VsTestToolsInstaller.PathToVsTestToolVariable);
211+
var splitString = vsTestPackageLocation.split('\\');
212+
var tpVer = parseInt(splitString[splitString.length - 2].split(".")[0],10);
213+
var profilerProxyLocation;
211214

212-
// get path to Microsoft.IntelliTrace.ProfilerProxy.dll (amd64)
213-
let amd64ProfilerProxy = tl.findMatch(vsTestPackageLocation, '**\\amd64\\Microsoft.IntelliTrace.ProfilerProxy.dll');
214-
if (amd64ProfilerProxy && amd64ProfilerProxy.length !== 0) {
215+
tl.debug("TestPlatform Version Detected :" + tpVer);
215216

216-
envVars.COR_PROFILER_PATH_64 = amd64ProfilerProxy[0];
217-
} else {
218-
// Look in x64 also for Microsoft.IntelliTrace.ProfilerProxy.dll (x64)
219-
amd64ProfilerProxy = tl.findMatch(vsTestPackageLocation, '**\\x64\\Microsoft.IntelliTrace.ProfilerProxy.dll');
220-
if (amd64ProfilerProxy && amd64ProfilerProxy.length !== 0) {
221-
222-
envVars.COR_PROFILER_PATH_64 = amd64ProfilerProxy[0];
217+
if(tpVer < 17){
218+
profilerProxyLocation = tl.findMatch(vsTestPackageLocation, '**\\amd64\\Microsoft.IntelliTrace.ProfilerProxy.dll');
219+
if (profilerProxyLocation && profilerProxyLocation.length !== 0) {
220+
envVars.COR_PROFILER_PATH_64 = profilerProxyLocation[0];
223221
} else {
224-
Helper.publishEventToCi(constants.AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1043, false);
225-
tl.warning(tl.loc('testImpactAndCCWontWork'));
222+
profilerProxyLocation = tl.findMatch(vsTestPackageLocation, '**\\x64\\Microsoft.IntelliTrace.ProfilerProxy.dll');
223+
if (profilerProxyLocation && profilerProxyLocation.length !== 0) {
224+
envVars.COR_PROFILER_PATH_64 = profilerProxyLocation[0];
225+
}
226+
else{
227+
Helper.publishEventToCi(constants.AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
228+
tl.warning(tl.loc('testImpactAndCCWontWork'));
229+
}
226230
}
227231

228-
Helper.publishEventToCi(constants.AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
229-
tl.warning(tl.loc('testImpactAndCCWontWork'));
230-
}
232+
profilerProxyLocation = tl.findMatch(vsTestPackageLocation, '**\\x86\\Microsoft.IntelliTrace.ProfilerProxy.dll');
231233

232-
// get path to Microsoft.IntelliTrace.ProfilerProxy.dll (x86)
233-
const x86ProfilerProxy = tl.findMatch(vsTestPackageLocation, '**\\x86\\Microsoft.IntelliTrace.ProfilerProxy.dll');
234-
if (x86ProfilerProxy && x86ProfilerProxy.length !== 0) {
235-
envVars.COR_PROFILER_PATH_32 = x86ProfilerProxy[0];
236-
} else {
237-
Helper.publishEventToCi(constants.AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1044, false);
238-
tl.warning(tl.loc('testImpactAndCCWontWork'));
234+
if(profilerProxyLocation && profilerProxyLocation.length !== 0){
235+
envVars.COR_PROFILER_PATH_32 = profilerProxyLocation[0];
236+
}
237+
else{
238+
Helper.publishEventToCi(constants.AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
239+
tl.warning(tl.loc('testImpactAndCCWontWork'));
240+
}
239241
}
240242

241243
return envVars;

_generated/VsTestV2/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_generated/VsTestV2/task.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 2,
20-
"Minor": 234,
20+
"Minor": 235,
2121
"Patch": 0
2222
},
2323
"demands": [
@@ -658,7 +658,7 @@
658658
"minimumExpectedTests": "Minimum tests expected to be run: %d"
659659
},
660660
"_buildConfigMapping": {
661-
"Default": "2.234.0",
662-
"Node20_229_4": "2.234.1"
661+
"Default": "2.235.0",
662+
"Node20_229_4": "2.235.1"
663663
}
664664
}

_generated/VsTestV2/task.loc.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 2,
20-
"Minor": 234,
20+
"Minor": 235,
2121
"Patch": 0
2222
},
2323
"demands": [
@@ -658,7 +658,7 @@
658658
"minimumExpectedTests": "ms-resource:loc.messages.minimumExpectedTests"
659659
},
660660
"_buildConfigMapping": {
661-
"Default": "2.234.0",
662-
"Node20_229_4": "2.234.1"
661+
"Default": "2.235.0",
662+
"Node20_229_4": "2.235.1"
663663
}
664664
}

_generated/VsTestV2/taskinputparser.ts

+25-22
Original file line numberDiff line numberDiff line change
@@ -389,31 +389,34 @@ function getToolsInstallerConfiguration(): models.ToolsInstallerConfiguration {
389389
throw new Error(tl.loc('toolsInstallerPathNotSet'));
390390
}
391391

392-
// get path to Microsoft.IntelliTrace.ProfilerProxy.dll (amd64)
393-
var amd64ProfilerProxy = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\amd64\\Microsoft.IntelliTrace.ProfilerProxy.dll");
394-
if (amd64ProfilerProxy && amd64ProfilerProxy.length !== 0) {
395-
toolsInstallerConfiguration.x64ProfilerProxyDLLLocation = amd64ProfilerProxy[0];
396-
} else {
397-
// Look in x64 also for Microsoft.IntelliTrace.ProfilerProxy.dll (x64)
398-
amd64ProfilerProxy = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\x64\\Microsoft.IntelliTrace.ProfilerProxy.dll");
399-
if (amd64ProfilerProxy && amd64ProfilerProxy.length !== 0) {
400-
toolsInstallerConfiguration.x64ProfilerProxyDLLLocation = amd64ProfilerProxy[0];
392+
var splitString = toolsInstallerConfiguration.vsTestConsolePathFromPackageLocation.split('\\');
393+
var tpVer = parseInt(splitString[splitString.length - 2].split(".")[0],10);
394+
var profilerProxyLocation;
395+
396+
tl.debug("TestPlatform Version Detected :" + tpVer);
397+
398+
if(tpVer < 17){
399+
profilerProxyLocation = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\amd64\\Microsoft.IntelliTrace.ProfilerProxy.dll");
400+
if (profilerProxyLocation && profilerProxyLocation.length !== 0) {
401+
toolsInstallerConfiguration.x64ProfilerProxyDLLLocation = profilerProxyLocation[0];
401402
} else {
402-
utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1043, false);
403+
profilerProxyLocation = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\x64\\Microsoft.IntelliTrace.ProfilerProxy.dll");
404+
if (profilerProxyLocation && profilerProxyLocation.length !== 0) {
405+
toolsInstallerConfiguration.x64ProfilerProxyDLLLocation = profilerProxyLocation[0];
406+
}
407+
else{
408+
utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
409+
tl.warning(tl.loc('testImpactAndCCWontWork'));
410+
}
411+
}
412+
profilerProxyLocation = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\x86\\Microsoft.IntelliTrace.ProfilerProxy.dll");
413+
if(profilerProxyLocation && profilerProxyLocation.length !== 0){
414+
toolsInstallerConfiguration.x86ProfilerProxyDLLLocation = profilerProxyLocation[0];
415+
}
416+
else{
417+
utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1044, false);
403418
tl.warning(tl.loc('testImpactAndCCWontWork'));
404419
}
405-
406-
utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1042, false);
407-
tl.warning(tl.loc('testImpactAndCCWontWork'));
408-
}
409-
410-
// get path to Microsoft.IntelliTrace.ProfilerProxy.dll (x86)
411-
var x86ProfilerProxy = tl.findMatch(toolsInstallerConfiguration.vsTestPackageLocation, "**\\x86\\Microsoft.IntelliTrace.ProfilerProxy.dll");
412-
if (x86ProfilerProxy && x86ProfilerProxy.length !== 0) {
413-
toolsInstallerConfiguration.x86ProfilerProxyDLLLocation = x86ProfilerProxy[0];
414-
} else {
415-
utils.Helper.publishEventToCi(AreaCodes.TOOLSINSTALLERCACHENOTFOUND, tl.loc('testImpactAndCCWontWork'), 1044, false);
416-
tl.warning(tl.loc('testImpactAndCCWontWork'));
417420
}
418421

419422
return toolsInstallerConfiguration;

_generated/VsTestV2_Node20/Tests/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)