func (tc *netTestCase) Clean() { tc.sockS.Close() tc.sockC.Close() os.RemoveAll(tc.tmp) if tc.startSplices != splice.Used() { tc.tester.Fatalf("Splice leak before %d after %d", tc.startSplices, splice.Used()) } }
func newNetTestCase(t *testing.T) *netTestCase { me := &netTestCase{} me.tester = t me.startSplices = splice.Used() me.tmp, _ = ioutil.TempDir("", "term-cba") optS := StoreOptions{ Dir: me.tmp + "/server", } me.server = NewStore(&optS, nil) optC := optS optC.Dir = me.tmp + "/client" me.clientStore = NewStore(&optC, nil) var err error me.sockS, me.sockC = net.Pipe() if err != nil { t.Fatalf("unixSocketpair: %v", err) } go me.server.ServeConn(me.sockS) me.client = me.clientStore.NewClient(me.sockC) return me }