From patchwork Thu Mar 15 08:15:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10284033 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 61EE3602C2 for ; Thu, 15 Mar 2018 08:16:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E3E726D08 for ; Thu, 15 Mar 2018 08:16:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41024288F3; Thu, 15 Mar 2018 08:16:02 +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 AB98626D08 for ; Thu, 15 Mar 2018 08:16:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751478AbeCOIP7 (ORCPT ); Thu, 15 Mar 2018 04:15:59 -0400 Received: from mgwym04.jp.fujitsu.com ([211.128.242.43]:60038 "EHLO mgwym04.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbeCOIP5 (ORCPT ); Thu, 15 Mar 2018 04:15:57 -0400 Received: from yt-mxoi1.gw.nic.fujitsu.com (unknown [192.168.229.67]) by mgwym04.jp.fujitsu.com with smtp id 5372_5472_1bd5e3af_4b4a_47af_8f74_ebfd63ddb87c; Thu, 15 Mar 2018 17:15:53 +0900 Received: from g01jpfmpwyt02.exch.g01.fujitsu.local (g01jpfmpwyt02.exch.g01.fujitsu.local [10.128.193.56]) by yt-mxoi1.gw.nic.fujitsu.com (Postfix) with ESMTP id EA633AC0234 for ; Thu, 15 Mar 2018 17:15:52 +0900 (JST) Received: from g01jpexchyt38.g01.fujitsu.local (unknown [10.128.193.4]) by g01jpfmpwyt02.exch.g01.fujitsu.local (Postfix) with ESMTP id 2004158436C for ; Thu, 15 Mar 2018 17:15:52 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: f84bdf8931064bca8bb343da3d9c6ae6 Subject: [RFC PATCH v2 7/8] btrfs-progs: test: Add helper function to check if test user exists From: "Misono, Tomohiro" To: linux-btrfs References: <226b6805-c5aa-c40d-4ea6-f81dc1b7de20@jp.fujitsu.com> Message-ID: <3ebafef6-45eb-a27a-644c-4bdd1ff09870@jp.fujitsu.com> Date: Thu, 15 Mar 2018 17:15:48 +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: <226b6805-c5aa-c40d-4ea6-f81dc1b7de20@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