diff --git a/storage/sealer/ffiwrapper/sealer_test.go b/storage/sealer/ffiwrapper/sealer_test.go index 26e7c50978f..f994b90b929 100644 --- a/storage/sealer/ffiwrapper/sealer_test.go +++ b/storage/sealer/ffiwrapper/sealer_test.go @@ -278,8 +278,6 @@ func getGrothParamFileAndVerifyingKeys(s abi.SectorSize) { // // go test -run=^TestDownloadParams func TestDownloadParams(t *testing.T) { - // defer requireFDsClosed(t, openFDs(t)) flaky likely cause of how go-embed works with param files - getGrothParamFileAndVerifyingKeys(sectorSize) } @@ -288,8 +286,6 @@ func TestSealAndVerify(t *testing.T) { t.Skip("skipping test in short mode") } - defer requireFDsClosed(t, openFDs(t)) - if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware t.Skip("this is slow") } @@ -359,8 +355,6 @@ func TestSealPoStNoCommit(t *testing.T) { t.Skip("skipping test in short mode") } - defer requireFDsClosed(t, openFDs(t)) - if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware t.Skip("this is slow") } @@ -434,8 +428,6 @@ func TestSealAndVerify3(t *testing.T) { t.Skip("skipping test in short mode") } - defer requireFDsClosed(t, openFDs(t)) - if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware t.Skip("this is slow") } @@ -510,8 +502,6 @@ func TestSealAndVerifyAggregate(t *testing.T) { t.Skip("skipping test in short mode") } - defer requireFDsClosed(t, openFDs(t)) - if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware t.Skip("this is slow") } @@ -609,62 +599,6 @@ func BenchmarkWriteWithAlignment(b *testing.B) { } } -func openFDs(t *testing.T) int { - 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(path, info.Name())) - if err != nil { - continue - } - - if strings.HasPrefix(l, "/dev/nvidia") { - skip++ - } - - if strings.HasPrefix(l, "/var/tmp/filecoin-proof-parameters/") { - skip++ - } - } - - return len(dent) - skip -} - -func requireFDsClosed(t *testing.T, start int) { - openNow := openFDs(t) - - if start != openNow { - 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(path, info.Name())) - if err != nil { - fmt.Printf("FD err %s\n", err) - continue - } - - fmt.Printf("FD %s -> %s\n", info.Name(), l) - } - } - - log.Infow("open FDs", "start", start, "now", openNow) - // todo make work with cuda somehow - // require.Equal(t, start, openNow, "FDs shouldn't leak") -} - func TestGenerateUnsealedCID(t *testing.T) { pt := abi.RegisteredSealProof_StackedDrg2KiBV1 ups := int(abi.PaddedPieceSize(2048).Unpadded()) @@ -1106,8 +1040,6 @@ func TestSealAndVerifySynth(t *testing.T) { t.Skip("skipping test in short mode") } - defer requireFDsClosed(t, openFDs(t)) - if runtime.NumCPU() < 10 && os.Getenv("CI") == "" { // don't bother on slow hardware t.Skip("this is slow") } @@ -1226,8 +1158,6 @@ func TestSealCommDRInGo(t *testing.T) { t.Skip("skipping test in short mode") } - defer requireFDsClosed(t, openFDs(t)) - cdir, err := os.MkdirTemp("", "sbtest-c-") require.NoError(t, err) miner := abi.ActorID(123)