Received: by 10.192.165.148 with SMTP id m20csp682963imm; Fri, 4 May 2018 18:18:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrvvsz5okUSalZNJwVFHbgcKO5G9ahjIGBnwgPr4qjiOHYKrNDNQL4x6ePAKNp9Jfuhfs1w X-Received: by 2002:a17:902:7582:: with SMTP id j2-v6mr11993140pll.65.1525483090682; Fri, 04 May 2018 18:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525483090; cv=none; d=google.com; s=arc-20160816; b=pEJKPTubj5NnHFAuOrf7tV0R9HsyFCjL2kqRZtIEWuOBTRusyyzAdQhYNwFvUDSSaQ dF3HaMPTmr99egAFwLLDLvr9HLxN61CE4sLMoGCbW46PcmVo+P/qnt3mKeCRAOmROE7z kXTY+7oeUiiIyCISB+QzHCW46mo7sez7nkKTzTOgw5YuDAMczJywW3uZ+njZ2rZHO8r8 QYW7YoqTpaxYRlNDbJ87I/sKQUs9u+jOSTUbLfRYKQx8UY1taWf4tqfa+gaxjYMtCPt0 9IGg2xe1hXXVsaR2PDer+3mbaVNTALd/TNpKDd+HbM79YHrZ8JiEhe3DqnP0N2GHh4ob sHtg== 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=7OtgajWI/qlRo+1irtc73twpUZo3zuZARY7c3elW/4A=; b=VIm1YstPFgqdSiNc1+WKyoKivQ3zFSW8cZEiTaOeURNFNcEIOPPHSnHF2fmIAztdZc 40vy00YaeuVp/1uUKyjn46biSM/zAKetcCFpUUZ8Gi14dWVb/udvhiHqme8OAFAx5EJX MsF/plATgCbsbsP9UVRI/lQ8vnIiqIdgfbjBOcKPwZ4+OBePV1Hr8l+cQiR7CZk6NXiw fvFUbQ3HEnCMGqPYNpsk3swQ8lRxVmNt9RbYGD2gtkqRIus/374Rz8VbBfG2ucbDl9JX g+l/AcPMl8BuF4g0XgwCTdNtv7/8ax1JPHhrFUl1+QzUCy4okzGmsw+V3YPtONCnj0A6 LQig== 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 z3-v6si6636182plb.246.2018.05.04.18.17.56; Fri, 04 May 2018 18:18:10 -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 S1752230AbeEEBRX (ORCPT + 99 others); Fri, 4 May 2018 21:17:23 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:50602 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752066AbeEEBRV (ORCPT ); Fri, 4 May 2018 21:17:21 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 927DD21075; Sat, 5 May 2018 01:17:20 +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 y51F0bvAQG6Y; Sat, 5 May 2018 01:17:20 +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 233F920E18; Sat, 5 May 2018 01:17:15 +0000 (UTC) From: "Shuah Khan (Samsung OSG)" To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 19/24] selftests: media_tests: return Kselftest Skip code for skipped tests Date: Fri, 4 May 2018 19:13:23 -0600 Message-Id: <20180505011328.32078-19-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 media_tests 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/media_tests/Makefile | 3 ++- tools/testing/selftests/media_tests/media_device_open.c | 8 ++++---- tools/testing/selftests/media_tests/media_device_test.c | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/media_tests/Makefile b/tools/testing/selftests/media_tests/Makefile index c82cec2497de..60826d7d37d4 100644 --- a/tools/testing/selftests/media_tests/Makefile +++ b/tools/testing/selftests/media_tests/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 +# +CFLAGS += -I../ -I../../../../usr/include/ TEST_GEN_PROGS := media_device_test media_device_open video_device_test -all: $(TEST_GEN_PROGS) include ../lib.mk diff --git a/tools/testing/selftests/media_tests/media_device_open.c b/tools/testing/selftests/media_tests/media_device_open.c index a5ce5434bafd..93183a37b133 100644 --- a/tools/testing/selftests/media_tests/media_device_open.c +++ b/tools/testing/selftests/media_tests/media_device_open.c @@ -34,6 +34,8 @@ #include #include +#include "../kselftest.h" + int main(int argc, char **argv) { int opt; @@ -61,10 +63,8 @@ int main(int argc, char **argv) } } - if (getuid() != 0) { - printf("Please run the test as root - Exiting.\n"); - exit(-1); - } + if (getuid() != 0) + ksft_exit_skip("Please run the test as root - Exiting.\n"); /* Open Media device and keep it open */ fd = open(media_device, O_RDWR); diff --git a/tools/testing/selftests/media_tests/media_device_test.c b/tools/testing/selftests/media_tests/media_device_test.c index 421a367e4bb3..a4c6ad18cb5c 100644 --- a/tools/testing/selftests/media_tests/media_device_test.c +++ b/tools/testing/selftests/media_tests/media_device_test.c @@ -39,6 +39,8 @@ #include #include +#include "../kselftest.h" + int main(int argc, char **argv) { int opt; @@ -66,10 +68,8 @@ int main(int argc, char **argv) } } - if (getuid() != 0) { - printf("Please run the test as root - Exiting.\n"); - exit(-1); - } + if (getuid() != 0) + ksft_exit_skip("Please run the test as root - Exiting.\n"); /* Generate random number of interations */ srand((unsigned int) time(NULL)); -- 2.14.1