Commit afdcac7b authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Test if umask is working.

parent 32cfda28
......@@ -2,6 +2,7 @@ package fuse
import (
"bytes"
"exec"
"fmt"
"io/ioutil"
"log"
......@@ -728,3 +729,24 @@ func TestDoubleOpen(t *testing.T) {
CheckSuccess(err)
defer rwFile.Close()
}
func TestUmask(t *testing.T) {
ts := NewTestCase(t)
defer ts.Cleanup()
// Make sure system setting does not affect test.
fn := ts.mnt+"/file"
mask := 020
cmd := exec.Command("/bin/sh", "-c",
fmt.Sprintf("umask %o && mkdir %s", mask, fn))
cmd.Run()
fi, err := os.Lstat(fn)
CheckSuccess(err)
expect := mask ^ 0777
got := int(fi.Mode & 0777)
if got != expect {
t.Errorf("got %o, expect mode %o for file %s", got, expect, fn)
}
}
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