summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-01-28 12:58:30 -0700
committerJens Axboe <axboe@kernel.dk>2020-01-28 12:58:30 -0700
commit17b83d10e6d393858383bdb1040bbfbb697879ed (patch)
tree1b9cf993c677182b1ebdaf488d38384d45bcd032
parent869919af8cc5348c79d9512000a6b147dd68a2db (diff)
downloadliburing-17b83d10e6d393858383bdb1040bbfbb697879ed.tar.gz
liburing-17b83d10e6d393858383bdb1040bbfbb697879ed.tar.bz2
test/personality: test invalid personality
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/personality.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/personality.c b/test/personality.c
index c9001ac..700520e 100644
--- a/test/personality.c
+++ b/test/personality.c
@@ -14,6 +14,8 @@
#define FNAME "/tmp/.tmp.access"
#define USE_UID 1000
+static int no_personality;
+
static int open_file(struct io_uring *ring, int cred_id)
{
struct io_uring_cqe *cqe;
@@ -54,6 +56,7 @@ static int test_personality(struct io_uring *ring)
if (ret < 0) {
if (ret == -EINVAL) {
fprintf(stdout, "Personalities not supported, skipping\n");
+ no_personality = 1;
goto out;
}
fprintf(stderr, "register_personality: %d\n", ret);
@@ -112,6 +115,20 @@ err:
return 1;
}
+static int test_invalid_personality(struct io_uring *ring)
+{
+ int ret;
+
+ ret = open_file(ring, 2);
+ if (ret != -EINVAL) {
+ fprintf(stderr, "invalid personality got: %d\n", ret);
+ goto err;
+ }
+ return 0;
+err:
+ return 1;
+}
+
int main(int argc, char *argv[])
{
struct io_uring ring;
@@ -134,6 +151,14 @@ int main(int argc, char *argv[])
fprintf(stderr, "test_personality failed\n");
return ret;
}
+ if (no_personality)
+ return 0;
+
+ ret = test_invalid_personality(&ring);
+ if (ret) {
+ fprintf(stderr, "test_invalid_personality failed\n");
+ return ret;
+ }
return 0;
}