From patchwork Thu Jan 28 22:53:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8154911 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EDEA4BEEE5 for ; Thu, 28 Jan 2016 22:53:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C52220256 for ; Thu, 28 Jan 2016 22:53:33 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 3CEF820320 for ; Thu, 28 Jan 2016 22:53:32 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 313F71A1E13; Thu, 28 Jan 2016 14:53:32 -0800 (PST) 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]) by ml01.01.org (Postfix) with ESMTP id F104B1A2077 for ; Thu, 28 Jan 2016 14:53:30 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 28 Jan 2016 14:53:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,360,1449561600"; d="scan'208";a="903422124" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.136]) by fmsmga002.fm.intel.com with ESMTP; 28 Jan 2016 14:53:31 -0800 Subject: [ndctl PATCH 13/13] ndctl: test create-namespace From: Dan Williams To: linux-nvdimm@lists.01.org Date: Thu, 28 Jan 2016 14:53:06 -0800 Message-ID: <20160128225306.17855.25271.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20160128225157.17855.5190.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20160128225157.17855.5190.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.17 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Perform a basic check of the command line interface for creating and reconfiguring a namespace. Signed-off-by: Dan Williams --- Makefile.am | 2 +- test/create.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100755 test/create.sh diff --git a/Makefile.am b/Makefile.am index 63e7301e99b8..e613bc418b17 100644 --- a/Makefile.am +++ b/Makefile.am @@ -124,7 +124,7 @@ pkgconfig_DATA = lib/libndctl.pc EXTRA_DIST += lib/libndctl.pc.in CLEANFILES += lib/libndctl.pc -TESTS = test/libndctl test/dpa-alloc test/parent-uuid +TESTS = test/libndctl test/dpa-alloc test/parent-uuid test/create.sh check_PROGRAMS = test/libndctl test/dpa-alloc test/parent-uuid if ENABLE_DESTRUCTIVE diff --git a/test/create.sh b/test/create.sh new file mode 100755 index 000000000000..c49d15d455f5 --- /dev/null +++ b/test/create.sh @@ -0,0 +1,47 @@ +#!/bin/bash -x +DEV="" +NDCTL="./ndctl" +BUS="-b nfit_test.0" +json2var="s/[{}\",]//g; s/:/=/g" +SECTOR_SIZE="4096" + +set -e + +# setup (reset nfit_test dimms) +modprobe nfit_test +$NDCTL disable-region $BUS all +$NDCTL zero-labels $BUS all +$NDCTL enable-region $BUS all + +# create pmem +dev="x" +json=$($NDCTL create-namespace -t pmem -m raw) +eval $(echo $json | sed -e "$json2var") +[ $dev = "x" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "raw" ] && echo "fail: $LINENO" && exit 1 + +# convert pmem to memory mode +json=$($NDCTL create-namespace -m memory -f -e $dev) +eval $(echo $json | sed -e "$json2var") +[ $mode != "memory" ] && echo "fail: $LINENO" && exit 1 + +# convert pmem to sector mode +json=$($NDCTL create-namespace -m sector -l $SECTOR_SIZE -f -e $dev) +eval $(echo $json | sed -e "$json2var") +[ $sector_size != $SECTOR_SIZE ] && echo "fail: $LINENO" && exit 1 +[ $mode != "sector" ] && echo "fail: $LINENO" && exit 1 + +# create blk +dev="x" +json=$($NDCTL create-namespace -t blk -m raw) +eval $(echo $json | sed -e "$json2var") +[ $dev = "x" ] && echo "fail: $LINENO" && exit 1 +[ $mode != "raw" ] && echo "fail: $LINENO" && exit 1 + +# convert blk to sector mode +json=$($NDCTL create-namespace -m sector -l $SECTOR_SIZE -f -e $dev) +eval $(echo $json | sed -e "$json2var") +[ $sector_size != $SECTOR_SIZE ] && echo "fail: $LINENO" && exit 1 +[ $mode != "sector" ] && echo "fail: $LINENO" && exit 1 + +exit 0