Skip to contentSkip to conversation

selftests/ipc: skip msgque test when MSG_COPY is unsupported

PATCH Applied UYeol Jo 1 participant 1 message Feb 10 Kselftest

lore
Share & tools
lore

UYeol Jo

author
#0 lore raw

PATCH v2 1/1 selftests/ipc: skip msgque test when MSG_COPY is unsupported

msgque kselftest uses msgrcv(..., MSG_COPY) to copy messages. When the kernel is built without CONFIG_CHECKPOINT_RESTORE, prepare_copy() is stubbed out and msgrcv() returns -ENOSYS. The test currently reports this as a failure even though it is simply a missing feature/configuration.

Skip the test when msgrcv() fails with ENOSYS.

---
v2:
- Clarify in commit message why MSG_COPY returns -ENOSYS without CONFIG_CHECKPOINT_RESTORE (prepare_copy() stub).

 tools/testing/selftests/ipc/msgque.c | 3 +++
 1 file changed, 3 insertions(+)
tools/testing/selftests/ipc/msgque.c +3 -0
index e107379d185c..82f73cdae120 100644
@@ -161,6 +161,9 @@ int dump_queue(struct msgque_data *msgque)
 		ret = msgrcv(msgque->msq_id, &msgque->messages[i].mtype,
 				MAX_MSG_SIZE, i, IPC_NOWAIT | MSG_COPY);
 		if (ret < 0) {
+			if (errno == ENOSYS)
+				ksft_exit_skip("MSG_COPY not supported\n");
+
 			ksft_test_result_fail("Failed to copy IPC message: %m (%d)\n", errno);
 			return -errno;
 		}
Signature · 1 line
2.43.0