Merge pull request #11180 from filecoin-project/macSealTest
mac seal test
This commit is contained in:
commit
23cd5832c7
@ -595,12 +595,18 @@ func BenchmarkWriteWithAlignment(b *testing.B) {
|
||||
}
|
||||
|
||||
func openFDs(t *testing.T) int {
|
||||
dent, err := os.ReadDir("/proc/self/fd")
|
||||
require.NoError(t, err)
|
||||
path := "/proc/self/fd"
|
||||
if runtime.GOOS == "darwin" {
|
||||
path = "/dev/fd"
|
||||
}
|
||||
dent, err := os.ReadDir(path)
|
||||
if err != nil && !strings.Contains(err.Error(), "/dev/fd/3: bad file descriptor") {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
var skip int
|
||||
for _, info := range dent {
|
||||
l, err := os.Readlink(filepath.Join("/proc/self/fd", info.Name()))
|
||||
l, err := os.Readlink(filepath.Join(path, info.Name()))
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
@ -621,11 +627,15 @@ func requireFDsClosed(t *testing.T, start int) {
|
||||
openNow := openFDs(t)
|
||||
|
||||
if start != openNow {
|
||||
dent, err := os.ReadDir("/proc/self/fd")
|
||||
path := "/proc/self/fd"
|
||||
if runtime.GOOS == "darwin" {
|
||||
path = "/dev/fd"
|
||||
}
|
||||
dent, err := os.ReadDir(path)
|
||||
require.NoError(t, err)
|
||||
|
||||
for _, info := range dent {
|
||||
l, err := os.Readlink(filepath.Join("/proc/self/fd", info.Name()))
|
||||
l, err := os.Readlink(filepath.Join(path, info.Name()))
|
||||
if err != nil {
|
||||
fmt.Printf("FD err %s\n", err)
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user