Skip to content

Conversation

@chunqingchen
Copy link
Contributor

@chunqingchen chunqingchen commented Sep 8, 2017

Fixes #852 #851
This is to enable xunit test on all platforms.

This fix includes following change:

  • Change test framework from visualstudio xunit to Dotnet Xunit, now the tests can be run on multiple platforms
  • Modify any tests that will fail the test build.
  • Added a function Test-XUnitTestResults for analyze PSxUnit output.
  • Added fx-version workaround for dotnet xunit
  • Updated appveyor.ps1 to run Start-PsXunit for daily builds.
  • Updated travis.ps1 to run Start-PsXunit for daily builds.

build.psm1 Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably stay before any calls made to dotnet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

Copy link
Collaborator

@JamesWTruher JamesWTruher left a comment

Choose a reason for hiding this comment

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

a couple of the tests aren't testing the thing they purport to test, so they should be fixed or removed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't seem to be checking the method on the PSTypeExtensions object. Shouldn't this be something like:
Assert.False(PSTypeExtensions.IsNumeric("string".GetType())
It should actually test the PSTypeExtensions object or just removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved.

Copy link
Collaborator

Choose a reason for hiding this comment

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

see my comment below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

Copy link
Collaborator

Choose a reason for hiding this comment

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

this isn't very useful and no longer tests what it is reported to test. This needs to check to see that the username returned by whoami is the same as Platform.Unix.UserName. Also, this is a non-windows only test. Is there a way to notate that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

@TravisEz13
Copy link
Member

@JamesWTruher Can you update your review?

build.psm1 Outdated
Copy link
Member

Choose a reason for hiding this comment

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

How is a failure in xUnit propagated to a failure in AppVeyor / Travis?

Copy link
Collaborator

@JamesWTruher JamesWTruher left a comment

Choose a reason for hiding this comment

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

if everything actually runs on MacOS/Linux ok then I feel it would be better to get it in sooner rather than later. However, Aditya's question needs to be answered, how do we incorporate these results into our pester results?

Copy link
Collaborator

Choose a reason for hiding this comment

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

i believe that this is still not good for MacOS. hostname --fqdn is an error. Will this run on Mac?

@adityapatwardhan
Copy link
Member

@chunqingchen This needs to be open. I am working on it.

@adityapatwardhan
Copy link
Member

@JamesWTruher @daxian-dbw I have updated the PR with multiple changes list in the PR description. All tests pass in CI and the log file is uploaded to artifacts on AppVeyor. Please have look.

build.psm1 Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should probably be throw or something - if $results has a problem then it might look like everything passed since the error will likely be hidden in the log

Copy link
Member

Choose a reason for hiding this comment

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

added throw instead of Write-Error

build.psm1 Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

can this be simplified to just:
if ( -not (test-path (get-psoutput)))

Copy link
Member

Choose a reason for hiding this comment

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

We use $Content later. So I will keep it as is.

Copy link
Collaborator

Choose a reason for hiding this comment

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

does this need a Skip.IfNot(Platform.IsWindows)?

Copy link
Member

Choose a reason for hiding this comment

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

Added

Copy link
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

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

Leave some comments

build.psm1 Outdated
Copy link
Member

Choose a reason for hiding this comment

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

maybe the single quote is not needed ...

Copy link
Member

Choose a reason for hiding this comment

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

Fixed.

build.psm1 Outdated
Copy link
Member

Choose a reason for hiding this comment

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

maybe move this line closer to its uses.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe not needed as it's already included in Tests.Common.props.

Copy link
Member

Choose a reason for hiding this comment

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

It's not just Linux now.

Copy link
Member

Choose a reason for hiding this comment

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

Please add a comment here

Copy link
Member

Choose a reason for hiding this comment

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

it will write a true or false in console, should be suppressed.

tools/travis.ps1 Outdated
Copy link
Member

Choose a reason for hiding this comment

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

nit: the ending quote is not needed.

@adityapatwardhan
Copy link
Member

@daxian-dbw All comments have been addressed and all tests have passed.

@adityapatwardhan
Copy link
Member

@daxian-dbw is this ready to merge?

@adityapatwardhan adityapatwardhan merged commit 52df947 into PowerShell:master Nov 30, 2017
@TravisEz13 TravisEz13 modified the milestone: 6.0.0-GA Dec 1, 2017
@TravisEz13 TravisEz13 added this to the 6.0.0-RC.2 milestone Dec 2, 2017
TravisEz13 pushed a commit to TravisEz13/PowerShell that referenced this pull request Dec 2, 2017
* Initial work to enable xunit

* Moved AssemblyOriginatorKeyFile to csharp.tests.csproj

* Native binary has dylib extension on macOS
TravisEz13 pushed a commit that referenced this pull request Dec 2, 2017
* Initial work to enable xunit

* Moved AssemblyOriginatorKeyFile to csharp.tests.csproj

* Native binary has dylib extension on macOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable xUnit tests on Windows

8 participants