Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in determining _TestArchitecture #5087

Merged
merged 1 commit into from
Feb 21, 2025
Merged

Conversation

Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Feb 20, 2025

@Evangelink Worth backporting? Not sure if it can affect some arm64 scenarios

@@ -340,7 +340,7 @@
<!--
NETCoreSdkRuntimeIdentifier is used by DefaultAppHostRuntimeIdentifier to figure out the architecture, and is defined also for .NET Framework.
-->
<_TestArchitecture Condition="('$(_TestArchitecture)' == '' or '$(_TestArchitecture)' == 'AnyCpu') and '$(NETCoreSdkRuntimeIdentifier)' != ''">$([System.Text.RegularExpressions.Regex]::Replace($(DefaultAppHostRuntimeIdentifier), '.*-', ''))</_TestArchitecture>
<_TestArchitecture Condition="('$(_TestArchitecture)' == '' or '$(_TestArchitecture)' == 'AnyCpu') and '$(NETCoreSdkRuntimeIdentifier)' != ''">$([System.Text.RegularExpressions.Regex]::Replace($(NETCoreSdkRuntimeIdentifier), '.*-', ''))</_TestArchitecture>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a copy from line 339, but when it was copy-pasted, the condition was modified but the actual value is not. The code is meaningless on its current form.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.16%. Comparing base (d141931) to head (de0e688).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5087      +/-   ##
==========================================
+ Coverage   66.11%   66.16%   +0.05%     
==========================================
  Files         605      605              
  Lines       36810    36810              
==========================================
+ Hits        24337    24357      +20     
+ Misses      12473    12453      -20     
Flag Coverage Δ
Debug 66.16% <ø> (+0.05%) ⬆️
integration 66.16% <ø> (+0.05%) ⬆️
production 66.16% <ø> (+0.05%) ⬆️
unit 66.16% <ø> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 5 files with indirect coverage changes

Comment on lines 344 to 345
<!-- If everyting else fails, fallback to x64. -->
<_TestArchitecture Condition="'$(_TestArchitecture)' == '' or '$(_TestArchitecture)' == 'AnyCpu'">x64</_TestArchitecture>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Evangelink This looks suspicious. I don't know how we can reach this "fallback" case. But if we do, I think we should use whatever dotnet we find from PATH and not force a specific architecture.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcoRossignoli do you recall?

Copy link
Member Author

@Youssef1313 Youssef1313 Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#5091 suggests a larger change to how InvokeTestingPlatformTask work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging for now as-is and we can address this concern later if #5091 isn't going to happen soon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it was me who wrote some of the code in test anywhere repo and lot of the comments :) see 330, the _testArchitecture is used for log naming, we don't use it to influence which architecture will run, instead we just try to guess what is the architecture of the exe we run.

So when user builds for arm64 and runs they would see _arm64 in the log names, and not _x64.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall well @nohwnd did this update, @nohwnd do you recall?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just posted above 1 min ago :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't use it to influence which architecture will run

The current implementation does that.

if (dotnetMuxerLocator.TryGetDotnetPathByArchitecture(targetArchitecture, out string? dotnetPath))

It tries to resolve dotnet by the _TestArchitecture defined.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3703 that was introduced here, long time after the comment. So I stand corrected.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Anyways, I think #5091 would be the ultimate path forward

@Youssef1313 Youssef1313 merged commit cd21e24 into main Feb 21, 2025
9 checks passed
@Youssef1313 Youssef1313 deleted the dev/ygerges/fix-typo branch February 21, 2025 07:08
@Youssef1313
Copy link
Member Author

/backport to rel/3.8

Copy link
Contributor

Started backporting to rel/3.8: https://github.com/microsoft/testfx/actions/runs/13499506395

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants