From patchwork Wed Jul 19 18:33:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9852989 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 522B3602C8 for ; Wed, 19 Jul 2017 18:39:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35DC72223E for ; Wed, 19 Jul 2017 18:39:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27642223B3; Wed, 19 Jul 2017 18:39:55 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A09A12223E for ; Wed, 19 Jul 2017 18:39:54 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6116E21D1B286; Wed, 19 Jul 2017 11:37:59 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D997221D1B280 for ; Wed, 19 Jul 2017 11:37:57 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2017 11:39:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,381,1496127600"; d="scan'208";a="109779901" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.125]) by orsmga004.jf.intel.com with ESMTP; 19 Jul 2017 11:39:52 -0700 Subject: [ndctl PATCH 6/6] test: add multi-dax test From: Dan Williams To: linux-nvdimm@lists.01.org Date: Wed, 19 Jul 2017 11:33:27 -0700 Message-ID: <150048920777.12895.10251738236110732171.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <150048917662.12895.15953645444185664230.stgit@dwillia2-desk3.amr.corp.intel.com> References: <150048917662.12895.15953645444185664230.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Add a simple sanity check for multiple dax instances per libnvdimm-region support. This is known to fail with a sysfs duplicate filename warning on kernels prior to 4.13-final. Signed-off-by: Dan Williams --- test/Makefile.am | 1 + test/multi-dax.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100755 test/multi-dax.sh diff --git a/test/Makefile.am b/test/Makefile.am index 9353a34326c1..ac3547e22ccb 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -10,6 +10,7 @@ TESTS =\ clear.sh \ dax-errors.sh \ daxdev-errors.sh \ + multi-dax.sh \ btt-check.sh \ label-compat.sh \ blk-exhaust.sh diff --git a/test/multi-dax.sh b/test/multi-dax.sh new file mode 100755 index 000000000000..751f16f5b07b --- /dev/null +++ b/test/multi-dax.sh @@ -0,0 +1,61 @@ +#!/bin/bash -x + +# Copyright(c) 2015-2017 Intel Corporation. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +DEV="" +NDCTL="../ndctl/ndctl" +DAXCTL="../daxctl/daxctl" +BUS="-b nfit_test.0" +BUS1="-b nfit_test.1" +json2var="s/[{}\",]//g; s/:/=/g" +rc=77 + +err() { + rc=1 + echo "test/multi-dax: failed at line $1" + exit $rc +} + +check_min_kver() +{ + local ver="$1" + : "${KVER:=$(uname -r)}" + + [ -n "$ver" ] || return 1 + [[ "$ver" == "$(echo -e "$ver\n$KVER" | sort -V | head -1)" ]] +} + +check_min_kver "4.13" || { echo "kernel $KVER may lack multi-dax support"; exit $rc; } + +set -e +trap 'err $LINENO' ERR + +# setup (reset nfit_test dimms) +modprobe nfit_test +$NDCTL disable-region $BUS all +$NDCTL zero-labels $BUS all +$NDCTL enable-region $BUS all + +query=". | sort_by(.available_size) | reverse | .[0].dev" +region=$($NDCTL list $BUS -t pmem -Ri | jq -r "$query") + +json=$($NDCTL create-namespace $BUS -r $region -t pmem -m dax -a 4096 -s 16M) +chardev1=$(echo $json | jq ". | select(.mode == \"dax\") | .daxregion.devices[0].chardev") +json=$($NDCTL create-namespace $BUS -r $region -t pmem -m dax -a 4096 -s 16M) +chardev2=$(echo $json | jq ". | select(.mode == \"dax\") | .daxregion.devices[0].chardev") + +# cleanup +$NDCTL disable-region $BUS all +$NDCTL disable-region $BUS1 all +modprobe -r nfit_test + +exit 0