From patchwork Thu Sep 28 07:41:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murphy Zhou X-Patchwork-Id: 9975427 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 5443B6034B for ; Thu, 28 Sep 2017 07:42:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45323294D0 for ; Thu, 28 Sep 2017 07:42:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3895D294D5; Thu, 28 Sep 2017 07:42:05 +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 DBF6C294D0 for ; Thu, 28 Sep 2017 07:42:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751857AbdI1HmE (ORCPT ); Thu, 28 Sep 2017 03:42:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49742 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751817AbdI1HmE (ORCPT ); Thu, 28 Sep 2017 03:42:04 -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 031282C4B81; Thu, 28 Sep 2017 07:42:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 031282C4B81 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.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 E966282717; Thu, 28 Sep 2017 07:42:02 +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 v6 4/4] generic/413: skip dax to nondax dio test if needed Date: Thu, 28 Sep 2017 15:41:40 +0800 Message-Id: <1506584500-867-5-git-send-email-xzhou@redhat.com> In-Reply-To: <1506584500-867-1-git-send-email-xzhou@redhat.com> References: <1506328847-1669-1-git-send-email-xzhou@redhat.com> <1506584500-867-1-git-send-email-xzhou@redhat.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.27]); Thu, 28 Sep 2017 07:42:04 +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 --- src/t_mmap_dio.c | 2 +- tests/generic/413 | 10 ++++++++++ 2 files changed, 11 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..d86747f 100755 --- a/tests/generic/413 +++ b/tests/generic/413 @@ -88,6 +88,16 @@ 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"