github.com/xuyutom/docker@v1.6.0/pkg/system/stat_test.go (about) 1 package system 2 3 import ( 4 "os" 5 "syscall" 6 "testing" 7 ) 8 9 func TestFromStatT(t *testing.T) { 10 file, _, _, dir := prepareFiles(t) 11 defer os.RemoveAll(dir) 12 13 stat := &syscall.Stat_t{} 14 err := syscall.Lstat(file, stat) 15 16 s, err := fromStatT(stat) 17 if err != nil { 18 t.Fatal(err) 19 } 20 21 if stat.Mode != s.Mode() { 22 t.Fatal("got invalid mode") 23 } 24 if stat.Uid != s.Uid() { 25 t.Fatal("got invalid uid") 26 } 27 if stat.Gid != s.Gid() { 28 t.Fatal("got invalid gid") 29 } 30 if stat.Rdev != s.Rdev() { 31 t.Fatal("got invalid rdev") 32 } 33 if stat.Mtim != s.Mtim() { 34 t.Fatal("got invalid mtim") 35 } 36 }