summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/ipc/msgque.c
diff options
context:
space:
mode:
authorTyler Hicks <tyhicks@linux.microsoft.com>2020-04-13 15:21:45 -0500
committerShuah Khan <skhan@linuxfoundation.org>2020-04-14 10:24:28 -0600
commitb87080eab4c1377706c113fc9c0157f19ea8fed1 (patch)
treeea3d47e904c08036eaa8c75bb796e8548e24a481 /tools/testing/selftests/ipc/msgque.c
parentaaa2d92efe1f972567f1691b423ab8dc606ab3a9 (diff)
selftests/ipc: Fix test failure seen after initial test run
After successfully running the IPC msgque test once, subsequent runs result in a test failure: $ sudo ./run_kselftest.sh TAP version 13 1..1 # selftests: ipc: msgque # Failed to get stats for IPC queue with id 0 # Failed to dump queue: -22 # Bail out! # # Pass 0 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0 not ok 1 selftests: ipc: msgque # exit=1 The dump_queue() function loops through the possible message queue index values using calls to msgctl(kern_id, MSG_STAT, ...) where kern_id represents the index value. The first time the test is ran, the initial index value of 0 is valid and the test is able to complete. The index value of 0 is not valid in subsequent test runs and the loop attempts to try index values of 1, 2, 3, and so on until a valid index value is found that corresponds to the message queue created earlier in the test. The msgctl() syscall returns -1 and sets errno to EINVAL when invalid index values are used. The test failure is caused by incorrectly comparing errno to -EINVAL when cycling through possible index values. Fix invalid test failures on subsequent runs of the msgque test by correctly comparing errno values to a non-negated EINVAL. Fixes: 3a665531a3b7 ("selftests: IPC message queue copy feature test") Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/ipc/msgque.c')
-rw-r--r--tools/testing/selftests/ipc/msgque.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index 4c156aeab6b8..5ec4d9e18806 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -137,7 +137,7 @@ int dump_queue(struct msgque_data *msgque)
for (kern_id = 0; kern_id < 256; kern_id++) {
ret = msgctl(kern_id, MSG_STAT, &ds);
if (ret < 0) {
- if (errno == -EINVAL)
+ if (errno == EINVAL)
continue;
printf("Failed to get stats for IPC queue with id %d\n",
kern_id);