示例#1
0
func TestGitFsXAttr(t *testing.T) {
	gitfs, cleaner := setupGitFsTest(t)
	defer cleaner()

	xattrs := make([]byte, 0)
	sz, err := unix.Listxattr(gitfs.GitFsDir+"/pry/ruby-pry/bin/pry", xattrs)
	assert.Nil(t, err)
	assert.EqualValues(t, sz, 0)
	assert.Len(t, xattrs, 0)

	sz, err = unix.Listxattr(gitfs.GitFsDir+"/pry/ruby-pry/bin/pry.unexisted", xattrs)
	assert.EqualValues(t, err, unix.ENOENT)
	assert.EqualValues(t, sz, -1)
	assert.Len(t, xattrs, 0)

	xattr := make([]byte, 0)
	sz, err = unix.Getxattr(gitfs.GitFsDir+"/pry/ruby-pry/bin/pry", "a.b.c", xattr)
	assert.EqualValues(t, err, unix.ENODATA)
	assert.EqualValues(t, sz, -1)
	assert.Len(t, xattr, 0)

	sz, err = unix.Getxattr(gitfs.GitFsDir+"/pry/ruby-pry/bin/pry.unexisted", "a.b.c", xattr)
	assert.EqualValues(t, err, unix.ENOENT)
	assert.EqualValues(t, sz, -1)
	assert.Len(t, xattr, 0)
}
示例#2
0
func getxattr(path string, attr string, dest []byte) (sz int, err error) {
	return unix.Getxattr(path, attr, dest)
}