Skip to content

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

Merged
krwq merged 12 commits into
dotnet:masterfrom
krwq:run-unit-tests-as-part-of-ci
Oct 15, 2019
Merged

krwq merged 12 commits into
dotnet:masterfrom
krwq:run-unit-tests-as-part-of-ci

Conversation

@krwq

@krwq krwq commented Oct 11, 2019

Copy link
Copy Markdown
Member

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

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

krwq commented Oct 11, 2019 •

Copy link
Copy Markdown
Member Author

@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

krwq commented Oct 12, 2019

Copy link
Copy Markdown
Member Author

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

@krwq

krwq commented Oct 12, 2019 •

Copy link
Copy Markdown
Member Author

@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

Comment thread .vsts-ci.yml Resolved
@MarkCiliaVincenti

Copy link
Copy Markdown
Contributor

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

@krwq

krwq commented Oct 14, 2019

Copy link
Copy Markdown
Member Author

@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

krwq commented Oct 14, 2019

Copy link
Copy Markdown
Member Author

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

@MarkCiliaVincenti

MarkCiliaVincenti commented Oct 14, 2019 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Comment thread build.proj Outdated
<Target Name="Test">
<MSBuild Projects="@(UnitTestProjects)" Targets="VSTest"
ContinueOnError="ErrorAndContinue"
Properties="Verbosity=normal" />

Copy link
Copy Markdown
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
Copy Markdown
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

krwq commented Oct 14, 2019

Copy link
Copy Markdown
Member Author

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

@joperezr joperezr left a comment

Copy link
Copy Markdown
Member

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