Mike Frysinger said the following on 2012-1-10 1:20: > On Monday 09 January 2012 01:50:21 Peng Haitao wrote: >> + if ((tst_kvercmp(3, 0, 0)) >= 0) > > no need for the paren around the tst_kvercmp() > -mike
Thanks. Before kernel 3.0.0, getxattr02 will set errno with 'EPERM' when the file is not a regular file and directory. Refer to commit: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=55b23bde19c08f14127a27d461a4e079942c7258 Signed-off-by: Peng Haitao <[email protected]> --- testcases/kernel/syscalls/getxattr/getxattr02.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/testcases/kernel/syscalls/getxattr/getxattr02.c b/testcases/kernel/syscalls/getxattr/getxattr02.c index 54d8949..5440044 100644 --- a/testcases/kernel/syscalls/getxattr/getxattr02.c +++ b/testcases/kernel/syscalls/getxattr/getxattr02.c @@ -78,6 +78,7 @@ int main(int argc, char *argv[]) { int lc; int i; + int exp_eno; char *msg; char buf[BUFSIZ]; @@ -90,15 +91,23 @@ int main(int argc, char *argv[]) for (lc = 0; TEST_LOOPING(lc); lc++) { Tst_count = 0; + /* Before kernel 3.0.0, getxattr(2) will set errno with 'EPERM' + * when the file is not a regular file and directory, refer to + * commitid 55b23bd + */ + if (tst_kvercmp(3, 0, 0) >= 0) + exp_eno = ENODATA; + else + exp_eno = EPERM; + for (i = 0; i < TST_TOTAL; i++) { TEST(getxattr(tc[0], XATTR_TEST_KEY, buf, BUFSIZ)); - if (TEST_RETURN == -1 && TEST_ERRNO == ENODATA) { + if (TEST_RETURN == -1 && TEST_ERRNO == exp_eno) tst_resm(TPASS | TTERRNO, "expected behavior"); - } else { + else tst_resm(TFAIL | TTERRNO, "unexpected behavior" - " - expected errno %d - Got", ENODATA); - } + " - expected errno %d - Got", exp_eno); } } -- 1.7.1 -- Best Regards, Peng ------------------------------------------------------------------------------ Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
