Title: Tests (especially Get-FileHash) depend on machine-specific details · Issue #6413 · PowerShell/PowerShell · GitHub
Open Graph Title: Tests (especially Get-FileHash) depend on machine-specific details · Issue #6413 · PowerShell/PowerShell
X Title: Tests (especially Get-FileHash) depend on machine-specific details · Issue #6413 · PowerShell/PowerShell
Description: There are a number of tests in the PowerShell test suite that depend on a file asset in a way that depends on the specific bytes of the file. These tests fail on platforms that somehow differ from the expected encodings. For example, my ...
Open Graph Description: There are a number of tests in the PowerShell test suite that depend on a file asset in a way that depends on the specific bytes of the file. These tests fail on platforms that somehow differ from ...
X Description: There are a number of tests in the PowerShell test suite that depend on a file asset in a way that depends on the specific bytes of the file. These tests fail on platforms that somehow differ from ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/6413
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tests (especially Get-FileHash) depend on machine-specific details","articleBody":"\u003c!--\r\n\r\nFor Windows PowerShell 5.1 issues, suggestions, or feature requests please use the following link instead:\r\n- Windows PowerShell [UserVoice](https://windowsserver.uservoice.com/forums/301869-powershell)\r\n\r\nIf it is a bug report:\r\n- make sure you are able to repro it on the latest released version. \r\nYou can install the latest version from https://github.com/PowerShell/PowerShell/releases\r\n- Search the existing issues.\r\n- Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- Refer to the [known issues](https://github.com/PowerShell/PowerShell/blob/master/docs/KNOWNISSUES.md).\r\n- Fill out the following repro template:\r\n\r\nIf it's not a bug, please remove the template and elaborate the issue in your own words.\r\n--\u003e\r\n\r\nThere are a number of tests in the PowerShell test suite that depend on a file asset in a way that depends on the specific bytes of the file. These tests fail on platforms that somehow differ from the expected encodings. For example, my Git configuration converts LF line endings to CRLF locally on Windows when checking out (and converts back on check-in), which is the default Git configuration on Windows, but because of this and Windows introducing a BOM, my file hashes come out differently.\r\n\r\nI've made a small list of the tests I see failing on my machine because of this:\r\n- [x] Get-FileHash tests depend on file encoding -- CRLF/BOM breaks it\r\n- [ ] A Get-Process test depends on having a process with the name \"notepad\"\r\n- [ ] Write-Error ErrorRecord tests seem to be affected (get 11 and not the expected 4)\r\n- [ ] Get-PSSessionConfiguration assumes there is only a single PSSessionConfiguration on the machine\r\n- [ ] NativeStreams testing using the `$longtext` like in the Write-Error tests have a similar outcome\r\n\r\nThere might be a couple more tests like this too (I will update if I find any).\r\n\r\nFor the string/encoding-dependent tests, my suggestion is to use byte streams directly instead.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\ncd $powershellBuildDir\r\nImport-Module ./build.psm1\r\ncd ./test/powershell/Modules/Microsoft.PowerShell.Utility\r\nStart-PSPester Get-FileHash.Tests.ps1\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nGet-FileHash tests pass.\r\n\r\nActual behavior\r\n---------------\r\n\r\nHashes all come out differently\r\n\r\n\r\n\r\nEnvironment data\r\n----------------\r\n\r\n\u003c!-- provide the output of $PSVersionTable --\u003e\r\n\r\n```powershell\r\n\u003e $PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 6.0.1\r\nPSEdition Core\r\nGitCommitId v6.0.1-261-g71cb49a99d00ae4257e63f6564fd122325b64a48\r\nOS Microsoft Windows 10.0.16299 \r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n\r\n\r\n```\r\n","author":{"url":"https://github.com/rjmholt","@type":"Person","name":"rjmholt"},"datePublished":"2018-03-16T20:57:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/6413/PowerShell/issues/6413"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ca882a07-afe0-5b60-3b56-616d47f12ca6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E7D8:2987FD:4DDA21D:6CFD56B:6A54FC6E |
| html-safe-nonce | 332b0b17ecb5a8d352306fe0e3f05f17ed0a252a48ed6f57004260ec83b9717b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0Q4OjI5ODdGRDo0RERBMjFEOjZDRkQ1NkI6NkE1NEZDNkUiLCJ2aXNpdG9yX2lkIjoiMjI2MjUyMzUzMjc2MzUyODMwMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 30758a6d6dbfdd0be6ffca7355e4d2baabf226d1e32e31149cea429e17b66bf7 |
| hovercard-subject-tag | issue:306074162 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/6413/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d0196b9855e0adddd2a06d891fe54d89c4e688cbfc38ddcdadeffe1a25a8e8cb/PowerShell/PowerShell/issues/6413 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d0196b9855e0adddd2a06d891fe54d89c4e688cbfc38ddcdadeffe1a25a8e8cb/PowerShell/PowerShell/issues/6413 |
| og:image:alt | There are a number of tests in the PowerShell test suite that depend on a file asset in a way that depends on the specific bytes of the file. These tests fail on platforms that somehow differ from ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rjmholt |
| hostname | github.com |
| expected-hostname | github.com |
| None | eae2aab99907699a22d2c8449aa683ca74454fca87211b98f7c7b722086b2839 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dd26d3896747463b6bd56edd5e290edb595c3cbc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width