From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DC2DC43603 for ; Wed, 11 Dec 2019 15:20:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 178442465C for ; Wed, 11 Dec 2019 15:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077610; bh=V3+W7ZWCbX77NaZBAeU295+GDlSRMBaIq1zVLZZiujw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NqfjLIngQUH0O2umWYaeF6NjU6WWdBlhvqECUg9XTgMeOK/1PWReJhXEwOFpbl5jl TZHig/K+NTKtIYyiyz0meLUGQ07yEn5dkg1uZwQ8KHlTh4qyVUPjMNoM+jHq41ktLm sTHje2L5zkQ66Mb5lpsDZOYjzMjOx/SunuBX90d4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731919AbfLKPUI (ORCPT ); Wed, 11 Dec 2019 10:20:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:48970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732149AbfLKPT7 (ORCPT ); Wed, 11 Dec 2019 10:19:59 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4844224658; Wed, 11 Dec 2019 15:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077598; bh=V3+W7ZWCbX77NaZBAeU295+GDlSRMBaIq1zVLZZiujw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=poHivdjGMroeZXwEfls2jXF5YcLXikHd5x2JEK7BG9vaQqAI1ujXtieLR8LXyXTkY ogwnAJGJFhZ1YNHWRPQ9yQbZ9G2kR1cCq4fetkY3FNDnhVfOZoJPQxL8LaTfd7NI35 laEoVMmuVjhMovQ8uhsSJp6K11F9r7qpzSPLcP3I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tyrel Datwyler , Thiago Jung Bauermann , Breno Leitao , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 098/243] selftests/powerpc: Skip test instead of failing Date: Wed, 11 Dec 2019 16:04:20 +0100 Message-Id: <20191211150345.730535239@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150339.185439726@linuxfoundation.org> References: <20191211150339.185439726@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Breno Leitao [ Upstream commit eafcd8e3fbad4f426a40ed2b6a8c697c3a4ef36a ] Current core-pkey selftest fails if the test runs without privileges to write into the core pattern file (/proc/sys/kernel/core_pattern). This causes the test to fail and give the impression that the subsystem being tested is broken, when, in fact, the test is being executed without the proper privileges. This is the current error: test: core_pkey tags: git_version:v4.19-3-g9e3363be9bce-dirty Error writing to core_pattern file: Permission denied failure: core_pkey This patch simply skips this test if it runs without the proper privileges, avoiding this undesired failure. CC: Tyrel Datwyler CC: Thiago Jung Bauermann Signed-off-by: Breno Leitao Reviewed-by: Thiago Jung Bauermann Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- tools/testing/selftests/powerpc/ptrace/core-pkey.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/testing/selftests/powerpc/ptrace/core-pkey.c b/tools/testing/selftests/powerpc/ptrace/core-pkey.c index e23e2e199eb4e..d5c64fee032dc 100644 --- a/tools/testing/selftests/powerpc/ptrace/core-pkey.c +++ b/tools/testing/selftests/powerpc/ptrace/core-pkey.c @@ -352,10 +352,7 @@ static int write_core_pattern(const char *core_pattern) FILE *f; f = fopen(core_pattern_file, "w"); - if (!f) { - perror("Error writing to core_pattern file"); - return TEST_FAIL; - } + SKIP_IF_MSG(!f, "Try with root privileges"); ret = fwrite(core_pattern, 1, len, f); fclose(f); -- 2.20.1