Received: by 10.192.165.148 with SMTP id m20csp683585imm; Fri, 4 May 2018 18:19:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqlfqZS3mbFKnMDfLSI7ww4iAjQ5K589hpTIBQIH+gG6+iWLLkTsnzNzIEL7/wYFP1ZgPue X-Received: by 2002:a17:902:781:: with SMTP id 1-v6mr30090164plj.150.1525483145251; Fri, 04 May 2018 18:19:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525483145; cv=none; d=google.com; s=arc-20160816; b=eZLBRyVYZj5Ro+DsilGCfX8PNqCZOBXXnpY2+lLAjZVxwRrhXQGPxv5tqpLFCSB0FX H64C9voWHaAJOn2ZpEjEtMssVKZcDaZdmAZTOGJifCQiWQDEZ4quy/l9BeuwYZKrkoZa uMa4cJ4bC9XX4BOspsWmG2X8NBoKO+0ckczvN62llfnjNiiA0ryYNzezU4JHwJB3nOJt LR3tXBAZIvfSzt47vr923FCNJxVcrvcN1t4xWQiyNWPyeSdil7SqhiBjvPhhakwWPjEx pbcy7J2/fzQJ9rFb5WmE/sVkqfqLlMNLUSekJEqjvitMH4Fa7ktnoSgyxJNxLobXw4Gh vvRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=I/LMfQAQ50pwqu28yYOj7FZ1Gg5qNF8BTAdMLpSuslQ=; b=lQwe40W9OPOo1v0FiiTQYlYKzSC20Y3nTHVVGYeQ90UULFMGvdyBM++/JGf+kMOZJj 9OgnQ1EhJR/C/c14yYPZCS1TAk2Wyz/M2sneYhKmf6TXfuWZy2iELFZOkGqH4tTWBH+5 VGbOSMab5WZGEU6gVHj7ToEWdwKk9r46+BVf3tuie0GglXMo1jTXH0YjhnyY6AOLF4/N GxSSHBIC1sY9kxkLEzN44Bghgg2N8jgmRIDpDcH2f+AIXc5qs1Go37vay92Fm7nUnS0Y aIhFSTmgwiR4SjhZqDabVQ9zt6FPL+JRsNmbDGk9V9B+15xUSDDqxhEU6vqdpI3fAKho J9dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si17167084pfg.174.2018.05.04.18.18.51; Fri, 04 May 2018 18:19:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752339AbeEEBSQ (ORCPT + 99 others); Fri, 4 May 2018 21:18:16 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:50661 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752318AbeEEBSO (ORCPT ); Fri, 4 May 2018 21:18:14 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id A1B7A21249; Sat, 5 May 2018 01:18:13 +0000 (UTC) Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo02-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dHBYN2ZfWxPY; Sat, 5 May 2018 01:18:13 +0000 (UTC) Received: from localhost.localdomain (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 29F7F2108C; Sat, 5 May 2018 01:18:08 +0000 (UTC) From: "Shuah Khan (Samsung OSG)" To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 23/24] selftests: mqueue: return Kselftest Skip code for skipped tests Date: Fri, 4 May 2018 19:13:27 -0600 Message-Id: <20180505011328.32078-23-shuah@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180505011328.32078-1-shuah@kernel.org> References: <20180505011328.32078-1-shuah@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When mqueue test is skipped because of unmet dependencies and/or unsupported configuration, it exits with error which is treated as a fail by the Kselftest framework. This leads to false negative result even when the test could not be run. Change it to return kselftest skip code when a test gets skipped to clearly report that the test could not be run. Change it to use ksft_exit_skip() when the test is skipped. Signed-off-by: Shuah Khan (Samsung OSG) --- tools/testing/selftests/mqueue/mq_open_tests.c | 8 ++++---- tools/testing/selftests/mqueue/mq_perf_tests.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/mqueue/mq_open_tests.c b/tools/testing/selftests/mqueue/mq_open_tests.c index 677140aa25fd..9403ac01ba11 100644 --- a/tools/testing/selftests/mqueue/mq_open_tests.c +++ b/tools/testing/selftests/mqueue/mq_open_tests.c @@ -33,6 +33,8 @@ #include #include +#include "../kselftest.h" + static char *usage = "Usage:\n" " %s path\n" @@ -262,12 +264,10 @@ int main(int argc, char *argv[]) } } - if (getuid() != 0) { - fprintf(stderr, "Not running as root, but almost all tests " + if (getuid() != 0) + ksft_exit_skip("Not running as root, but almost all tests " "require root in order to modify\nsystem settings. " "Exiting.\n"); - exit(1); - } /* Find out what files there are for us to make tweaks in */ def_msgs = fopen(DEF_MSGS, "r+"); diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c index 8188f72de93c..b019e0b8221c 100644 --- a/tools/testing/selftests/mqueue/mq_perf_tests.c +++ b/tools/testing/selftests/mqueue/mq_perf_tests.c @@ -39,6 +39,8 @@ #include #include +#include "../kselftest.h" + static char *usage = "Usage:\n" " %s [-c #[,#..] -f] path\n" @@ -626,12 +628,10 @@ int main(int argc, char *argv[]) cpus_to_pin[0] = cpus_online - 1; } - if (getuid() != 0) { - fprintf(stderr, "Not running as root, but almost all tests " + if (getuid() != 0) + ksft_exit_skip("Not running as root, but almost all tests " "require root in order to modify\nsystem settings. " "Exiting.\n"); - exit(1); - } max_msgs = fopen(MAX_MSGS, "r+"); max_msgsize = fopen(MAX_MSGSIZE, "r+"); -- 2.14.1