[LTP] [PATCH 3/3] mbind01: add more tests for MPOL_LOCAL
Li Wang
liwang@redhat.com
Thu Jul 29 15:25:14 CEST 2021
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/kernel/syscalls/mbind/mbind01.c | 25 ++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c
index d2cf13c8f..b5c1e948d 100644
--- a/testcases/kernel/syscalls/mbind/mbind01.c
+++ b/testcases/kernel/syscalls/mbind/mbind01.c
@@ -34,7 +34,7 @@ static struct bitmask *nodemask, *getnodemask, *empty_nodemask;
static void test_default(unsigned int i, char *p);
static void test_none(unsigned int i, char *p);
static void test_invalid_nodemask(unsigned int i, char *p);
-static void check_policy_pref_no_target(int);
+static void check_policy_pref_or_local(int);
struct test_case {
int policy;
@@ -92,7 +92,7 @@ static struct test_case tcase[] = {
.ret = 0,
.err = 0,
.test = test_none,
- .check_policy = check_policy_pref_no_target,
+ .check_policy = check_policy_pref_or_local,
},
{
POLICY_DESC(MPOL_PREFERRED),
@@ -101,6 +101,20 @@ static struct test_case tcase[] = {
.test = test_default,
.exp_nodemask = &nodemask,
},
+ {
+ POLICY_DESC(MPOL_LOCAL),
+ .ret = 0,
+ .err = 0,
+ .test = test_none,
+ .exp_nodemask = &empty_nodemask,
+ .check_policy = check_policy_pref_or_local,
+ },
+ {
+ POLICY_DESC_TEXT(MPOL_LOCAL, "target exists"),
+ .ret = -1,
+ .err = EINVAL,
+ .test = test_default,
+ },
{
POLICY_DESC(UNKNOWN_POLICY),
.ret = -1,
@@ -122,7 +136,7 @@ static struct test_case tcase[] = {
},
};
-static void check_policy_pref_no_target(int policy)
+static void check_policy_pref_or_local(int policy)
{
if (policy != MPOL_PREFERRED && policy != MPOL_LOCAL) {
tst_res(TFAIL, "Wrong policy: %s(%d), "
@@ -182,6 +196,11 @@ static void do_test(unsigned int i)
tst_res(TINFO, "case %s", tc->desc);
+ if ((tst_kvercmp(3, 8, 0)) < 0 && (tc->policy == MPOL_LOCAL)) {
+ tst_res(TCONF, "%s is not supported", tst_mempolicy_mode_name(tc->policy));
+ return;
+ }
+
setup_node();
p = SAFE_MMAP(NULL, MEM_LENGTH, PROT_READ | PROT_WRITE, MAP_PRIVATE |
--
2.31.1
More information about the ltp
mailing list