-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Run test on Linux and Mac #45642
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
Run test on Linux and Mac #45642
Conversation
Thanks for your PR, @Youssef1313. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@captainsafia I found an interesting thing here. The clone of the repository happens on Windows, so test files are checked out with CRLF line endings. Then, tests are run in Windows, Linux, and macOS against the repo that was cloned on Windows with CRLF: Should the repo be renormalized when sent for each OS? I still think Roslyn could be better here and detect the existing line endings, but still maybe something in CI here could be improved. |
@Youssef1313 Thanks for looking into this?
@dougbu @wtgodbe Do you know if it is possible to configure git to target new lines to each target machine? How do we handle tests that are sensitive to OS-specific line endings elsewhere (assuming those exist)?
Agree with this! I don't see any reason for Roslyn testing to be this sensitive when it comes to comparing line-endings, especially because AFAIK things like generators/analyzers aren't meant to be environment-specific. Is there an issue tracking this on the Roslyn side? |
Testing library intentionally compares line endings to catch bugs. By my comment, I meant that I was expecting Roslyn itself to do best effort guessing line ending instead of using |
I think this is already done in If the repo is cloned on Ubuntu, then it's LF. If it's cloned on Windows, then it's CRLF. (which is the correct behavior) What happens though is the repo being cloned on Windows, and then (as far as I understand) sent to other machines using I'm not sure if this is something to improve on dotnet/arcade? |
For tests like these that are dependent on OS line-ending, I think they aren't suited for Helix. I suggest skipping them on helix so that they run in the on-machine build jobs. You can do so like the following:
In this case you'd skip it on all queues:
|
There are couple of solutions to resolve this without skipping the test.
Not sure which approach you'd prefer. Currently I'm testing with the first one being applied specifically to the single problematic test. |
How do you go about configuring the editorconfig? Will it be done in a way that conflicts with the repo-level one or does the configuration happen in source?
I'm fine with doing this as part of the verifier. |
In source, via The current approach should be passing, but let me know if you prefer a different approach. |
It seems like both approaches, when done properly, can be achieved by modifying the base Verifier class. I have a slight preference towards the editorconfig option since it seems clearer to document. |
Done in last commit. Let's see if it will pass. |
I wasn't expecting that. This failure happens on Linux. Trying a different approach now to set the option directly in OptionSet |
Still doesn't work. I'll revert back to the initial approach 😕 . |
What is different about this one test❔ Numerous tests use I guess the question might be "Is this really the only test that adds new newlines when fixing C#❔" or perhaps "Does the analyzer here have a bug❔" |
@dougbu I think not so many tests out there are adding new usings/lines so that's why it wasn't caught. The analyzer/codefix don't have bugs. The codefix is just adding an AddImportsAnnotation. Nothing more. |
To be clear, my suggestion ( |
Thanks for the clarification! @captainsafia would you like me to try this? |
Given we want to get rid of every test job except the Helix one, I'm a fan of the current approach. As long as the test area owners agree, let's do it this way. |
Is that tracked somewhere? |
I recall that @HaoK closed the overall issue for moving everything to Helix because we had individual issues for each area that seemed stuck on build agents. See #10424, #18799, #27609, #38818, and #39420 for example. More generally, testing on build agents is a waste of resources and not where we want to be. So, let's not make the problem worse (even if most of the above issues have been considered low priority lately). |
The editorconfig strategy didn't work, but does the I also think addressing the issue well be prudent since we have more analyzers/codefixers coming down the pipe. |
I prefer moving this workaround to |
Fair enough, in that case can you document what the workaround is for in case we run into it in future tests? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming we add a code comment clarifying what this is for
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@captainsafia Can you restart the source-build job please? |
There are some issues with source build that are pending a fix that are causing this failure. Rekicking the build is not likely to do anything. @dotnet/aspnet-build How are we handling things in the meantime? Are we able to force-merge? |
The failure is due to the build agents, not anything in this repo: dotnet/source-build#3111. Some agents are new enough that they won't fail, some are not - in general you can ping me or doug to force-merge, or just re-run the source build job until it works (it's short). I'll force merge this one. |
This used to fail. I wanted to confirm if this is still an issue.