Commit 0f93160b authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Unset umask for loopback tests.

parent da5baec7
...@@ -46,6 +46,9 @@ func NewTestCase(t *testing.T) *testCase { ...@@ -46,6 +46,9 @@ func NewTestCase(t *testing.T) *testCase {
me.tester = t me.tester = t
paranoia = true paranoia = true
// Make sure system setting does not affect test.
syscall.Umask(0)
const name string = "hello.txt" const name string = "hello.txt"
const subdir string = "subdir" const subdir string = "subdir"
...@@ -203,12 +206,10 @@ func TestWriteThrough(t *testing.T) { ...@@ -203,12 +206,10 @@ func TestWriteThrough(t *testing.T) {
defer me.Cleanup() defer me.Cleanup()
// Create (for write), write. // Create (for write), write.
t.Log("Testing create.")
f, err := os.OpenFile(me.mountFile, os.O_WRONLY|os.O_CREATE, 0644) f, err := os.OpenFile(me.mountFile, os.O_WRONLY|os.O_CREATE, 0644)
CheckSuccess(err) CheckSuccess(err)
defer f.Close() defer f.Close()
t.Log("Testing write.")
n, err := f.WriteString(contents) n, err := f.WriteString(contents)
CheckSuccess(err) CheckSuccess(err)
if n != len(contents) { if n != len(contents) {
...@@ -222,13 +223,13 @@ func TestWriteThrough(t *testing.T) { ...@@ -222,13 +223,13 @@ func TestWriteThrough(t *testing.T) {
f, err = os.Open(me.origFile) f, err = os.Open(me.origFile)
CheckSuccess(err) CheckSuccess(err)
var buf [1024]byte var buf [1024]byte
slice := buf[:] slice := buf[:]
n, err = f.Read(slice) n, err = f.Read(slice)
CheckSuccess(err) CheckSuccess(err)
t.Log("Orig contents", slice[:n])
if string(slice[:n]) != contents { if string(slice[:n]) != contents {
t.Errorf("write contents error %v", slice[:n]) t.Errorf("write contents error. Got: %v, expect: %v", string(slice[:n]), contents)
} }
} }
......
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