From patchwork Fri Sep 29 02:16:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murphy Zhou X-Patchwork-Id: 9977009 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 BCF8960311 for ; Fri, 29 Sep 2017 02:16:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A99AD29800 for ; Fri, 29 Sep 2017 02:16:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E77F29803; Fri, 29 Sep 2017 02:16:19 +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 3BD0D29800 for ; Fri, 29 Sep 2017 02:16:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751590AbdI2CQS (ORCPT ); Thu, 28 Sep 2017 22:16:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58772 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569AbdI2CQS (ORCPT ); Thu, 28 Sep 2017 22:16:18 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 323ECC057F93; Fri, 29 Sep 2017 02:16:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 323ECC057F93 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=xzhou@redhat.com Received: from localhost (dhcp-12-130.nay.redhat.com [10.66.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90F5E17D81; Fri, 29 Sep 2017 02:16:17 +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 v7] generic/413: skip dax to nondax dio test if needed Date: Fri, 29 Sep 2017 10:16:11 +0800 Message-Id: <1506651371-21608-1-git-send-email-xzhou@redhat.com> In-Reply-To: <1506584500-867-1-git-send-email-xzhou@redhat.com> References: <1506584500-867-1-git-send-email-xzhou@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 29 Sep 2017 02:16:18 +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 This test requires there is struct page backend for the testing dax device. But not all devices which support dax have that. So we give it a try, if it fails with EFAULT, which is the same errno with the wrong device situation, we skip this subtest. This is not perfect, but it's efficient. Many devices support dax, and there are more coming. It's nearly impossible to maintain an uniq way to detect struct page present for all kinds of devices modes. From testing perspectice, a testrun could cover this code path as a sanity check and avoid more unnecessary failires. If the device is compatible with the test, one more testrun will not hurt much. Signed-off-by: Xiong Zhou --- v7: split this patch from that unrelated series. minor comment fix. src/t_mmap_dio.c | 2 +- tests/generic/413 | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/t_mmap_dio.c b/src/t_mmap_dio.c index 6c8ca1a..73e7648 100644 --- a/src/t_mmap_dio.c +++ b/src/t_mmap_dio.c @@ -27,7 +27,7 @@ void err_exit(char *op, unsigned long len, char *s) { fprintf(stderr, "%s(%s) len %lu %s\n", op, strerror(errno), len, s); - exit(1); + exit(errno); } int main(int argc, char **argv) diff --git a/tests/generic/413 b/tests/generic/413 index a1cc514..311bdc2 100755 --- a/tests/generic/413 +++ b/tests/generic/413 @@ -88,6 +88,18 @@ t_nondax_to_dax() t_dax_to_nondax() { prep_files + + # dax to nondax dio needs struct page backend, which is + # not always available among various devices. Skip this + # subtest if EFAULT(14 Bad address) returned, which means + # probably the device is not compatible with this test. + # + src/t_mmap_dio $SCRATCH_MNT/tf_s $TEST_DIR/tf_d \ + $1 "test" > /dev/null 2>&1 + if [ $? -eq 14 ] ; then + return + fi + src/t_mmap_dio $SCRATCH_MNT/tf_s \ $TEST_DIR/tf_d $1 "dio dax to nondax"