Bug: Close hvsock handle on listen error; fix tests (#310)

* Bug: Close hvsock handle on listen error; fix tests

Close the socket created in
`github.com/Microsoft/go-winio/pkg/ListenHvsock` if either the `Bind` or
`Listen` calls fail.

Go changed `filepath.VolumeName` code, resulting in different behavior in
`github.com/Microsoft/go-winio/pkg/fs.GetFileSystemType`.
Update test accordingly.
Also add more debug logs to `pkg\fs\resolve_test.go`.

Also, move add skip for fuzzing on WS2019 or older to `FuzzHvSockRxTx`
code directly, instead of in ci.yml.

See: https://go-review.googlesource.com/c/go/+/540277

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>

* PR: unskip TestResolvePath

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>

---------

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
This commit is contained in:
Hamza El-Saawy
2023-12-18 11:11:12 -05:00
committed by GitHub
parent 553a715903
commit bc421d9108
5 changed files with 63 additions and 18 deletions
+29 -15
View File
@@ -13,12 +13,15 @@ jobs:
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
show-progress: false
- name: Install go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
@@ -37,12 +40,17 @@ jobs:
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
show-progress: false
- name: Install go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
# don't really need to cache Go packages, since go generate doesn't require much.
# otherwise, the cache used in the `test` stage will be (basically) empty.
cache: false
- name: Run go generate
shell: pwsh
@@ -78,26 +86,30 @@ jobs:
os: [windows-2019, windows-2022, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
show-progress: false
- name: Install go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
# avoid needing to download packages during test runs
- name: Pre-fill Module Cache
run: go mod download -x
- name: Install gotestsum
run: go install gotest.tools/gotestsum@${{ env.GOTESTSUM_VERSION }}
- name: Test repo
run: gotestsum --format standard-verbose --debug -- -gcflags=all=-d=checkptr -race -v ./...
# Fuzzing was added in go1.18, so all stable/supported versions of go should support it.
# hvsock fuzzing fails on windows 2019, even though tests pass.
#
# If fuzzing tests are added to different packages, add them here.
- name: Fuzz repo
if: ${{ matrix.os == 'windows-2022' }}
run: gotestsum --format standard-verbose --debug -- -run "^#" -fuzztime 500x -fuzz "FuzzHvSock"
# !NOTE:
# Fuzzing cannot be run across multiple packages, (ie, `go -fuzz "^Fuzz" ./...` fails).
# If new fuzzing tests are added, exec additional runs for each package.
- name: Fuzz root package
run: gotestsum --format standard-verbose --debug -- -run "^#" -fuzztime 1m -fuzz "^Fuzz"
build:
name: Build Repo
@@ -106,10 +118,12 @@ jobs:
runs-on: "windows-2019"
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
show-progress: false
- name: Install go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}