travis can not be build ok for mmap, later fix

This commit is contained in:
siddontang 2014-11-06 15:51:17 +08:00
parent a03f8ee653
commit 75c4c59020
2 changed files with 4 additions and 4 deletions

View File

@ -136,7 +136,7 @@ func (t *tableReader) check() error {
return fmt.Errorf("invalid magic data %q", b)
}
if t.m, err = mmap.MapRegion(t.f, int(t.offsetLen), mmap.COPY, 0, t.offsetStartPos); err != nil {
if t.m, err = mmap.MapRegion(t.f, int(t.offsetLen), mmap.RDONLY, 0, t.offsetStartPos); err != nil {
return err
}
@ -289,7 +289,7 @@ func (t *tableReader) openTable() error {
}
if t.m == nil {
if t.m, err = mmap.MapRegion(t.f, int(t.offsetLen), mmap.COPY, 0, t.offsetStartPos); err != nil {
if t.m, err = mmap.MapRegion(t.f, int(t.offsetLen), mmap.RDONLY, 0, t.offsetStartPos); err != nil {
return fmt.Errorf("mmap %s error %s", t.name, err.Error())
}
}

View File

@ -10,8 +10,6 @@ import (
)
func TestFileTable(t *testing.T) {
log.SetLevel(log.LevelFatal)
base, err := ioutil.TempDir("", "test_table")
if err != nil {
t.Fatal(err)
@ -137,6 +135,8 @@ func TestFileTable(t *testing.T) {
r.Close()
log.SetLevel(log.LevelFatal)
testRepair(t, name, 1, s, 11)
testRepair(t, name, 1, s, 32)
testRepair(t, name, 1, s, 42)