From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 1/2] syscalls/fremovexattr: Add fremovexattr() tests
Date: Thu, 15 Nov 2018 17:33:45 +0100 [thread overview]
Message-ID: <20181115163344.GA29013@rei.lan> (raw)
In-Reply-To: <20181108183320.11262-1-rafael.tinoco@linaro.org>
Hi!
Pushed with minor simplification, mainly removing unreachable branches
from the second test, thanks.
Diff:
diff --git a/testcases/kernel/syscalls/fremovexattr/fremovexattr01.c b/testcases/kernel/syscalls/fremovexattr/fremovexattr01.c
index 96b92fb24..a3ea1aa2b 100644
--- a/testcases/kernel/syscalls/fremovexattr/fremovexattr01.c
+++ b/testcases/kernel/syscalls/fremovexattr/fremovexattr01.c
@@ -50,9 +50,7 @@ static void verify_fremovexattr(void)
return;
}
- memset(&got_value, 0, XATTR_TEST_VALUE_SIZE);
-
- TEST(fgetxattr(fd, XATTR_TEST_KEY, got_value, XATTR_TEST_VALUE_SIZE));
+ TEST(fgetxattr(fd, XATTR_TEST_KEY, got_value, sizeof(got_value)));
if (TST_RET >= 0) {
tst_res(TFAIL, "fremovexattr(2) did not remove attribute");
@@ -60,7 +58,8 @@ static void verify_fremovexattr(void)
}
if (TST_RET < 0 && TST_ERR != ENOATTR) {
- tst_brk(TBROK, "fremovexattr(2) could not verify removal");
+ tst_brk(TBROK | TTERRNO,
+ "fremovexattr(2) could not verify removal");
return;
}
diff --git a/testcases/kernel/syscalls/fremovexattr/fremovexattr02.c b/testcases/kernel/syscalls/fremovexattr/fremovexattr02.c
index 8eb1e9a99..534179eae 100644
--- a/testcases/kernel/syscalls/fremovexattr/fremovexattr02.c
+++ b/testcases/kernel/syscalls/fremovexattr/fremovexattr02.c
@@ -42,24 +42,20 @@ static int fd = -1;
struct test_case {
int fd;
char *key;
- int exp_ret;
int exp_err;
};
struct test_case tc[] = {
{ /* case 1: attribute does not exist */
.key = XATTR_TEST_KEY,
- .exp_ret = -1,
.exp_err = ENODATA,
},
{ /* case 2: file descriptor is invalid */
.fd = -1,
.key = XATTR_TEST_KEY,
- .exp_ret = -1,
.exp_err = EBADF,
},
{ /* case 3: bad name attribute */
- .exp_ret = -1,
.exp_err = EFAULT,
},
};
@@ -71,20 +67,19 @@ static void verify_fremovexattr(unsigned int i)
if (TST_RET == -1 && TST_ERR == EOPNOTSUPP)
tst_brk(TCONF, "fremovexattr(2) not supported");
- if (tc[i].exp_ret == TST_RET) {
-
- if (tc[i].exp_err) {
- if (tc[i].exp_err == TST_ERR) {
- tst_res(TPASS, "fremovexattr(2) passed");
- return;
- }
- } else {
- tst_res(TPASS, "fremovexattr(2) passed");
- return;
+ if (TST_RET == -1) {
+ if (tc[i].exp_err == TST_ERR) {
+ tst_res(TPASS | TTERRNO,
+ "fremovexattr(2) failed expectedly");
+ } else {
+ tst_res(TFAIL | TTERRNO,
+ "fremovexattr(2) should fail with %s",
+ tst_strerrno(tc[i].exp_err));
}
+ return;
}
- tst_res(TFAIL | TTERRNO, "fremovexattr(2) failed");
+ tst_res(TFAIL, "fremovexattr(2) returned %li", TST_RET);
}
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2018-11-15 16:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-01 22:05 [LTP] [PATCH] syscalls/fremovexattr: Add fremovexattr() tests Rafael David Tinoco
2018-11-04 23:45 ` Rafael David Tinoco
2018-11-05 0:25 ` [LTP] [PATCH v2 1/2] " Rafael David Tinoco
2018-11-05 0:25 ` [LTP] [PATCH v2 2/2] syscalls/lremovexattr: Add lremovexattr() test Rafael David Tinoco
2018-11-07 15:38 ` [LTP] [PATCH v2 1/2] syscalls/fremovexattr: Add fremovexattr() tests Cyril Hrubis
2018-11-07 15:50 ` Rafael David Tinoco
2018-11-08 18:33 ` [LTP] [PATCH v3 " Rafael David Tinoco
2018-11-08 18:33 ` [LTP] [PATCH v3 2/2] syscalls/lremovexattr: Add lremovexattr() test Rafael David Tinoco
2018-11-16 19:37 ` Cyril Hrubis
2018-11-18 13:37 ` Rafael David Tinoco
2018-11-15 16:33 ` Cyril Hrubis [this message]
2018-11-16 0:33 ` [LTP] [PATCH v3 1/2] syscalls/fremovexattr: Add fremovexattr() tests Rafael David Tinoco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181115163344.GA29013@rei.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox