From patchwork Mon Jan 21 16:33:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Mahoney X-Patchwork-Id: 10774193 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 DB3081390 for ; Mon, 21 Jan 2019 16:33:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB2B329385 for ; Mon, 21 Jan 2019 16:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF64F2970C; Mon, 21 Jan 2019 16:33:50 +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 7A0AD2972C for ; Mon, 21 Jan 2019 16:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730171AbfAUQdt (ORCPT ); Mon, 21 Jan 2019 11:33:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:46338 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730116AbfAUQdo (ORCPT ); Mon, 21 Jan 2019 11:33:44 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8266AAFB2 for ; Mon, 21 Jan 2019 16:33:43 +0000 (UTC) Received: from starscream.home.jeffm.io (starscream-1.home.jeffm.io [IPv6:2001:559:c0d4::1fe]) by mail.home.jeffm.io (Postfix) with ESMTPS id 9D2D881AD3EB; Mon, 21 Jan 2019 11:31:58 -0500 (EST) Received: by starscream.home.jeffm.io (Postfix, from userid 1000) id 24301265DA5; Mon, 21 Jan 2019 11:33:42 -0500 (EST) From: jeffm@suse.com To: fstests@vger.kernel.org Cc: Jeff Mahoney Subject: [PATCH 1/7] btrfs/010: don't run without /sys/fs/btrfs Date: Mon, 21 Jan 2019 11:33:10 -0500 Message-Id: <20190121163316.20616-1-jeffm@suse.com> X-Mailer: git-send-email 2.16.4 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff Mahoney Older kernels don't have /sys/fs/btrfs. btrfs/010 will happily run until it goes to check its work against sysfs and finds those files don't exist. This patch introduces a require check to ensure that the sysfs files are present before running. Signed-off-by: Jeff Mahoney Reviewed-by: Filipe Manana --- common/btrfs | 8 ++++++++ tests/btrfs/010 | 1 + 2 files changed, 9 insertions(+) diff --git a/common/btrfs b/common/btrfs index 26dc0bb9..f6513c06 100644 --- a/common/btrfs +++ b/common/btrfs @@ -89,6 +89,14 @@ _require_btrfs_fs_feature() _notrun "Feature $feat not supported by the available btrfs version" } +_require_btrfs_fs_sysfs() +{ + modprobe btrfs > /dev/null 2>&1 + [ -e /sys/fs/btrfs/features ] || \ + _notrun "Sysfs not supported by the available btrfs version" + +} + _check_btrfs_filesystem() { device=$1 diff --git a/tests/btrfs/010 b/tests/btrfs/010 index 1a5f0146..72b2c727 100755 --- a/tests/btrfs/010 +++ b/tests/btrfs/010 @@ -33,6 +33,7 @@ rm -f $seqres.full _supported_fs btrfs _supported_os Linux _require_test +_require_btrfs_fs_sysfs # Create 32k extents. All of these extents will be accounted as outstanding and # reserved.