Skip to contentSkip to conversation

testsuite/smokey: Fixing a registry leak of the posix_select test

PATCH Superseded Florian Bezdeka 2 participants 3 messages Aug 12, 2021 – Aug 13, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testsuite/smokey: Fixing a registry leak of the posix_select test

According to POSIX message queues have kernel persistence, which means they are not cleaned up until the next reboot.

The test has a mq_unlink() as "precondition", so it will clean up failed test runs silently but /proc/xenomai/registry/usage will still report a "leak" once the test has completed.

---
 testsuite/smokey/posix-select/posix-select.c | 2 ++
 1 file changed, 2 insertions(+)
testsuite/smokey/posix-select/posix-select.c +2 -0
index e9bf938b3..0a59e4968 100644
@@ -138,6 +138,8 @@ static int run_posix_select(struct smokey_test *t, int argc, char *const argv[])
 	usleep(300000);
 	smp_rmb();
 	ret = test_status;
+
+	mq_unlink("/select_test_mq");
 out:
 	pthread_join(tcb, NULL);
 	
Signature · 1 line
2.30.2
#1 lore raw
Quoted 18 lines · Florian Bezdeka

According to POSIX message queues have kernel persistence, which means they are not cleaned up until the next reboot.

The test has a mq_unlink() as "precondition", so it will clean up failed test runs silently but /proc/xenomai/registry/usage will still report a "leak" once the test has completed.

---
 testsuite/smokey/posix-select/posix-select.c | 2 ++
 1 file changed, 2 insertions(+)
testsuite/smokey/posix-select/posix-select.c +0 -0
index e9bf938b3..0a59e4968 100644

testsuite/smokey/posix-select/posix-select.c static int run_posix_select(struct smokey_test *t, int argc, char *const argv[]) · line 145

Quoted 8 lines
testsuite/smokey/posix-select/posix-select.c +2 -0
@@ -138,6 +138,8 @@ static int run_posix_select(struct smokey_test *t, int argc, char *const argv[])
 	usleep(300000);
 	smp_rmb();
 	ret = test_status;
+
+	mq_unlink("/select_test_mq");
 out:
 	pthread_join(tcb, NULL);
 

Why only cleaning up on successful runs, ie. why doing this before the "out:" label?

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 22 lines · Jan Kiszka
Quoted 21 lines · Florian Bezdeka

According to POSIX message queues have kernel persistence, which means they are not cleaned up until the next reboot.

The test has a mq_unlink() as "precondition", so it will clean up failed test runs silently but /proc/xenomai/registry/usage will still report a "leak" once the test has completed.

---
 testsuite/smokey/posix-select/posix-select.c | 2 ++
 1 file changed, 2 insertions(+)
testsuite/smokey/posix-select/posix-select.c +1 -0
index e9bf938b3..0a59e4968 100644
@@ -138,6 +138,8 @@ static int run_posix_select(struct smokey_test *t, int argc, char *const argv[])
 	usleep(300000);
 	smp_rmb();
 	ret = test_status;
+
Quoted 8 lines

testsuite/smokey/posix-select/posix-select.c static int run_posix_select(struct smokey_test *t, int argc, char *const argv[]) · line 145

Quoted 5 lines
testsuite/smokey/posix-select/posix-select.c +1 -0
+	mq_unlink("/select_test_mq");
 out:
 	pthread_join(tcb, NULL);
 

Why only cleaning up on successful runs, ie. why doing this before the "out:" label?

You are right, that's wrong. And we should wait for the tcb thread to finish as well. So kind of double fault. Testing v2...

Florian

Quoted 3 lines

Jan