From patchwork Mon Jul 15 08:25:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11043493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F5D913BD for ; Mon, 15 Jul 2019 08:25:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30B4B20502 for ; Mon, 15 Jul 2019 08:25:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D2E42766D; Mon, 15 Jul 2019 08:25:33 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 56538223A1 for ; Mon, 15 Jul 2019 08:25:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729428AbfGOIZc (ORCPT ); Mon, 15 Jul 2019 04:25:32 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42504 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729416AbfGOIZb (ORCPT ); Mon, 15 Jul 2019 04:25:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nlXKDiRd1qdIM5E1T9QmSHdRExTedl+3MXeOc+zQ7pU=; b=W+DO42PJazAC5UgDtD5micMGr 9X6b36cLZw+HV4dwxLkmdPepdAO4aVrPeOIOIOu0iJlhDO7gsBIOfryW/eTJNatOAsqwe0eXE/bVu /hzroqkoCFD2R76QjBneXImWPFpWhQcKs7Z7ZSqUQqWL/tthqfAx+fBBQ1mxKNMZ9FpSIyIwlFoqR EKpPegS/0gP5S9NIXr5Eu1EJvbJkOc/Mx9sMjLJqfwIDOFba69UiK6S2WjDSZ12YQiz/2m6l33A48 jxydrlRz2zZlETreO0bEPtpai7J2Gp8DxJhPHqbClj1Yr57iTDGviwuFRid35ivgT+gdz3bDpZ0Sl cAwoQTHfg==; Received: from 089144194016.atnat0003.highway.a1.net ([89.144.194.16] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hmwIc-0004Ue-Lb for fstests@vger.kernel.org; Mon, 15 Jul 2019 08:25:31 +0000 From: Christoph Hellwig To: fstests@vger.kernel.org Subject: [PATCH 1/3] common/cgroup2: better error message if cgroup2 fs is not mounted Date: Mon, 15 Jul 2019 10:25:21 +0200 Message-Id: <20190715082523.18387-1-hch@lst.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Improve the _require_cgroup2 helper to print a more useful message if the cgroup2 fs is not mounted. Signed-off-by: Christoph Hellwig --- common/cgroup2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/cgroup2 b/common/cgroup2 index f89825e2..8833c9c8 100644 --- a/common/cgroup2 +++ b/common/cgroup2 @@ -4,9 +4,14 @@ export CGROUP2_PATH="${CGROUP2_PATH:-/sys/fs/cgroup}" _require_cgroup2() { + if [ `findmnt -d backward -n -o FSTYPE -f ${CGROUP2_PATH}` != "cgroup2" ]; then + _notrun "cgroup2 not mounted on ${CGROUP2_PATH}" + fi + if [ ! -f "${CGROUP2_PATH}/cgroup.subtree_control" ]; then _notrun "Test requires cgroup2 enabled" fi + if [[ ! $(cat ${CGROUP2_PATH}/cgroup.controllers) =~ $1 ]]; then _notrun "Cgroup2 doesn't support $1 controller $1" fi