From: Eryu G. <eg...@re...> - 2012-01-05 14:58:27
|
Basic tests for setxattr(2) and make sure setxattr(2) handles error conditions correctly. There are 7 test cases: 1. Any other flags being set except XATTR_CREATE and XATTR_REPLACE, setxattr(2) should return -1 and set errno to EINVAL 2. With XATTR_REPLACE flag set but the attribute does not exist, setxattr(2) should return -1 and set errno to ENOATTR 3. Create new attr with name length greater than XATTR_NAME_MAX(255) setxattr(2) should return -1 and set errno to ERANGE 4. Create new attr whose value length is greater than XATTR_SIZE_MAX(65536) setxattr(2) should return -1 and set errno to E2BIG 5. Create new attr whose value length is zero, setxattr(2) should succeed 6. Replace the attr value without XATTR_REPLACE flag being set, setxattr(2) should return -1 and set errno to EEXIST 7. Replace attr value with XATTR_REPLACE flag being set, setxattr(2) should succeed Signed-off-by: Eryu Guan <eg...@re...> --- runtest/syscalls | 2 + testcases/kernel/syscalls/setxattr/Makefile | 23 +++ testcases/kernel/syscalls/setxattr/setxattr01.c | 223 +++++++++++++++++++++++ 3 files changed, 248 insertions(+), 0 deletions(-) create mode 100644 testcases/kernel/syscalls/setxattr/Makefile create mode 100644 testcases/kernel/syscalls/setxattr/setxattr01.c |