From patchwork Tue Mar 6 08:36:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10260949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 995576016D for ; Tue, 6 Mar 2018 08:36:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8945928EA3 for ; Tue, 6 Mar 2018 08:36:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E29328EA6; Tue, 6 Mar 2018 08:36:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25AAC28EA3 for ; Tue, 6 Mar 2018 08:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751024AbeCFIgo (ORCPT ); Tue, 6 Mar 2018 03:36:44 -0500 Received: from mgwkm02.jp.fujitsu.com ([202.219.69.169]:32832 "EHLO mgwkm02.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750801AbeCFIgn (ORCPT ); Tue, 6 Mar 2018 03:36:43 -0500 Received: from kw-mxauth.gw.nic.fujitsu.com (unknown [192.168.231.132]) by mgwkm02.jp.fujitsu.com with smtp id 2382_b338_2972bb8b_6b5b_47ba_80bb_ff1a8a2e1bc9; Tue, 06 Mar 2018 17:36:38 +0900 Received: from g01jpfmpwkw03.exch.g01.fujitsu.local (g01jpfmpwkw03.exch.g01.fujitsu.local [10.0.193.57]) by kw-mxauth.gw.nic.fujitsu.com (Postfix) with ESMTP id 019BFAC0059 for ; Tue, 6 Mar 2018 17:36:38 +0900 (JST) Received: from g01jpexchkw36.g01.fujitsu.local (unknown [10.0.193.4]) by g01jpfmpwkw03.exch.g01.fujitsu.local (Postfix) with ESMTP id 3453DBD66FF for ; Tue, 6 Mar 2018 17:36:37 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: 1ef8b41632694ffa8faec65fabfe1e90 Subject: [RFC PATCH 6/7] btrfs-progs: test: Add helper function to check if test user exists From: "Misono, Tomohiro" To: linux-btrfs References: <94a0bad6-d696-a72e-ba7b-287d1d442997@jp.fujitsu.com> Message-ID: <91cc562a-e44d-0aee-0336-edae0fc7c92b@jp.fujitsu.com> Date: Tue, 6 Mar 2018 17:36:33 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <94a0bad6-d696-a72e-ba7b-287d1d442997@jp.fujitsu.com> Content-Language: en-US X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Test user 'progs-test' will be used to test the behavior of normal user. In order to pass this check, add the user by "useradd -M progs-test". Note that progs-test should not have root privileges. Signed-off-by: Tomohiro Misono --- tests/common | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/common b/tests/common index fae30f1d..e8f7c061 100644 --- a/tests/common +++ b/tests/common @@ -307,6 +307,16 @@ check_global_prereq() fi } +check_testuser() +{ + id -u progs-test > /dev/null 2>&1 + if [ $? -ne 0 ]; then + _not_run "Need to add user \"progs-test\"" + fi + # Note that progs-test should not have root privileges + # otherwise test may not run as expected +} + check_image() { local image