From patchwork Sat Apr 1 19:27:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9658213 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 06D5B60349 for ; Sat, 1 Apr 2017 19:33:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED48928389 for ; Sat, 1 Apr 2017 19:33:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1ECC283ED; Sat, 1 Apr 2017 19:33:11 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no 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 9631D28389 for ; Sat, 1 Apr 2017 19:33:08 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9024121939310; Sat, 1 Apr 2017 12:33:08 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 9D3502193930C for ; Sat, 1 Apr 2017 12:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491075187; x=1522611187; h=subject:from:to:cc:date:message-id:mime-version: content-transfer-encoding; bh=G4g47k/Ft/o7PpHQ2nSpH2ps0nrASv2fGteuxsl/zCM=; b=hxbrlrZaLmQ2rOvi+EMj50M2MxoQ5VP8KkMkmeDcuCbvr5R1JxLRRDzB s/b3JyIrR17ZpsPYDOlITibXF4jfiw==; Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Apr 2017 12:33:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,259,1486454400"; d="scan'208";a="83180924" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.125]) by fmsmga005.fm.intel.com with ESMTP; 01 Apr 2017 12:33:07 -0700 Subject: [ndctl PATCH] test: fix kernel version detection in dax-errors.sh From: Dan Williams To: linux-nvdimm@lists.01.org Date: Sat, 01 Apr 2017 12:27:57 -0700 Message-ID: <149107487750.16325.8238092319248519520.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 Honor the KVER environment variable for overriding kernel version detection. Reported-by: Linda Knippers Signed-off-by: Dan Williams --- test/dax-errors.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/dax-errors.sh b/test/dax-errors.sh index a383b14fcd5e..25615df44180 100755 --- a/test/dax-errors.sh +++ b/test/dax-errors.sh @@ -23,14 +23,16 @@ err() { exit $rc } -eval $(uname -r | awk -F. '{print "maj="$1 ";" "min="$2}') -if [ $maj -lt 4 ]; then - echo "kernel $maj.$min lacks dax error handling" - exit $rc -elif [ $maj -eq 4 -a $min -lt 7 ]; then - echo "kernel $maj.$min lacks dax error handling" - exit $rc -fi +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.7" || { echo "kernel $KVER may lack dax error handling"; exit $rc; } set -e mkdir -p $MNT