Test multicore SDR support
This commit is contained in:
parent
d763dcf48b
commit
9ae780902a
84
extern/sector-storage/ffiwrapper/sealer_test.go
vendored
84
extern/sector-storage/ffiwrapper/sealer_test.go
vendored
@ -31,6 +31,7 @@ import (
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||
"github.com/filecoin-project/filecoin-ffi/generated"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper/basicfs"
|
||||
@ -38,7 +39,34 @@ import (
|
||||
"github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader"
|
||||
)
|
||||
|
||||
var rustLogger = func() *bytes.Buffer {
|
||||
os.Setenv("RUST_LOG", "info")
|
||||
|
||||
var bb bytes.Buffer
|
||||
r, w, err := os.Pipe()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
go func() {
|
||||
_, _ = io.Copy(&bb, r)
|
||||
runtime.KeepAlive(w)
|
||||
}()
|
||||
|
||||
resp := generated.FilInitLogFd(int32(w.Fd()))
|
||||
resp.Deref()
|
||||
|
||||
defer generated.FilDestroyInitLogFdResponse(resp)
|
||||
|
||||
if resp.StatusCode != generated.FCPResponseStatusFCPNoError {
|
||||
panic(generated.RawString(resp.ErrorMsg).Copy())
|
||||
}
|
||||
|
||||
return &bb
|
||||
}()
|
||||
|
||||
func init() {
|
||||
rustLogger.Reset()
|
||||
logging.SetLogLevel("*", "DEBUG") //nolint: errcheck
|
||||
}
|
||||
|
||||
@ -853,3 +881,59 @@ func TestAddPiece512MPadded(t *testing.T) {
|
||||
|
||||
require.Equal(t, "baga6ea4seaqonenxyku4o7hr5xkzbqsceipf6xgli3on54beqbk6k246sbooobq", c.PieceCID.String())
|
||||
}
|
||||
|
||||
func TestMulticoreSDR(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping test in short mode")
|
||||
}
|
||||
|
||||
getGrothParamFileAndVerifyingKeys(sectorSize)
|
||||
|
||||
dir, err := ioutil.TempDir("", "sbtest")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
miner := abi.ActorID(123)
|
||||
|
||||
sp := &basicfs.Provider{
|
||||
Root: dir,
|
||||
}
|
||||
sb, err := New(sp)
|
||||
if err != nil {
|
||||
t.Fatalf("%+v", err)
|
||||
}
|
||||
|
||||
cleanup := func() {
|
||||
if t.Failed() {
|
||||
fmt.Printf("not removing %s\n", dir)
|
||||
return
|
||||
}
|
||||
if err := os.RemoveAll(dir); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
defer cleanup()
|
||||
|
||||
si := storage.SectorRef{
|
||||
ID: abi.SectorID{Miner: miner, Number: 1},
|
||||
ProofType: sealProofType,
|
||||
}
|
||||
|
||||
s := seal{ref: si}
|
||||
|
||||
// check multicore
|
||||
_ = os.Setenv("FIL_PROOFS_USE_MULTICORE_SDR", "1")
|
||||
rustLogger.Reset()
|
||||
s.precommit(t, sb, si, func() {})
|
||||
|
||||
ok := false
|
||||
for _, s := range strings.Split(rustLogger.String(), "\n") {
|
||||
if strings.Contains(s, "create_label::multi") {
|
||||
ok = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
require.True(t, ok)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user