From patchwork Tue Feb 19 09:28:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158702 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3447468jaa; Tue, 19 Feb 2019 01:29:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IbdBwoY+TA5cm3nuc7rzv4t/kSRwouPMYEya/WT3gmLTx+mpm6P+M/4b68fwGQs5zwNHskX X-Received: by 2002:a50:ad1d:: with SMTP id y29mr12897431edc.225.1550568582539; Tue, 19 Feb 2019 01:29:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550568582; cv=none; d=google.com; s=arc-20160816; b=GRGgmRd0t3usNk5GBXi4nsVzYx0fFH/oMBWWV36+tTs0844FCCD5LwSu7cGKwAquO2 N+tt8xbcO/CPE6ZUzHTUTr4kEXNAq2esCSuz/gyl7wSVU2QGn4iB3SO3LWlbDu3ev+t2 e4MZcokn8Td8Q4f3fVQjp8srzNn5+nSdYS1fXFhFvP5mbDUXW7FJqcPVV+0IQBqQVDXe ryPyt37U1xPDPfCxI28oLwkdGiVmLuF6mJDQP5yU5F+Qsii4tBi0faFUJp3+MdkEN7Ph sNk+75X5/n3d6Jpb7M9hhHMh87vlsCWqpE0ZtB6Tv4hMnMRXPQWpQm6cvgPUutOroU30 LguA== 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=YE0jVa7qcw49E5dD/oePcxgPdOLhpxu8KyBrDn8zgws=; b=TwYWE0t/yFHkEftnCDcDpUuLcBACWHKG4+5H3BxsMS+kcFy2iQ/Z+apmF4T7LRElUO vIU8U5+GWGeaiwb1w/OUmMhb/Y7o21nAtWYBD8mNADIzxInbuC4MFAijsPfvg5OHptrk xWWcmnK9zaHmkpMnzT1iXYVNtx2oGHG0B3kLrq4jNMWD/cPhgc1XKu8W2VL9QKbOaOvn TOlZww588dR/2Nos8Ma86/AcCTSL4zq8//bDY2n+SO2xGGNTzGjbwU7I/WjK5e9lTO9l U77PBIa66enYxv2Vi/VlhdsPxuChW0oic0E0YxcaE8OV8YZRCr43mS7cenDDB0b2AFZ7 UXGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ivfCS04e; spf=pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 2001:1418:10:5::2 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. [2001:1418:10:5::2]) by mx.google.com with ESMTPS id l26si1470122ejs.214.2019.02.19.01.29.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 01:29:42 -0800 (PST) Received-SPF: pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 2001:1418:10:5::2 as permitted sender) client-ip=2001:1418:10:5::2; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ivfCS04e; spf=pass (google.com: domain of ltp-bounces+patch=linaro.org@lists.linux.it designates 2001:1418:10:5::2 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 BA864294B3C for ; Tue, 19 Feb 2019 10:29:37 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) by picard.linux.it (Postfix) with ESMTP id 427B6294AC6 for ; Tue, 19 Feb 2019 10:29:22 +0100 (CET) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 53DB11A0110D for ; Tue, 19 Feb 2019 10:29:21 +0100 (CET) Received: by mail-pf1-x42b.google.com with SMTP id a3so153073pff.11 for ; Tue, 19 Feb 2019 01:29:21 -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=wmr1/qCZ1lLEStQ3wRm8H/9TmqZUeN/r7DaqN3B+hU8=; b=ivfCS04eKN1K2jZ/QYzLW/aFJY0xggXeyGP2z5Ajte9qOGoToBI0su2BcHkVnG/+A2 v5Ub1PwbgAGbGUn0NzxKYT8n9pqi++QzV551N5rj2lfHUfBCpIWnun9SFtvum2GgZJC3 TPTY0rOnB+fLvvFgQdeK/67t2Tb9Qen9rsVVF9FJ/aqR+Uvdu90Lp+gyDr3mLG0PTY7o +B9uVuwspgkLH4kB3zNqpecH4eVht6mNjfWI68c+GeNLgUmny12a7DwI7Mxfc69OAX9m wRVb0PH4WD2CqdnNj/dvgxtLSG6u3fS/fEJtcVotV1oQkmjUiPu7TXHSTxSCNlB0J5Du ochg== 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=wmr1/qCZ1lLEStQ3wRm8H/9TmqZUeN/r7DaqN3B+hU8=; b=tMu72U538eNOZlQcYLvO+wgJRnoCP+MhtuGwXNwtjnlNnkb5ZFKxI4mCZHBMXrHGdi lPQsIde4pvz5SCIJ8oMh+Lry00Ke48SBvLypAT5wfxVWPclpEv20YeG2RwpHh6Zdfyvp MGXAJ0uTTvNBDoQP7STEHafUpZyjGhqPakUa5Bc53FXsK3XsCWuPatqAUqqoR/dpZ7UJ QGA/feG5xVQozu3uhvpkYQSfWNk5xiRwc2GpGrsVMPD7MUYzX2W0CPDBx1Z1Cy1jIPPd SQnPI0Is5K1VMb5wZ0PlyP+twavzu1nHW4DieZ++MEQ4ODo96eOl1PhDCbr2EvkHqAUS DbuQ== X-Gm-Message-State: AHQUAubs0J04txa0XSg3ofjU1wDTVRmt8Pm1IumLEVb30VOBWsWiih3B 7daiQQo/psUoWnPaS94yDExvV8X4Z7ujqg== X-Received: by 2002:a63:f201:: with SMTP id v1mr21870484pgh.232.1550568559643; Tue, 19 Feb 2019 01:29:19 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id n19sm34442229pfg.67.2019.02.19.01.29.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Feb 2019 01:29:19 -0800 (PST) From: Sumit Garg To: ltp@lists.linux.it Date: Tue, 19 Feb 2019 14:58:18 +0530 Message-Id: <1550568500-10871-6-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550568500-10871-1-git-send-email-sumit.garg@linaro.org> References: <1550568500-10871-1-git-send-email-sumit.garg@linaro.org> X-Virus-Scanned: clamav-milter 0.99.2 at in-3.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-3.smtp.seeweb.it Cc: daniel.thompson@linaro.org Subject: [LTP] [PATCH v3 5/7] 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 | 61 +++++++++++++++++++++++ 3 files changed, 63 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..3a4f694 --- /dev/null +++ b/testcases/kernel/syscalls/fdatasync/fdatasync03.c @@ -0,0 +1,61 @@ +// 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_sync_device.h" +#include "tst_test.h" + +#define MNTPOINT "mnt_point" +#define TST_FILE MNTPOINT"/test" +#define TST_FILE_SIZE_MB 32 + +static void verify_fdatasync(void) +{ + int fd; + + fd = tst_sync_device_write(TST_FILE, TST_FILE_SIZE_MB); + + TEST(fdatasync(fd)); + if (TST_RET != 0) + tst_brk(TFAIL | TTERRNO, "fdatasync(fd) failed"); + + if (tst_sync_device_check(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 void setup(void) +{ + tst_sync_device_init(tst_device->dev); +} + +static void cleanup(void) +{ + tst_sync_device_cleanup(); +} + +static struct tst_test test = { + .needs_root = 1, + .mount_device = 1, + .all_filesystems = 1, + .mntpoint = MNTPOINT, + .setup = setup, + .cleanup = cleanup, + .test_all = verify_fdatasync, +};