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

Run unit tests as part of the build (and CI) #789

Merged
merged 12 commits into from
Oct 15, 2019

Conversation

krwq
Copy link
Member

@krwq krwq commented Oct 11, 2019

Noticed that unit tests don't get run as part of the CI (only System.Device.Gpio.Tests do).

Marked as draft until I finish testing

.vsts-ci.yml Outdated
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
HelixAccessToken: $(HelixApiAccessToken)
- script: ./eng/common/msbuild.sh --warnaserror false --ci
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need to add another step, Ideally we would run both with just the one call.

Copy link
Member Author

Choose a reason for hiding this comment

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

You can't unless we run it on PIs as well since there is no way specify which project runs on which queue. If I create a target which call sendToHelix twice then I hit this issue: dotnet/arcade#4107

Other thing is that it makes sense to first run unit tests before running any hardware tests so that should be fine

@joperezr
Copy link
Member

How many device binding unit test projects do we have? If there aren't many, it is probably easier for now to just run these tests as part of the build. That way you won't really have to deal with Helix or build infrastructure, and you will get coverage in Windows, Linux, and OSX. Because they are unit tests, they shouldn't need to run on any specific hardware.

@krwq
Copy link
Member Author

krwq commented Oct 11, 2019

@joperezr we have 6 unit tests projects not including System.Device.Gpio (and one coming in the PR). I don't mind either way but not sure how to do what you just said with targets (unless you meant to run dotnet test from the shell scripts)

@krwq
Copy link
Member Author

krwq commented Oct 12, 2019

seems something got stuck in helix. The tests took less than 30s on my box

@krwq
Copy link
Member Author

krwq commented Oct 12, 2019

@joperezr @safern let me know if you have any clues why is helix job getting stuck or how do you check what went wrong seems this was temporary

.vsts-ci.yml Outdated Show resolved Hide resolved
@MarkCiliaVincenti
Copy link
Contributor

What's wrong with GitHub? My checks are also failing with strange Azure DevOps problems.

@krwq
Copy link
Member Author

krwq commented Oct 14, 2019

@MarkCiliaVincenti not sure, haven't seen any e-mails internally yet

@krwq krwq force-pushed the run-unit-tests-as-part-of-ci branch from 48d4791 to 8b4465c Compare October 14, 2019 17:26
@krwq
Copy link
Member Author

krwq commented Oct 14, 2019

Rebased to restart CI since it was showing green when clicking on link but red on github

@MarkCiliaVincenti
Copy link
Contributor

MarkCiliaVincenti commented Oct 14, 2019

Rebased to restart CI since it was showing green when clicking on link but red on github

Is it still WIP? I'm depending on this for #783, while #797 depends on #783.

@joperezr
Copy link
Member

@MarkCiliaVincenti not sure, haven't seen any e-mails internally yet

There is an internal thread about problems with Azure Devops that we are seeing, this is very likely the cause to issues you were seeing.

@krwq krwq changed the title Run unit tests as part of CI and official runs Run unit tests as part of the build (and CI) Oct 14, 2019
build.proj Outdated
<Target Name="Test">
<MSBuild Projects="@(UnitTestProjects)" Targets="VSTest"
ContinueOnError="ErrorAndContinue"
Properties="Verbosity=normal" />
Copy link
Member

Choose a reason for hiding this comment

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

Let's just check to see if this is the best way to print out failures from running the tests. In general we try to avoid passing down global properties as they leak down into the the projects and mess up incremental build. cc: @ericstj

Copy link
Member

Choose a reason for hiding this comment

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

Also if you're running tests as part of the build, you want to publish the xunit results in the yaml file as part of the build in CI so that test results show in the test explorer: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-test-results?view=azure-devops&tabs=yaml#yaml-snippet

@krwq
Copy link
Member Author

krwq commented Oct 14, 2019

Ok lack of output seems to be VSTest issue: microsoft/vstest#2224 I'll remove the hack and let's wait until they fix it

@krwq krwq marked this pull request as ready for review October 14, 2019 23:54
Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

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

LGTM. Only open question would be if we should keep the unit tests running by default, but I'm fine to keeping them doing so for now. If we start seeing this is a problem, we can turn them off on default build.cmd. Thanks for fixing this @krwq

@krwq krwq merged commit 62dd695 into dotnet:master Oct 15, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants