-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Make CodeCoverage tests work with CodeCov.io and related fixes #4050
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
Conversation
adityapatwardhan
commented
Jun 19, 2017
- Changes to layout of package caused some changes to package path.
- Added Test modules from tests\tools\modules
- Fixed Get-ChildItem test
- Added convertor for converting OpenCover output file to JSON.
- Updated how the file is uploaded to CodeCov.io
* Changes to layout of package caused some changes to package path. * Added Test modules from tests\tools\modules * Fixed Get-ChildItem test * Added convertor for converting OpenCover output file to JSON. * Updated how the file is uploaded to CodeCov.io
| } | ||
| It "Should give .sys file if the fullpath is specified with hidden and force parameter" -Skip:(!$IsWindows){ | ||
| $file = Get-ChildItem -path "$env:SystemDrive\\pagefile.sys" -Hidden | ||
| It "Should find the hidden file if specified with hidden switch" -Skip:(!$IsWindows){ |
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.
I'd love to see this written more directly and support on non-Windows. How about this?
It "Should find the hidden file if specified with hidden switch" {
$null = new-item $TESTDRIVE/.file.txt # automatically hidden on Linux
if ( $IsWindows ) {
attrib +h $TESTDRIVE/.file.txt
}
(Get-ChildItem $TESTDRIVE).count | should be 0
(Get-ChildItem -hidden $TESTDRIVE).Count | should be 1
}
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.
Just removed the Skip, it works on Ubuntu.
| { | ||
| $lineCoverage = @{} | ||
| $sequencePoints = $script:covData | Select-Xml ".//SequencePoint[@fileid = `"$fileId`"]" | ||
|
|
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.
does this work with single quotes? If so, then:
".//SequencePoint[@fileid='$fileid']"
should work
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.
Fixed.
|
|
||
| $modulePathParts = $env:PSModulePath -split ';' | ||
|
|
||
| foreach($part in $modulePathParts) |
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.
foreach [](start = 12, length = 7)
i wonder if this is really a fatal error - if the path doesn't exist should we really fail?
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.
I want this to be fatal error so that we do not have unpredictable results due to a missing path.
JamesWTruher
left a comment
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
|
@PowerShell/powershell-maintainers This is ready for merging. |
|
@vors can you merge this so we can start getting code coverage data again? |
|
@TravisEz13 Can you have a look at this and merge? |
|
Please make sure that you add a meaningful title per the contribution guide. |
|
I changed the title for you... Hope it's close enough. |
The cleanup is coming from a code review to cleanup psl. Here we clean up the side branch of the code that will allow later to clean up a branch which uses psl. - IO.FileInfo does not make system calls in constructor. So we can create the object and then use the required attributes without direct call IO.FileInfo.GetAttributes() ( SafeGetFileAttributes() ). This allow us to exclude some p/invoke calls in our code in later cleanups. Also we get unified code for both Windows and Unix. - Remove SafeGetFileAttributes() and WinSafeGetFileAttributes(). Currently .Net Core support file attributes on all platforms in fastest way and we can remove our workaround. We get a regression in rare case (for files like pagefile.sys). Fix is ready in CoreFX, we get it in 2.1.1. I suggest ignore the regression because this is a very-very rare situation (Get-ChildItem c:\pagefile.sys -Hidden). The .Net Core team was not even able to create an artificial test for such files and uses a real pagefile.sys file for the test. Also the enumeration is still working (dir c:\ -hidden). - Re-add test which we lost in #4050. The test is pending because of the regression.