Commit 503c430b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3610f045
...@@ -123,6 +123,12 @@ func xverifyPkt(pkt *PktBuf, connid uint32, msgcode uint16, payload []byte) { ...@@ -123,6 +123,12 @@ func xverifyPkt(pkt *PktBuf, connid uint32, msgcode uint16, payload []byte) {
// delay a bit // delay a bit
// needed e.g. to test Close interaction with waiting read or write // needed e.g. to test Close interaction with waiting read or write
// (we cannot easily sync and make sure e.g. read is started and became asleep) // (we cannot easily sync and make sure e.g. read is started and became asleep)
//
// XXX JM suggested to really wait till syscall starts this way:
// - via polling get traceback for thread that is going to call syscall and eventuall block
// - if from that traceback we can see that blocking syscall is already called
// -> this way we can know that it is already blocking and thus sleep-hack can be avoided
// this can be done via runtime/pprof -> "goroutine" predefined profile
func tdelay() { func tdelay() {
time.Sleep(1*time.Millisecond) time.Sleep(1*time.Millisecond)
} }
......
...@@ -4,7 +4,6 @@ package fs1 ...@@ -4,7 +4,6 @@ package fs1
import ( import (
"bytes" "bytes"
"strconv"
"testing" "testing"
"../../zodb" "../../zodb"
...@@ -14,11 +13,11 @@ import ( ...@@ -14,11 +13,11 @@ import (
type txnEntry struct { type txnEntry struct {
Header DataHeader Header DataHeader
rawData []byte // what is on disk, e.g. it can be backpointer rawData []byte // what is on disk, e.g. it can be backpointer
data []byte // data client should see on load; nil means same as RawData userData []byte // data client should see on load; nil means same as RawData
} }
func (txe *txnEntry) Data() []byte { func (txe *txnEntry) Data() []byte {
data := txe.data data := txe.userData
if data == nil { if data == nil {
data = txe.rawData data = txe.rawData
} }
...@@ -40,7 +39,8 @@ func TestLoad(t *testing.T) { ...@@ -40,7 +39,8 @@ func TestLoad(t *testing.T) {
for _, txe := range dbe.Entryv { for _, txe := range dbe.Entryv {
txh := txe.Header txh := txe.Header
xid := zodb.Xid{zodb.XTid{txh.Tid, false}, txh.Oid} // loadSerial // loadSerial
xid := zodb.Xid{zodb.XTid{txh.Tid, false}, txh.Oid}
data, tid, err := fs.Load(xid) data, tid, err := fs.Load(xid)
if err != nil { if err != nil {
t.Errorf("load %v: %v", xid, err) t.Errorf("load %v: %v", xid, err)
...@@ -49,7 +49,7 @@ func TestLoad(t *testing.T) { ...@@ -49,7 +49,7 @@ func TestLoad(t *testing.T) {
t.Errorf("load %v: returned tid unexpected: %v", xid, tid) t.Errorf("load %v: returned tid unexpected: %v", xid, tid)
} }
if !bytes.Equal(data, txe.Data()) { if !bytes.Equal(data, txe.Data()) {
t.Errorf("load %v: different data:\nhave: %s\nwant: %s", xid, strconv.Quote(string(data)), strconv.Quote(string(txe.Data()))) t.Errorf("load %v: different data:\nhave: %q\nwant: %q", xid, data, txe.Data())
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment