From patchwork Mon Apr 23 05:09:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10356143 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 5DC456038F for ; Mon, 23 Apr 2018 05:10:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FF83289AF for ; Mon, 23 Apr 2018 05:10:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43CC0289B4; Mon, 23 Apr 2018 05:10:03 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 A2B13289B3 for ; Mon, 23 Apr 2018 05:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751117AbeDWFJz (ORCPT ); Mon, 23 Apr 2018 01:09:55 -0400 Received: from mgwkm01.jp.fujitsu.com ([202.219.69.168]:34858 "EHLO mgwkm01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750786AbeDWFJy (ORCPT ); Mon, 23 Apr 2018 01:09:54 -0400 Received: from kw-mxoi1.gw.nic.fujitsu.com (unknown [192.168.231.131]) by mgwkm01.jp.fujitsu.com with smtp id 79f9_4a3d_c30d9e7d_d676_4b12_bb7f_1ce95510e55f; Mon, 23 Apr 2018 14:09:49 +0900 Received: from g01jpfmpwyt01.exch.g01.fujitsu.local (g01jpfmpwyt01.exch.g01.fujitsu.local [10.128.193.38]) by kw-mxoi1.gw.nic.fujitsu.com (Postfix) with ESMTP id 2196FAC00CE for ; Mon, 23 Apr 2018 14:09:49 +0900 (JST) Received: from g01jpexchyt36.g01.fujitsu.local (unknown [10.128.193.4]) by g01jpfmpwyt01.exch.g01.fujitsu.local (Postfix) with ESMTP id 2FCD56D663B for ; Mon, 23 Apr 2018 14:09:48 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: 67935a4a10be48d78e5c75b0c2491a92 Subject: [RFC PATCH v4 5/6] btrfs-progs: test: Add helper function to check if test user exists From: Misono Tomohiro To: linux-btrfs References: <70590827-0c29-75ea-5e43-2e53264b3d4c@jp.fujitsu.com> Message-ID: <5a4e94d8-297c-938d-ec9e-29a970a02d55@jp.fujitsu.com> Date: Mon, 23 Apr 2018 14:09:44 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <70590827-0c29-75ea-5e43-2e53264b3d4c@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 4b266c5b..76006efa 100644 --- a/tests/common +++ b/tests/common @@ -314,6 +314,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