From patchwork Mon Apr 10 06:05:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murphy Zhou X-Patchwork-Id: 9671985 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 B195F60244 for ; Mon, 10 Apr 2017 06:06:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A16E427D0C for ; Mon, 10 Apr 2017 06:06:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 943D327F94; Mon, 10 Apr 2017 06:06:02 +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=-6.9 required=2.0 tests=BAYES_00,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 3FB4127D0C for ; Mon, 10 Apr 2017 06:06:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751602AbdDJGGB (ORCPT ); Mon, 10 Apr 2017 02:06:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38702 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751087AbdDJGGB (ORCPT ); Mon, 10 Apr 2017 02:06:01 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE8BF4DAF8; Mon, 10 Apr 2017 06:05:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DE8BF4DAF8 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=xzhou@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DE8BF4DAF8 Received: from localhost (dhcp-12-130.nay.redhat.com [10.66.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48A9677DED; Mon, 10 Apr 2017 06:05:59 +0000 (UTC) From: Xiong Zhou To: fstests@vger.kernel.org Cc: ross.zwisler@linux.intel.com, dan.j.williams@intel.com, jmoyer@redhat.com, eguan@redhat.com, Xiong Zhou Subject: [PATCH v2 1/3] common: helper to get value from ndctl list by key Date: Mon, 10 Apr 2017 14:05:51 +0800 Message-Id: <1491804353-1326-1-git-send-email-xzhou@redhat.com> In-Reply-To: <20170407171600.GA29489@linux.intel.com> References: <20170407171600.GA29489@linux.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 10 Apr 2017 06:06:00 +0000 (UTC) Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For some nvdimm DAX related tests, it's better to know some details of devices being tested. Adding new prog ndctl to manage nvdimms and jq to parse outputs. Signed-off-by: Xiong Zhou --- v2: use _require_command instead of running cmds common/config | 2 ++ common/rc | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/common/config b/common/config index 59041a3..dfdcb8e 100644 --- a/common/config +++ b/common/config @@ -212,6 +212,8 @@ export XZ_PROG="`set_prog_path xz`" export FLOCK_PROG="`set_prog_path flock`" export LDD_PROG="`set_prog_path ldd`" export TIMEOUT_PROG="`set_prog_path timeout`" +export NDCTL_PROG="`set_prog_path ndctl`" +export JQ_PROG="`set_prog_path jq`" # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled. # newer systems have udevadm command but older systems like RHEL5 don't. diff --git a/common/rc b/common/rc index e1ab2c6..bc387cf 100644 --- a/common/rc +++ b/common/rc @@ -3148,6 +3148,25 @@ _require_chattr() rm -f $TEST_DIR/syscalltest.out } +_require_ndctl() +{ + _require_command "$NDCTL_PROG" ndctl +} + +_require_jq() +{ + _require_command "$JQ_PROG" jq +} + +# $1 SCRATCH_DEV or TEST_DEV or other dev +# $2 key +_ndctl_get_pmem_key_value() +{ + $NDCTL_PROG list | \ + $JQ_PROG -r ".[] | \ + select(.blockdev == \"${1#/dev/}\") | .$2" +} + _get_total_inode() { if [ -z "$1" ]; then