From: Andrea Cervesato <andrea.cervesato@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v4 10/11] Add wqueue08 test
Date: Fri, 7 Jan 2022 22:20:57 +0100 [thread overview]
Message-ID: <20220107212058.19768-11-andrea.cervesato@suse.de> (raw)
In-Reply-To: <20220107212058.19768-1-andrea.cervesato@suse.de>
This test is testing WATCH_META_REMOVAL_NOTIFICATION event
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.de>
---
testcases/kernel/watchqueue/wqueue08.c | 44 ++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 testcases/kernel/watchqueue/wqueue08.c
diff --git a/testcases/kernel/watchqueue/wqueue08.c b/testcases/kernel/watchqueue/wqueue08.c
new file mode 100644
index 000000000..a8e01fbd2
--- /dev/null
+++ b/testcases/kernel/watchqueue/wqueue08.c
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2021 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test if key watch removal is correctly recognized by watch queue.
+ */
+
+#include "tst_test.h"
+#include "lapi/keyctl.h"
+#include "common.h"
+
+static void saw_watch_removal(struct watch_notification *n, LTP_ATTRIBUTE_UNUSED size_t len, unsigned int wtype)
+{
+ if (wtype != WATCH_TYPE_META)
+ return;
+
+ if (n->subtype == WATCH_META_REMOVAL_NOTIFICATION)
+ tst_res(TPASS, "Meta removal notification received");
+ else
+ tst_res(TFAIL, "Event not recognized");
+}
+
+static void run(void)
+{
+ int fd;
+ key_serial_t key;
+
+ fd = wqueue_watch(256, &wqueue_filter);
+ key = wqueue_add_key(fd);
+
+ /* if watch_id = -1 key is removed from the watch queue */
+ keyctl(KEYCTL_WATCH_KEY, key, fd, -1);
+ wqueue_consumer(fd, saw_watch_removal);
+
+ SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+ .test_all = run,
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-01-07 21:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 21:20 [LTP] [PATCH v4 00/11] watchqueue testing suite Andrea Cervesato
2022-01-07 21:20 ` [LTP] [PATCH v4 01/11] Add KEYCTL_WATCH_KEY to lapi/keyctl.h fallback Andrea Cervesato
2022-01-07 21:20 ` [LTP] [PATCH v4 02/11] Add lapi/watch_queue.h header fallback Andrea Cervesato
2022-01-07 21:20 ` [LTP] [PATCH v4 03/11] Add wqueue01 test Andrea Cervesato
2022-01-26 11:58 ` Cyril Hrubis
2022-01-07 21:20 ` [LTP] [PATCH v4 04/11] Add wqueue02 test Andrea Cervesato
2022-01-07 21:20 ` [LTP] [PATCH v4 05/11] Add wqueue03 test Andrea Cervesato
2022-01-07 21:20 ` [LTP] [PATCH v4 06/11] Add wqueue04 test Andrea Cervesato
2022-01-07 21:20 ` [LTP] [PATCH v4 07/11] Add wqueue05 test Andrea Cervesato
2022-01-07 21:20 ` [LTP] [PATCH v4 08/11] Add wqueue06 test Andrea Cervesato
2022-01-07 21:20 ` [LTP] [PATCH v4 09/11] Add wqueue07 test Andrea Cervesato
2022-01-07 21:20 ` Andrea Cervesato [this message]
2022-01-07 21:20 ` [LTP] [PATCH v4 11/11] Add wqueue09 test Andrea Cervesato
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=20220107212058.19768-11-andrea.cervesato@suse.de \
--to=andrea.cervesato@suse.de \
--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