From patchwork Thu Feb 21 09:00:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158884 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp243189jaa; Thu, 21 Feb 2019 01:01:27 -0800 (PST) X-Google-Smtp-Source: AHgI3IbUKckgnZSxh2Nqhq2CeU72UmlfEZyweR4TJGiFTHXR9ZFebKQ0WAzf5M3V6x4wkWU84+IF X-Received: by 2002:a50:b49b:: with SMTP id w27mr14256097edd.54.1550739687799; Thu, 21 Feb 2019 01:01:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739687; cv=none; d=google.com; s=arc-20160816; b=iknwcDDQ89dej+/BK7V8C7mASo8mRY6f+S13IoW5p5zbk91qAVqePs7BbW/ukAhwTN 8HTgQSuMnT1ix46+wFgxtwaqU81b6f9fsFLihX59khbUBUgHhOKbNO2RyqwHmC01wnQH 4YhOwCmJoC1pt/yWwZEiYwAQY0eRSnfAWStDx5wx9xrWtwB9chPUyetcGu86c63iXjBq VNjK/VJkQJAMffVdnYSMqzKnhVKeLCaMd23Uyfy0Dhmef5E+Vh9v7VqrxeLaQNVcAiow slR87M2S/u1HDToPQnezAEDZncMVCHsRotm3rCWanpWsVV7kitECXo5jKgA8xayJBlQV DZbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=uV15JaRfNcVZPHzR50JH+vNND3PNc+N9SKItQeG/fbI=; b=cf77jX5VklIi+g0bwUwplzxY9YU9X4Rv4OnZj+Q5CVnx+HnYzrFixQ04JDKkrrETeY 0a9TrjcipytIvQ+aI9f5ecvWwW5hv408kZBmRtzXXcW9NkLWSPe+wqGX/oc841LeGRG5 NeuwPaEIXIZR+jKh5UcHmeS8WXwyECTB1aiqrkSbjOLKbl02Qn9mgh4yQrlp+9PInEsN GES7NNmsHlGmDn0PwQir8Hln8FEThtlVH7XO4chXFXxl+YflpXpfz+NgjddbUFlFfNNh g3PyRxfWZqSOjCJLZjKkBy/HOQB+pBqbeVBgagBeXsWC7MbSOJwq2DkKlict+FPU5CtN uB/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="vw/LmLGL"; spf=pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 213.254.12.146 as permitted sender) smtp.mailfrom="ltp-bounces+patch=linaro.org@lists.linux.it"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from picard.linux.it (picard.linux.it. [213.254.12.146]) by mx.google.com with ESMTPS id g22si5694401edc.58.2019.02.21.01.01.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 01:01:27 -0800 (PST) Received-SPF: pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 213.254.12.146 as permitted sender) client-ip=213.254.12.146; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="vw/LmLGL"; spf=pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 213.254.12.146 as permitted sender) smtp.mailfrom="ltp-bounces+patch=linaro.org@lists.linux.it"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4CB543EA1FF for ; Thu, 21 Feb 2019 10:01:26 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id 8D93F294AD8 for ; Thu, 21 Feb 2019 10:01:16 +0100 (CET) Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id B85CD10009A3 for ; Thu, 21 Feb 2019 10:01:12 +0100 (CET) Received: by mail-pl1-x629.google.com with SMTP id k2so4500217plt.3 for ; Thu, 21 Feb 2019 01:01:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w/ViXA5GeLRfZGvBFDtQksc5jmtqxw9b4xSBatCPGao=; b=vw/LmLGLFoge95V0Tippa3s0beX+FvfIoo88/2lUPH7gdbqBgVgGWuW/1mt7V3SnaW ndg9HZHbCqMQ4AW50nKtzaikcE2k3DkXW1vRQtpB+GEodOj7oryKikJi/aT9kzotXdqm S4upIvdjoP1e+MItdpszf0blAHDtYRyZgwrVHYck+nkI9P420G01t9zNaR/RCu+eckMp oRSUrT4Y1ouyBhFrJmTco9bqI8zp9jO4bkQaDldyFwr/GYq8uqMw46ZHKauB9X6Oe5KX 4GXCVX/nSQkjdzZq7YC6AmktxSs/gW+O+J6O91P4dV0dyCKsUoArMoIPatPT9D0QvSEM cUhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w/ViXA5GeLRfZGvBFDtQksc5jmtqxw9b4xSBatCPGao=; b=VGf6lg9A0IXg9ckt9SoLE60eOAu5uM/U1gs52JtBVxvNNTVhPDSU/EDd099MVcRWzW wIy9PifG+zqV5e/j/gv9WlxjGO73cVZXZ44BVg2+WZvvmVYNqiswt21L8ApeuPOucQzw D8COlMyzr7mJm5wCh4tLTo/E4qnNg4E453KVdCb4qrLfM0F0csXghcXCGCw936TTqtxf Tnyx0rQ7RyRyzzcBhgROuUBJ94zN3w2eSxgnHEk6doBkrA/XtCkua0SaNY/vYBJ7rR54 2GD4rmCXPL+g+ObtSh7tolGeP8W9+ct/KzEaAa1zFFACnEvq8kypmZCSmOt/bpe9CfOj pMKg== X-Gm-Message-State: AHQUAuaA+pLhp73cSjBCOCpw5kw8d8J5bG6WvEFh5ew12PgG5peD23sw wFdit8BcVGXGffvjbrX2vueAuQ== X-Received: by 2002:a17:902:14e:: with SMTP id 72mr41752004plb.287.1550739672271; Thu, 21 Feb 2019 01:01:12 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id v4sm27703948pff.77.2019.02.21.01.01.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Feb 2019 01:01:11 -0800 (PST) From: Sumit Garg To: chrubis@suse.cz, ltp@lists.linux.it Date: Thu, 21 Feb 2019 14:30:14 +0530 Message-Id: <1550739616-24054-8-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550739616-24054-1-git-send-email-sumit.garg@linaro.org> References: <1550739616-24054-1-git-send-email-sumit.garg@linaro.org> X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Cc: daniel.thompson@linaro.org Subject: [LTP] [PATCH v4 7/9] syscalls/fdatasync: add sync device test-case X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+patch=linaro.org@lists.linux.it Sender: "ltp" fdatasync03 tests to sync file data having large dirty file pages to block device. Also, it tests all supported filesystems on a test block device. Signed-off-by: Sumit Garg --- runtest/syscalls | 1 + testcases/kernel/syscalls/fdatasync/.gitignore | 1 + testcases/kernel/syscalls/fdatasync/fdatasync03.c | 60 +++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 testcases/kernel/syscalls/fdatasync/fdatasync03.c diff --git a/runtest/syscalls b/runtest/syscalls index 0d09509..aaad651 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -291,6 +291,7 @@ fcntl36_64 fcntl36_64 fdatasync01 fdatasync01 fdatasync02 fdatasync02 +fdatasync03 fdatasync03 fgetxattr01 fgetxattr01 fgetxattr02 fgetxattr02 diff --git a/testcases/kernel/syscalls/fdatasync/.gitignore b/testcases/kernel/syscalls/fdatasync/.gitignore index d1d3cba..dc56ad7 100644 --- a/testcases/kernel/syscalls/fdatasync/.gitignore +++ b/testcases/kernel/syscalls/fdatasync/.gitignore @@ -1,2 +1,3 @@ /fdatasync01 /fdatasync02 +/fdatasync03 diff --git a/testcases/kernel/syscalls/fdatasync/fdatasync03.c b/testcases/kernel/syscalls/fdatasync/fdatasync03.c new file mode 100644 index 0000000..d5c8ea9 --- /dev/null +++ b/testcases/kernel/syscalls/fdatasync/fdatasync03.c @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Sumit Garg + */ + +/* + * fdatasync03 + * + * It basically tests fdatasync() to sync test file data having large dirty + * file pages to block device. Also, it tests all supported filesystems on a + * test block device. + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include "tst_test.h" + +#define MNTPOINT "mnt_point" +#define TST_FILE MNTPOINT"/test" +#define TST_FILE_SIZE_MB 32 +#define SIZE_MB (1024*1024) +#define MODE 0644 + +static void verify_fdatasync(void) +{ + int fd; + unsigned long written; + + fd = SAFE_OPEN(TST_FILE, O_RDWR|O_CREAT, MODE); + + tst_dev_bytes_written(tst_device->dev); + + tst_fill_fd(fd, 0, SIZE_MB, TST_FILE_SIZE_MB); + + TEST(fdatasync(fd)); + + if (TST_RET) + tst_brk(TFAIL | TTERRNO, "fdatasync(fd) failed"); + + written = tst_dev_bytes_written(tst_device->dev); + + SAFE_CLOSE(fd); + + if (written >= SIZE_MB * TST_FILE_SIZE_MB) + tst_res(TPASS, "Test file data synced to device"); + else + tst_res(TFAIL, "Failed to sync test file data to device"); +} + +static struct tst_test test = { + .needs_root = 1, + .mount_device = 1, + .all_filesystems = 1, + .mntpoint = MNTPOINT, + .test_all = verify_fdatasync, +};