* [LTP] [PATCH v1 01/10] Prepare watchqueue testing suite build
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
@ 2022-01-04 8:18 ` Andrea Cervesato via ltp
2022-01-04 11:05 ` Cyril Hrubis
2022-01-04 8:18 ` [LTP] [PATCH v1 02/10] Add wqueue01 new test Andrea Cervesato via ltp
` (9 subsequent siblings)
10 siblings, 1 reply; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2022-01-04 8:18 UTC (permalink / raw)
To: ltp
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
testcases/kernel/Makefile | 1 +
testcases/kernel/watchqueue/.gitignore | 10 ++++++++++
testcases/kernel/watchqueue/Makefile | 8 ++++++++
3 files changed, 19 insertions(+)
create mode 100644 testcases/kernel/watchqueue/.gitignore
create mode 100644 testcases/kernel/watchqueue/Makefile
diff --git a/testcases/kernel/Makefile b/testcases/kernel/Makefile
index 4604f1f38..d44856c57 100644
--- a/testcases/kernel/Makefile
+++ b/testcases/kernel/Makefile
@@ -38,6 +38,7 @@ SUBDIRS += connectors \
sound \
tracing \
uevents \
+ watchqueue \
ifeq ($(WITH_POWER_MANAGEMENT_TESTSUITE),yes)
SUBDIRS += power_management
diff --git a/testcases/kernel/watchqueue/.gitignore b/testcases/kernel/watchqueue/.gitignore
new file mode 100644
index 000000000..797ccc243
--- /dev/null
+++ b/testcases/kernel/watchqueue/.gitignore
@@ -0,0 +1,10 @@
+wqueue01
+wqueue02
+wqueue03
+wqueue04
+wqueue05
+wqueue06
+wqueue07
+wqueue08
+watch_test.c
+watch_test
diff --git a/testcases/kernel/watchqueue/Makefile b/testcases/kernel/watchqueue/Makefile
new file mode 100644
index 000000000..0008b8cc4
--- /dev/null
+++ b/testcases/kernel/watchqueue/Makefile
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+top_srcdir ?= ../../..
+
+LDLIBS += $(KEYUTILS_LIBS)
+
+include $(top_srcdir)/include/mk/testcases.mk
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [LTP] [PATCH v1 01/10] Prepare watchqueue testing suite build
2022-01-04 8:18 ` [LTP] [PATCH v1 01/10] Prepare watchqueue testing suite build Andrea Cervesato via ltp
@ 2022-01-04 11:05 ` Cyril Hrubis
0 siblings, 0 replies; 15+ messages in thread
From: Cyril Hrubis @ 2022-01-04 11:05 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi!
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> testcases/kernel/Makefile | 1 +
> testcases/kernel/watchqueue/.gitignore | 10 ++++++++++
> testcases/kernel/watchqueue/Makefile | 8 ++++++++
> 3 files changed, 19 insertions(+)
> create mode 100644 testcases/kernel/watchqueue/.gitignore
> create mode 100644 testcases/kernel/watchqueue/Makefile
>
> diff --git a/testcases/kernel/Makefile b/testcases/kernel/Makefile
> index 4604f1f38..d44856c57 100644
> --- a/testcases/kernel/Makefile
> +++ b/testcases/kernel/Makefile
> @@ -38,6 +38,7 @@ SUBDIRS += connectors \
> sound \
> tracing \
> uevents \
> + watchqueue \
>
> ifeq ($(WITH_POWER_MANAGEMENT_TESTSUITE),yes)
> SUBDIRS += power_management
> diff --git a/testcases/kernel/watchqueue/.gitignore b/testcases/kernel/watchqueue/.gitignore
> new file mode 100644
> index 000000000..797ccc243
> --- /dev/null
> +++ b/testcases/kernel/watchqueue/.gitignore
> @@ -0,0 +1,10 @@
> +wqueue01
> +wqueue02
> +wqueue03
> +wqueue04
> +wqueue05
> +wqueue06
> +wqueue07
> +wqueue08
> +watch_test.c
> +watch_test
The two last entries does not seem to be right.
Also I guess that it's more common to add entries like that
incrementally each with the corresponding test.
> diff --git a/testcases/kernel/watchqueue/Makefile b/testcases/kernel/watchqueue/Makefile
> new file mode 100644
> index 000000000..0008b8cc4
> --- /dev/null
> +++ b/testcases/kernel/watchqueue/Makefile
> @@ -0,0 +1,8 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +top_srcdir ?= ../../..
> +
> +LDLIBS += $(KEYUTILS_LIBS)
> +
> +include $(top_srcdir)/include/mk/testcases.mk
> +include $(top_srcdir)/include/mk/generic_leaf_target.mk
> --
> 2.34.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* [LTP] [PATCH v1 02/10] Add wqueue01 new test
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
2022-01-04 8:18 ` [LTP] [PATCH v1 01/10] Prepare watchqueue testing suite build Andrea Cervesato via ltp
@ 2022-01-04 8:18 ` Andrea Cervesato via ltp
2022-01-04 11:22 ` Cyril Hrubis
2022-01-04 8:18 ` [LTP] [PATCH v1 03/10] Add wqueue02 " Andrea Cervesato via ltp
` (8 subsequent siblings)
10 siblings, 1 reply; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2022-01-04 8:18 UTC (permalink / raw)
To: ltp
This test checks if KEYCTL_UPDATE event is recognized by watch queue
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
testcases/kernel/watchqueue/common.h | 153 +++++++++++++++++++++++++
testcases/kernel/watchqueue/wqueue01.c | 68 +++++++++++
2 files changed, 221 insertions(+)
create mode 100644 testcases/kernel/watchqueue/common.h
create mode 100644 testcases/kernel/watchqueue/wqueue01.c
diff --git a/testcases/kernel/watchqueue/common.h b/testcases/kernel/watchqueue/common.h
new file mode 100644
index 000000000..6a7ae213e
--- /dev/null
+++ b/testcases/kernel/watchqueue/common.h
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+#ifndef WQUEUE_COMMON_H__
+#define WQUEUE_COMMON_H__
+
+#define _FCNTL_H
+
+#include <linux/watch_queue.h>
+#include "tst_test.h"
+#include "lapi/keyctl.h"
+
+static struct watch_notification_filter wqueue_key_filter = {
+ .nr_filters = 1,
+ .__reserved = 0,
+ .filters = {
+ [0] = {
+ .type = WATCH_TYPE_KEY_NOTIFY,
+ .subtype_filter[0] = UINT_MAX,
+ },
+ },
+};
+
+static const char *key_subtypes[256] = {
+ [NOTIFY_KEY_INSTANTIATED] = "instantiated",
+ [NOTIFY_KEY_UPDATED] = "updated",
+ [NOTIFY_KEY_LINKED] = "linked",
+ [NOTIFY_KEY_UNLINKED] = "unlinked",
+ [NOTIFY_KEY_CLEARED] = "cleared",
+ [NOTIFY_KEY_REVOKED] = "revoked",
+ [NOTIFY_KEY_INVALIDATED] = "invalidated",
+ [NOTIFY_KEY_SETATTR] = "setattr",
+};
+
+static inline long safe_keyctl(int cmd, ...)
+{
+ long ret;
+ va_list va;
+ unsigned long arg2, arg3, arg4, arg5;
+
+ va_start(va, cmd);
+ arg2 = va_arg(va, unsigned long);
+ arg3 = va_arg(va, unsigned long);
+ arg4 = va_arg(va, unsigned long);
+ arg5 = va_arg(va, unsigned long);
+ va_end(va);
+
+ ret = tst_syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5);
+ if (ret == -1)
+ tst_brk(TBROK, "keyctl error: %s", tst_strerrno(errno));
+
+ return ret;
+}
+
+static int wqueue_key_event(struct watch_notification *n, size_t len, unsigned int wtype, int type)
+{
+ struct key_notification *k;
+ const char* msg;
+
+ if (wtype != WATCH_TYPE_KEY_NOTIFY)
+ return 0;
+
+ if (len != sizeof(struct key_notification))
+ tst_brk(TBROK, "Incorrect key message length");
+
+ k = (struct key_notification *)n;
+ msg = key_subtypes[n->subtype];
+
+ tst_res(TINFO, "KEY %08x change=%u[%s] aux=%u",
+ k->key_id, n->subtype, msg, k->aux);
+
+ if (n->subtype == type)
+ return 1;
+
+ return 0;
+}
+
+static key_serial_t wqueue_add_key(int fd)
+{
+ key_serial_t key;
+
+ key = add_key("user", "ltptestkey", "a", 1, KEY_SPEC_SESSION_KEYRING);
+ if (key == -1)
+ tst_brk(TBROK, "add_key error: %s", tst_strerrno(errno));
+
+ safe_keyctl(KEYCTL_WATCH_KEY, key, fd, 0x01);
+ safe_keyctl(KEYCTL_WATCH_KEY, KEY_SPEC_SESSION_KEYRING, fd, 0x02);
+
+ return key;
+}
+
+static int wqueue_watch(int buf_size, struct watch_notification_filter *filter)
+{
+ int pipefd[2];
+ int fd;
+
+ SAFE_PIPE2(pipefd, O_NOTIFICATION_PIPE);
+
+ fd = pipefd[0];
+
+ SAFE_IOCTL(fd, IOC_WATCH_QUEUE_SET_SIZE, buf_size);
+ SAFE_IOCTL(fd, IOC_WATCH_QUEUE_SET_FILTER, filter);
+
+ return fd;
+}
+
+typedef void (*wqueue_callback) (struct watch_notification *n, size_t len, unsigned int wtype);
+
+static void wqueue_consumer(int fd, volatile int *keep_polling, wqueue_callback cb)
+{
+ unsigned char buffer[433], *p, *end;
+ union {
+ struct watch_notification n;
+ unsigned char buf1[128];
+ } n;
+ ssize_t buf_len;
+
+ tst_res(TINFO, "Waiting for watch queue events");
+
+ while (*keep_polling) {
+ buf_len = SAFE_READ(0, fd, buffer, sizeof(buffer));
+
+ p = buffer;
+ end = buffer + buf_len;
+ while (p < end) {
+ size_t largest, len;
+
+ largest = end - p;
+ if (largest > 128)
+ largest = 128;
+
+ if (largest < sizeof(struct watch_notification))
+ tst_brk(TBROK, "Short message header: %zu", largest);
+
+ memcpy(&n, p, largest);
+
+ tst_res(TINFO, "NOTIFY[%03zx]: ty=%06x sy=%02x i=%08x",
+ p - buffer, n.n.type, n.n.subtype, n.n.info);
+
+ len = n.n.info & WATCH_INFO_LENGTH;
+ if (len < sizeof(n.n) || len > largest)
+ tst_brk(TBROK, "Bad message length: %zu/%zu", len, largest);
+
+ cb(&n.n, len, n.n.type);
+
+ p += len;
+ }
+ }
+}
+
+#endif
diff --git a/testcases/kernel/watchqueue/wqueue01.c b/testcases/kernel/watchqueue/wqueue01.c
new file mode 100644
index 000000000..f22682eed
--- /dev/null
+++ b/testcases/kernel/watchqueue/wqueue01.c
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test if keyctl update is correctly recognized by watch queue.
+ */
+
+#define _FCNTL_H
+
+#include "tst_test.h"
+#include "lapi/keyctl.h"
+#include "common.h"
+
+static int *keep_polling;
+
+static void saw_key_updated(struct watch_notification *n, size_t len, unsigned int wtype)
+{
+ if (wqueue_key_event(n, len, wtype, NOTIFY_KEY_UPDATED))
+ tst_res(TPASS, "keyctl update has been recognized");
+ else
+ tst_res(TFAIL, "keyctl update has not been recognized");
+}
+
+static void setup(void)
+{
+ keep_polling = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+}
+
+static void cleanup(void)
+{
+ *keep_polling = 0;
+ SAFE_MUNMAP(keep_polling, sizeof(int));
+}
+
+static void run(void)
+{
+ int fd;
+ int pid;
+ key_serial_t key;
+
+ fd = wqueue_watch(256, &wqueue_key_filter);
+ key = wqueue_add_key(fd);
+
+ *keep_polling = 1;
+
+ pid = SAFE_FORK();
+ if (pid > 0) {
+ wqueue_consumer(fd, keep_polling, saw_key_updated);
+ return;
+ }
+
+ safe_keyctl(KEYCTL_UPDATE, key, "b", 1);
+
+ *keep_polling = 0;
+
+ SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+ .setup = setup,
+ .cleanup = cleanup,
+ .test_all = run,
+ .forks_child = 1
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [LTP] [PATCH v1 02/10] Add wqueue01 new test
2022-01-04 8:18 ` [LTP] [PATCH v1 02/10] Add wqueue01 new test Andrea Cervesato via ltp
@ 2022-01-04 11:22 ` Cyril Hrubis
0 siblings, 0 replies; 15+ messages in thread
From: Cyril Hrubis @ 2022-01-04 11:22 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi!
> This test checks if KEYCTL_UPDATE event is recognized by watch queue
>
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> testcases/kernel/watchqueue/common.h | 153 +++++++++++++++++++++++++
> testcases/kernel/watchqueue/wqueue01.c | 68 +++++++++++
> 2 files changed, 221 insertions(+)
> create mode 100644 testcases/kernel/watchqueue/common.h
> create mode 100644 testcases/kernel/watchqueue/wqueue01.c
>
> diff --git a/testcases/kernel/watchqueue/common.h b/testcases/kernel/watchqueue/common.h
> new file mode 100644
> index 000000000..6a7ae213e
> --- /dev/null
> +++ b/testcases/kernel/watchqueue/common.h
> @@ -0,0 +1,153 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
> + */
> +
> +#ifndef WQUEUE_COMMON_H__
> +#define WQUEUE_COMMON_H__
> +
> +#define _FCNTL_H
This is certainly wrong a hack that will break sooner or later.
What is this needed for?
> +#include <linux/watch_queue.h>
We will need a configure check for this one and either add fallback
structures and constants in lapi/ or skip the test build when this file
is not present.
> +#include "tst_test.h"
> +#include "lapi/keyctl.h"
> +
> +static struct watch_notification_filter wqueue_key_filter = {
> + .nr_filters = 1,
> + .__reserved = 0,
This is a global no need to zero out any members like that.
> + .filters = {
> + [0] = {
> + .type = WATCH_TYPE_KEY_NOTIFY,
> + .subtype_filter[0] = UINT_MAX,
> + },
> + },
> +};
> +
> +static const char *key_subtypes[256] = {
> + [NOTIFY_KEY_INSTANTIATED] = "instantiated",
> + [NOTIFY_KEY_UPDATED] = "updated",
> + [NOTIFY_KEY_LINKED] = "linked",
> + [NOTIFY_KEY_UNLINKED] = "unlinked",
> + [NOTIFY_KEY_CLEARED] = "cleared",
> + [NOTIFY_KEY_REVOKED] = "revoked",
> + [NOTIFY_KEY_INVALIDATED] = "invalidated",
> + [NOTIFY_KEY_SETATTR] = "setattr",
> +};
> +
> +static inline long safe_keyctl(int cmd, ...)
> +{
> + long ret;
> + va_list va;
> + unsigned long arg2, arg3, arg4, arg5;
> +
> + va_start(va, cmd);
> + arg2 = va_arg(va, unsigned long);
> + arg3 = va_arg(va, unsigned long);
> + arg4 = va_arg(va, unsigned long);
> + arg5 = va_arg(va, unsigned long);
> + va_end(va);
> +
> + ret = tst_syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5);
> + if (ret == -1)
> + tst_brk(TBROK, "keyctl error: %s", tst_strerrno(errno));
We do have lapi/keyctl.h that defines keyctl() you should use that
instead.
> + return ret;
> +}
>
> +static int wqueue_key_event(struct watch_notification *n, size_t len, unsigned int wtype, int type)
> +{
> + struct key_notification *k;
> + const char* msg;
> +
> + if (wtype != WATCH_TYPE_KEY_NOTIFY)
> + return 0;
> +
> + if (len != sizeof(struct key_notification))
> + tst_brk(TBROK, "Incorrect key message length");
> +
> + k = (struct key_notification *)n;
> + msg = key_subtypes[n->subtype];
> +
> + tst_res(TINFO, "KEY %08x change=%u[%s] aux=%u",
> + k->key_id, n->subtype, msg, k->aux);
> +
> + if (n->subtype == type)
> + return 1;
Wrong indentation here, do not forget to run make check before
posting...
> + return 0;
> +}
> +
> +static key_serial_t wqueue_add_key(int fd)
> +{
> + key_serial_t key;
> +
> + key = add_key("user", "ltptestkey", "a", 1, KEY_SPEC_SESSION_KEYRING);
> + if (key == -1)
> + tst_brk(TBROK, "add_key error: %s", tst_strerrno(errno));
> +
> + safe_keyctl(KEYCTL_WATCH_KEY, key, fd, 0x01);
> + safe_keyctl(KEYCTL_WATCH_KEY, KEY_SPEC_SESSION_KEYRING, fd, 0x02);
> +
> + return key;
> +}
> +
> +static int wqueue_watch(int buf_size, struct watch_notification_filter *filter)
> +{
> + int pipefd[2];
> + int fd;
> +
> + SAFE_PIPE2(pipefd, O_NOTIFICATION_PIPE);
> +
> + fd = pipefd[0];
> +
> + SAFE_IOCTL(fd, IOC_WATCH_QUEUE_SET_SIZE, buf_size);
> + SAFE_IOCTL(fd, IOC_WATCH_QUEUE_SET_FILTER, filter);
> +
> + return fd;
> +}
> +
> +typedef void (*wqueue_callback) (struct watch_notification *n, size_t len, unsigned int wtype);
> +
> +static void wqueue_consumer(int fd, volatile int *keep_polling, wqueue_callback cb)
> +{
> + unsigned char buffer[433], *p, *end;
> + union {
> + struct watch_notification n;
> + unsigned char buf1[128];
> + } n;
> + ssize_t buf_len;
> +
> + tst_res(TINFO, "Waiting for watch queue events");
> +
> + while (*keep_polling) {
> + buf_len = SAFE_READ(0, fd, buffer, sizeof(buffer));
> +
> + p = buffer;
> + end = buffer + buf_len;
> + while (p < end) {
> + size_t largest, len;
> +
> + largest = end - p;
> + if (largest > 128)
> + largest = 128;
> +
> + if (largest < sizeof(struct watch_notification))
> + tst_brk(TBROK, "Short message header: %zu", largest);
> +
> + memcpy(&n, p, largest);
> +
> + tst_res(TINFO, "NOTIFY[%03zx]: ty=%06x sy=%02x i=%08x",
> + p - buffer, n.n.type, n.n.subtype, n.n.info);
> +
> + len = n.n.info & WATCH_INFO_LENGTH;
> + if (len < sizeof(n.n) || len > largest)
> + tst_brk(TBROK, "Bad message length: %zu/%zu", len, largest);
> +
> + cb(&n.n, len, n.n.type);
> +
> + p += len;
> + }
> + }
> +}
> +
> +#endif
> diff --git a/testcases/kernel/watchqueue/wqueue01.c b/testcases/kernel/watchqueue/wqueue01.c
> new file mode 100644
> index 000000000..f22682eed
> --- /dev/null
> +++ b/testcases/kernel/watchqueue/wqueue01.c
> @@ -0,0 +1,68 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
> + */
> +
> +/*\
> + * [Description]
> + *
> + * Test if keyctl update is correctly recognized by watch queue.
> + */
> +
> +#define _FCNTL_H
> +
> +#include "tst_test.h"
> +#include "lapi/keyctl.h"
> +#include "common.h"
> +
> +static int *keep_polling;
> +
> +static void saw_key_updated(struct watch_notification *n, size_t len, unsigned int wtype)
> +{
> + if (wqueue_key_event(n, len, wtype, NOTIFY_KEY_UPDATED))
> + tst_res(TPASS, "keyctl update has been recognized");
> + else
> + tst_res(TFAIL, "keyctl update has not been recognized");
> +}
> +
> +static void setup(void)
> +{
> + keep_polling = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
> +}
> +
> +static void cleanup(void)
> +{
> + *keep_polling = 0;
> + SAFE_MUNMAP(keep_polling, sizeof(int));
> +}
> +
> +static void run(void)
> +{
> + int fd;
> + int pid;
> + key_serial_t key;
> +
> + fd = wqueue_watch(256, &wqueue_key_filter);
> + key = wqueue_add_key(fd);
> +
> + *keep_polling = 1;
> +
> + pid = SAFE_FORK();
> + if (pid > 0) {
> + wqueue_consumer(fd, keep_polling, saw_key_updated);
> + return;
> + }
Do we really need to run the part that reads the notification in a
separate process? For these single cases we can just do the keyctl and
then read from the pipe and check if there is anything in there.
> + safe_keyctl(KEYCTL_UPDATE, key, "b", 1);
> +
> + *keep_polling = 0;
> +
> + SAFE_CLOSE(fd);
> +}
> +
> +static struct tst_test test = {
> + .setup = setup,
> + .cleanup = cleanup,
> + .test_all = run,
> + .forks_child = 1
> +};
> --
> 2.34.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* [LTP] [PATCH v1 03/10] Add wqueue02 new test
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
2022-01-04 8:18 ` [LTP] [PATCH v1 01/10] Prepare watchqueue testing suite build Andrea Cervesato via ltp
2022-01-04 8:18 ` [LTP] [PATCH v1 02/10] Add wqueue01 new test Andrea Cervesato via ltp
@ 2022-01-04 8:18 ` Andrea Cervesato via ltp
2022-01-04 8:18 ` [LTP] [PATCH v1 04/10] Add wqueue03 " Andrea Cervesato via ltp
` (7 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2022-01-04 8:18 UTC (permalink / raw)
To: ltp
This test checks if KEYCTL_UNLINK is recognized by watch queue
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
testcases/kernel/watchqueue/wqueue02.c | 68 ++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 testcases/kernel/watchqueue/wqueue02.c
diff --git a/testcases/kernel/watchqueue/wqueue02.c b/testcases/kernel/watchqueue/wqueue02.c
new file mode 100644
index 000000000..2efefe90a
--- /dev/null
+++ b/testcases/kernel/watchqueue/wqueue02.c
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test if keyctl unlink is correctly recognized by watch queue.
+ */
+
+#define _FCNTL_H
+
+#include "tst_test.h"
+#include "lapi/keyctl.h"
+#include "common.h"
+
+static int *keep_polling;
+
+static void saw_key_unlinked(struct watch_notification *n, size_t len, unsigned int wtype)
+{
+ if (wqueue_key_event(n, len, wtype, NOTIFY_KEY_UNLINKED))
+ tst_res(TPASS, "keyctl unlink has been recognized");
+ else
+ tst_res(TFAIL, "keyctl unlink has not been recognized");
+}
+
+static void setup(void)
+{
+ keep_polling = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+}
+
+static void cleanup(void)
+{
+ *keep_polling = 0;
+ SAFE_MUNMAP(keep_polling, sizeof(int));
+}
+
+static void run(void)
+{
+ int fd;
+ int pid;
+ key_serial_t key;
+
+ fd = wqueue_watch(256, &wqueue_key_filter);
+ key = wqueue_add_key(fd);
+
+ *keep_polling = 1;
+
+ pid = SAFE_FORK();
+ if (pid > 0) {
+ wqueue_consumer(fd, keep_polling, saw_key_unlinked);
+ return;
+ }
+
+ safe_keyctl(KEYCTL_UNLINK, key, KEY_SPEC_SESSION_KEYRING);
+
+ *keep_polling = 0;
+
+ SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+ .setup = setup,
+ .cleanup = cleanup,
+ .test_all = run,
+ .forks_child = 1
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread* [LTP] [PATCH v1 04/10] Add wqueue03 new test
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
` (2 preceding siblings ...)
2022-01-04 8:18 ` [LTP] [PATCH v1 03/10] Add wqueue02 " Andrea Cervesato via ltp
@ 2022-01-04 8:18 ` Andrea Cervesato via ltp
2022-01-04 8:18 ` [LTP] [PATCH v1 05/10] Add wqueue04 " Andrea Cervesato via ltp
` (6 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2022-01-04 8:18 UTC (permalink / raw)
To: ltp
This test checks if KEYCTL_REVOKE event is recognized by watch queue
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
testcases/kernel/watchqueue/wqueue03.c | 68 ++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 testcases/kernel/watchqueue/wqueue03.c
diff --git a/testcases/kernel/watchqueue/wqueue03.c b/testcases/kernel/watchqueue/wqueue03.c
new file mode 100644
index 000000000..a4bbdadcd
--- /dev/null
+++ b/testcases/kernel/watchqueue/wqueue03.c
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test if keyctl revoke is correctly recognized by watch queue.
+ */
+
+#define _FCNTL_H
+
+#include "tst_test.h"
+#include "lapi/keyctl.h"
+#include "common.h"
+
+static int *keep_polling;
+
+static void saw_key_revoked(struct watch_notification *n, size_t len, unsigned int wtype)
+{
+ if (wqueue_key_event(n, len, wtype, NOTIFY_KEY_REVOKED))
+ tst_res(TPASS, "keyctl revoke has been recognized");
+ else
+ tst_res(TFAIL, "keyctl revoke has not been recognized");
+}
+
+static void setup(void)
+{
+ keep_polling = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+}
+
+static void cleanup(void)
+{
+ *keep_polling = 0;
+ SAFE_MUNMAP(keep_polling, sizeof(int));
+}
+
+static void run(void)
+{
+ int fd;
+ int pid;
+ key_serial_t key;
+
+ fd = wqueue_watch(256, &wqueue_key_filter);
+ key = wqueue_add_key(fd);
+
+ *keep_polling = 1;
+
+ pid = SAFE_FORK();
+ if (pid > 0) {
+ wqueue_consumer(fd, keep_polling, saw_key_revoked);
+ return;
+ }
+
+ safe_keyctl(KEYCTL_REVOKE, key);
+
+ *keep_polling = 0;
+
+ SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+ .setup = setup,
+ .cleanup = cleanup,
+ .test_all = run,
+ .forks_child = 1
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread* [LTP] [PATCH v1 05/10] Add wqueue04 new test
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
` (3 preceding siblings ...)
2022-01-04 8:18 ` [LTP] [PATCH v1 04/10] Add wqueue03 " Andrea Cervesato via ltp
@ 2022-01-04 8:18 ` Andrea Cervesato via ltp
2022-01-04 8:18 ` [LTP] [PATCH v1 06/10] Add wqueue05 " Andrea Cervesato via ltp
` (5 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2022-01-04 8:18 UTC (permalink / raw)
To: ltp
This test checks if KEYCTL_LINK event is recognized by watch queue
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
testcases/kernel/watchqueue/wqueue04.c | 68 ++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 testcases/kernel/watchqueue/wqueue04.c
diff --git a/testcases/kernel/watchqueue/wqueue04.c b/testcases/kernel/watchqueue/wqueue04.c
new file mode 100644
index 000000000..7d1bf375f
--- /dev/null
+++ b/testcases/kernel/watchqueue/wqueue04.c
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test if keyctl link is correctly recognized by watch queue.
+ */
+
+#define _FCNTL_H
+
+#include "tst_test.h"
+#include "lapi/keyctl.h"
+#include "common.h"
+
+static int *keep_polling;
+
+static void saw_key_linked(struct watch_notification *n, size_t len, unsigned int wtype)
+{
+ if (wqueue_key_event(n, len, wtype, NOTIFY_KEY_LINKED))
+ tst_res(TPASS, "keyctl link has been recognized");
+ else
+ tst_res(TFAIL, "keyctl link has not been recognized");
+}
+
+static void setup(void)
+{
+ keep_polling = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+}
+
+static void cleanup(void)
+{
+ *keep_polling = 0;
+ SAFE_MUNMAP(keep_polling, sizeof(int));
+}
+
+static void run(void)
+{
+ int fd;
+ int pid;
+ key_serial_t key;
+
+ fd = wqueue_watch(256, &wqueue_key_filter);
+ key = wqueue_add_key(fd);
+
+ *keep_polling = 1;
+
+ pid = SAFE_FORK();
+ if (pid > 0) {
+ wqueue_consumer(fd, keep_polling, saw_key_linked);
+ return;
+ }
+
+ safe_keyctl(KEYCTL_LINK, key, KEY_SPEC_SESSION_KEYRING);
+
+ *keep_polling = 0;
+
+ SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+ .setup = setup,
+ .cleanup = cleanup,
+ .test_all = run,
+ .forks_child = 1
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread* [LTP] [PATCH v1 06/10] Add wqueue05 new test
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
` (4 preceding siblings ...)
2022-01-04 8:18 ` [LTP] [PATCH v1 05/10] Add wqueue04 " Andrea Cervesato via ltp
@ 2022-01-04 8:18 ` Andrea Cervesato via ltp
2022-01-04 8:18 ` [LTP] [PATCH v1 07/10] Add wqueue06 " Andrea Cervesato via ltp
` (4 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2022-01-04 8:18 UTC (permalink / raw)
To: ltp
This test checks if KEYCTL_INVALIDATE is recognized by watch queue
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
testcases/kernel/watchqueue/wqueue05.c | 68 ++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 testcases/kernel/watchqueue/wqueue05.c
diff --git a/testcases/kernel/watchqueue/wqueue05.c b/testcases/kernel/watchqueue/wqueue05.c
new file mode 100644
index 000000000..9dbf5102f
--- /dev/null
+++ b/testcases/kernel/watchqueue/wqueue05.c
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test if keyctl invalidate is correctly recognized by watch queue.
+ */
+
+#define _FCNTL_H
+
+#include "tst_test.h"
+#include "lapi/keyctl.h"
+#include "common.h"
+
+static int *keep_polling;
+
+static void saw_key_invalidated(struct watch_notification *n, size_t len, unsigned int wtype)
+{
+ if (wqueue_key_event(n, len, wtype, NOTIFY_KEY_INVALIDATED))
+ tst_res(TPASS, "keyctl invalidate has been recognized");
+ else
+ tst_res(TFAIL, "keyctl invalidate has not been recognized");
+}
+
+static void setup(void)
+{
+ keep_polling = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+}
+
+static void cleanup(void)
+{
+ *keep_polling = 0;
+ SAFE_MUNMAP(keep_polling, sizeof(int));
+}
+
+static void run(void)
+{
+ int fd;
+ int pid;
+ key_serial_t key;
+
+ fd = wqueue_watch(256, &wqueue_key_filter);
+ key = wqueue_add_key(fd);
+
+ *keep_polling = 1;
+
+ pid = SAFE_FORK();
+ if (pid > 0) {
+ wqueue_consumer(fd, keep_polling, saw_key_invalidated);
+ return;
+ }
+
+ safe_keyctl(KEYCTL_INVALIDATE, key);
+
+ *keep_polling = 0;
+
+ SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+ .setup = setup,
+ .cleanup = cleanup,
+ .test_all = run,
+ .forks_child = 1
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread* [LTP] [PATCH v1 07/10] Add wqueue06 new test
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
` (5 preceding siblings ...)
2022-01-04 8:18 ` [LTP] [PATCH v1 06/10] Add wqueue05 " Andrea Cervesato via ltp
@ 2022-01-04 8:18 ` Andrea Cervesato via ltp
2022-01-04 8:18 ` [LTP] [PATCH v1 08/10] Add wqueue07 " Andrea Cervesato via ltp
` (3 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2022-01-04 8:18 UTC (permalink / raw)
To: ltp
This test checks if KEYCTL_CLEAR is recognized by watch queue
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
testcases/kernel/watchqueue/wqueue06.c | 67 ++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
create mode 100644 testcases/kernel/watchqueue/wqueue06.c
diff --git a/testcases/kernel/watchqueue/wqueue06.c b/testcases/kernel/watchqueue/wqueue06.c
new file mode 100644
index 000000000..bb3f234f6
--- /dev/null
+++ b/testcases/kernel/watchqueue/wqueue06.c
@@ -0,0 +1,67 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test if keyctl clear is correctly recognized by watch queue.
+ */
+
+#define _FCNTL_H
+
+#include "tst_test.h"
+#include "lapi/keyctl.h"
+#include "common.h"
+
+static int *keep_polling;
+
+static void saw_key_cleared(struct watch_notification *n, size_t len, unsigned int wtype)
+{
+ if (wqueue_key_event(n, len, wtype, NOTIFY_KEY_CLEARED))
+ tst_res(TPASS, "keyctl clear has been recognized");
+ else
+ tst_res(TFAIL, "keyctl clear has not been recognized");
+}
+
+static void setup(void)
+{
+ keep_polling = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+}
+
+static void cleanup(void)
+{
+ *keep_polling = 0;
+ SAFE_MUNMAP(keep_polling, sizeof(int));
+}
+
+static void run(void)
+{
+ int fd;
+ int pid;
+
+ fd = wqueue_watch(256, &wqueue_key_filter);
+ wqueue_add_key(fd);
+
+ *keep_polling = 1;
+
+ pid = SAFE_FORK();
+ if (pid > 0) {
+ wqueue_consumer(fd, keep_polling, saw_key_cleared);
+ return;
+ }
+
+ safe_keyctl(KEYCTL_CLEAR, KEY_SPEC_SESSION_KEYRING);
+
+ *keep_polling = 0;
+
+ SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+ .setup = setup,
+ .cleanup = cleanup,
+ .test_all = run,
+ .forks_child = 1
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread* [LTP] [PATCH v1 08/10] Add wqueue07 new test
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
` (6 preceding siblings ...)
2022-01-04 8:18 ` [LTP] [PATCH v1 07/10] Add wqueue06 " Andrea Cervesato via ltp
@ 2022-01-04 8:18 ` Andrea Cervesato via ltp
2022-01-04 8:18 ` [LTP] [PATCH v1 09/10] Add wqueue08 " Andrea Cervesato via ltp
` (2 subsequent siblings)
10 siblings, 0 replies; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2022-01-04 8:18 UTC (permalink / raw)
To: ltp
This test checks if KEYCTL_SETPERM is recognized by watch queue
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
testcases/kernel/watchqueue/wqueue07.c | 68 ++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 testcases/kernel/watchqueue/wqueue07.c
diff --git a/testcases/kernel/watchqueue/wqueue07.c b/testcases/kernel/watchqueue/wqueue07.c
new file mode 100644
index 000000000..99b3c9e70
--- /dev/null
+++ b/testcases/kernel/watchqueue/wqueue07.c
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test if keyctl setperm is correctly recognized by watch queue.
+ */
+
+#define _FCNTL_H
+
+#include "tst_test.h"
+#include "lapi/keyctl.h"
+#include "common.h"
+
+static int *keep_polling;
+
+static void saw_key_setattr(struct watch_notification *n, size_t len, unsigned int wtype)
+{
+ if (wqueue_key_event(n, len, wtype, NOTIFY_KEY_SETATTR))
+ tst_res(TPASS, "keyctl setattr has been recognized");
+ else
+ tst_res(TFAIL, "keyctl setattr has not been recognized");
+}
+
+static void setup(void)
+{
+ keep_polling = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+}
+
+static void cleanup(void)
+{
+ *keep_polling = 0;
+ SAFE_MUNMAP(keep_polling, sizeof(int));
+}
+
+static void run(void)
+{
+ int fd;
+ int pid;
+ key_serial_t key;
+
+ fd = wqueue_watch(256, &wqueue_key_filter);
+ key = wqueue_add_key(fd);
+
+ *keep_polling = 1;
+
+ pid = SAFE_FORK();
+ if (pid > 0) {
+ wqueue_consumer(fd, keep_polling, saw_key_setattr);
+ return;
+ }
+
+ safe_keyctl(KEYCTL_SETPERM, key, KEY_POS_ALL | KEY_USR_ALL);
+
+ *keep_polling = 0;
+
+ SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+ .setup = setup,
+ .cleanup = cleanup,
+ .test_all = run,
+ .forks_child = 1
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread* [LTP] [PATCH v1 09/10] Add wqueue08 new test
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
` (7 preceding siblings ...)
2022-01-04 8:18 ` [LTP] [PATCH v1 08/10] Add wqueue07 " Andrea Cervesato via ltp
@ 2022-01-04 8:18 ` Andrea Cervesato via ltp
2022-01-04 8:18 ` [LTP] [PATCH v1 10/10] Define watchqueue testing suite in runtest Andrea Cervesato via ltp
2022-01-04 11:38 ` [LTP] [PATCH v1 00/10] watchqueue testing suite Cyril Hrubis
10 siblings, 0 replies; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2022-01-04 8:18 UTC (permalink / raw)
To: ltp
This test checks if KEYCTL_WATCH_KEY event is recognized by watch queue
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
testcases/kernel/watchqueue/wqueue08.c | 83 ++++++++++++++++++++++++++
1 file changed, 83 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..202cc0274
--- /dev/null
+++ b/testcases/kernel/watchqueue/wqueue08.c
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2021 Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * [Description]
+ *
+ * Test if key watch removal is correctly recognized by watch queue.
+ */
+
+#define _FCNTL_H
+
+#include "tst_test.h"
+#include "lapi/keyctl.h"
+#include "common.h"
+
+static int *keep_polling;
+
+static struct watch_notification_filter meta_filter = {
+ .nr_filters = 1,
+ .__reserved = 0,
+ .filters = {
+ [0] = {
+ .type = WATCH_TYPE_META,
+ .subtype_filter[0] = UINT_MAX,
+ },
+ },
+};
+
+static void saw_watch_removal(struct watch_notification *n, 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 setup(void)
+{
+ keep_polling = SAFE_MMAP(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
+}
+
+static void cleanup(void)
+{
+ *keep_polling = 0;
+ SAFE_MUNMAP(keep_polling, sizeof(int));
+}
+
+static void run(void)
+{
+ int fd;
+ int pid;
+ key_serial_t key;
+
+ fd = wqueue_watch(256, &meta_filter);
+ key = wqueue_add_key(fd);
+
+ *keep_polling = 1;
+
+ pid = SAFE_FORK();
+ if (pid > 0) {
+ wqueue_consumer(fd, keep_polling, saw_watch_removal);
+ return;
+ }
+
+ /* if watch_id = -1 key is removed from the watch queue */
+ safe_keyctl(KEYCTL_WATCH_KEY, key, fd, -1);
+
+ *keep_polling = 0;
+
+ SAFE_CLOSE(fd);
+}
+
+static struct tst_test test = {
+ .setup = setup,
+ .cleanup = cleanup,
+ .test_all = run,
+ .forks_child = 1
+};
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread* [LTP] [PATCH v1 10/10] Define watchqueue testing suite in runtest
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
` (8 preceding siblings ...)
2022-01-04 8:18 ` [LTP] [PATCH v1 09/10] Add wqueue08 " Andrea Cervesato via ltp
@ 2022-01-04 8:18 ` Andrea Cervesato via ltp
2022-01-04 11:26 ` Cyril Hrubis
2022-01-04 11:38 ` [LTP] [PATCH v1 00/10] watchqueue testing suite Cyril Hrubis
10 siblings, 1 reply; 15+ messages in thread
From: Andrea Cervesato via ltp @ 2022-01-04 8:18 UTC (permalink / raw)
To: ltp
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
runtest/watchqueue | 8 ++++++++
scenario_groups/default | 1 +
2 files changed, 9 insertions(+)
create mode 100644 runtest/watchqueue
diff --git a/runtest/watchqueue b/runtest/watchqueue
new file mode 100644
index 000000000..badf7afb0
--- /dev/null
+++ b/runtest/watchqueue
@@ -0,0 +1,8 @@
+wqueue01 wqueue01
+wqueue02 wqueue02
+wqueue03 wqueue03
+wqueue04 wqueue04
+wqueue05 wqueue05
+wqueue06 wqueue06
+wqueue07 wqueue07
+wqueue08 wqueue08
diff --git a/scenario_groups/default b/scenario_groups/default
index 1dc2987d5..68bd5300d 100644
--- a/scenario_groups/default
+++ b/scenario_groups/default
@@ -30,3 +30,4 @@ cve
crypto
kernel_misc
uevent
+watchqueue
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [LTP] [PATCH v1 10/10] Define watchqueue testing suite in runtest
2022-01-04 8:18 ` [LTP] [PATCH v1 10/10] Define watchqueue testing suite in runtest Andrea Cervesato via ltp
@ 2022-01-04 11:26 ` Cyril Hrubis
0 siblings, 0 replies; 15+ messages in thread
From: Cyril Hrubis @ 2022-01-04 11:26 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi!
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> runtest/watchqueue | 8 ++++++++
> scenario_groups/default | 1 +
> 2 files changed, 9 insertions(+)
> create mode 100644 runtest/watchqueue
>
> diff --git a/runtest/watchqueue b/runtest/watchqueue
> new file mode 100644
> index 000000000..badf7afb0
> --- /dev/null
> +++ b/runtest/watchqueue
> @@ -0,0 +1,8 @@
> +wqueue01 wqueue01
> +wqueue02 wqueue02
> +wqueue03 wqueue03
> +wqueue04 wqueue04
> +wqueue05 wqueue05
> +wqueue06 wqueue06
> +wqueue07 wqueue07
> +wqueue08 wqueue08
> diff --git a/scenario_groups/default b/scenario_groups/default
> index 1dc2987d5..68bd5300d 100644
> --- a/scenario_groups/default
> +++ b/scenario_groups/default
> @@ -30,3 +30,4 @@ cve
> crypto
> kernel_misc
> uevent
> +watchqueue
I guess that I would do this in an incremental fashion as well. I.e. add
the watchqueue runtest file into the default fromp with wqueue01 in the
commit that adds the wqueue01 test.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [LTP] [PATCH v1 00/10] watchqueue testing suite
2022-01-04 8:18 [LTP] [PATCH v1 00/10] watchqueue testing suite Andrea Cervesato via ltp
` (9 preceding siblings ...)
2022-01-04 8:18 ` [LTP] [PATCH v1 10/10] Define watchqueue testing suite in runtest Andrea Cervesato via ltp
@ 2022-01-04 11:38 ` Cyril Hrubis
10 siblings, 0 replies; 15+ messages in thread
From: Cyril Hrubis @ 2022-01-04 11:38 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi!
> described in https://www.kernel.org/doc/html/latest/watch_queue.html
>
> Andrea Cervesato (10):
> Prepare watchqueue testing suite build
> Add wqueue01 new test
> Add wqueue02 new test
> Add wqueue03 new test
> Add wqueue04 new test
> Add wqueue05 new test
> Add wqueue06 new test
> Add wqueue07 new test
> Add wqueue08 new test
Minus the issues I've pointed out this looks like a good basic tests.
What is missing are all the more interesting cases, just by looking at
the API these are at least:
- check that we can filter out events correctly
(both for type and subtype)
- test that fills up the queue on purpose, i.e. generates events and
does not read back until its full, you should get special event if
WATCH_META_LOSS_NOTIFICATION is set
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 15+ messages in thread