From patchwork Mon Jun 18 08:41:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10470193 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 05F236029B for ; Mon, 18 Jun 2018 08:41:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDAC028987 for ; Mon, 18 Jun 2018 08:41:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0D54289B0; Mon, 18 Jun 2018 08:41:26 +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 5E85328987 for ; Mon, 18 Jun 2018 08:41:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968107AbeFRIlN (ORCPT ); Mon, 18 Jun 2018 04:41:13 -0400 Received: from mgwym04.jp.fujitsu.com ([211.128.242.43]:28213 "EHLO mgwym04.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968215AbeFRIiT (ORCPT ); Mon, 18 Jun 2018 04:38:19 -0400 Received: from yt-mxoi2.gw.nic.fujitsu.com (unknown [192.168.229.69]) by mgwym04.jp.fujitsu.com with smtp id 5df2_19c9_57088af6_df27_4292_b4b1_6500de42f3b2; Mon, 18 Jun 2018 17:38:13 +0900 Received: from g01jpfmpwkw03.exch.g01.fujitsu.local (g01jpfmpwkw03.exch.g01.fujitsu.local [10.0.193.57]) by yt-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id DBA4EAC014C for ; Mon, 18 Jun 2018 17:38:11 +0900 (JST) Received: from g01jpexchkw33.g01.fujitsu.local (unknown [10.0.193.4]) by g01jpfmpwkw03.exch.g01.fujitsu.local (Postfix) with ESMTP id 18FB7BD6705 for ; Mon, 18 Jun 2018 17:38:11 +0900 (JST) Received: from luna3.soft.fujitsu.com (10.124.196.199) by g01jpexchkw33.g01.fujitsu.local (10.0.193.36) with Microsoft SMTP Server id 14.3.352.0; Mon, 18 Jun 2018 17:38:09 +0900 From: Misono Tomohiro To: Subject: [PATCH v2 18/20] btrfs-progs: test: Add helper function to check if test user exists Date: Mon, 18 Jun 2018 17:41:06 +0900 Message-ID: <339c1796299757d1feee11bb5d8faf3a2e93988b.1529310485.git.misono.tomohiro@jp.fujitsu.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: References: MIME-Version: 1.0 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: Misono Tomohiro --- tests/common | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/common b/tests/common index 7e4e09df..7a37a4cd 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