Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1887245ybz; Thu, 30 Apr 2020 07:14:24 -0700 (PDT) X-Google-Smtp-Source: APiQypJqOfBVa5d4GWruXdNUm/7cBOk1+OTXciNsGnOtft90RE3ovwna8T6GEaZj0QRIfWGN0CKy X-Received: by 2002:a17:907:11de:: with SMTP id va30mr2944327ejb.121.1588256064231; Thu, 30 Apr 2020 07:14:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588256064; cv=none; d=google.com; s=arc-20160816; b=QGVQ0U5rfdDer1m4ML9NgBUeHpo0WUd9DedGM4NdzjN/HpkertfnKnRRYc/QSlhV3O d+PCeyur2wtzXeLzDnOsupt/55Zxyot+dDq75iAWgjI93fB85qq7T0CwEWKSKQWGPLy0 VtMvsP8AwC72qev2sSBXVOKndv1B/rvFWsppSy9SMGgq2lkkEf3CiFAc0mpLLeQ8FkBB hbxBmqFJE7NJq/Y51H5rXDT+aecDzFd9c5p8g6Guj+gwUBs2NY97nUGirslLRu76dyOo iSK6dKu2D+ESWLiU4tq/zJO0BZA7laJf7zJXV2RWZ7bn7pmOQFxXDLfl5Vi4/h1rOKnn 34Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ASHmpfpxWPRqR7fNXAGAwJjuucJcdRPjoOdBa0yohYY=; b=jFCk8EECaMOidgAz4iIuxuxiXYKy/Hc53H9vnnVlRFmn56RSP/hpB17/dtcj1wVkBV dW5g83Wbj3JOIn2ou0lp44QD2jZrgRZMepqVvODOuAJoGdXJ+Oq07U6J4bLi2JSjUe7p MpceroxZzVItF21bAvVyHf0undpjOIiH0I16q3UczGBEiizMYQadi/WBONz8Sm9po00/ ur1LLOmt/dZDqBWiIyHWjNZphuJIwxmgHEu0aJwWlGT6YEb2Wf2hvnoWuusAUVQxHr6I GAzF/B06Lozx9WyLRz4ly7pkz7/GiKC4UiCtow03P5YduCfgb2NMqupJ2vvyR2ftgYMb KAFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kyqFvYQU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si5819955ejx.373.2020.04.30.07.13.56; Thu, 30 Apr 2020 07:14:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kyqFvYQU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728139AbgD3OMW (ORCPT + 99 others); Thu, 30 Apr 2020 10:12:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:59052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727896AbgD3NvH (ORCPT ); Thu, 30 Apr 2020 09:51:07 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26FA9208DB; Thu, 30 Apr 2020 13:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588254666; bh=/pCLZHYr2OmVi2mS3ZUGZ80/NyMpK1+qw2ThEw/BWPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kyqFvYQUobjjoTm5JRlekaeIUMb9T4lPXyVs0iORad78Ms5Gw3kTLTcTds3wOh7bt RQW49wo4smXX27ORanqfPuR7ZjLqDFZgIaESzpueC8AtqIrEAHaoT8xNddRvCdTtoR SRAjg2v7i6Nd+9nUUmacQWpxKuv0WfVT3MqHjI30= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tyler Hicks , Shuah Khan , Sasha Levin , linux-api@vger.kernel.org Subject: [PATCH AUTOSEL 5.6 19/79] selftests/ipc: Fix test failure seen after initial test run Date: Thu, 30 Apr 2020 09:49:43 -0400 Message-Id: <20200430135043.19851-19-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200430135043.19851-1-sashal@kernel.org> References: <20200430135043.19851-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tyler Hicks [ Upstream commit b87080eab4c1377706c113fc9c0157f19ea8fed1 ] 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 Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/ipc/msgque.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index 4c156aeab6b80..5ec4d9e18806c 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); -- 2.20.1