From patchwork Tue Feb 19 09:28:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158701 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3447394jaa; Tue, 19 Feb 2019 01:29:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IZM/Nco/y14tT2kNfNhhzIiStECVXUMLDQGzjMOFdTcr1jex+Iq2dwM55Y9Gg78eaiFmJ8W X-Received: by 2002:a50:9938:: with SMTP id k53mr17660904edb.134.1550568576887; Tue, 19 Feb 2019 01:29:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550568576; cv=none; d=google.com; s=arc-20160816; b=0T6uxQh9qdHUKpsICJbPgjjaUU0CQeK6Xib5mk55CQgjaBr1YOwV2SWQuZCkyJx3V7 wwKDfGzSbQ6gUYtOodxKMlALcYRoJFwdram0CwnmofwLVDbkQcogtCOjBPJel3PZXo8R p847F/e/r2DeM09/ziMtlinzmfrN82x5qJNtGj29onQYclHOJoSD+BmANGY4XV6TcezD 9Vuqu8Ki7cPc3Il/46FwfePjVRZNtxapTptm8FLFNqrNq/dlQaEpKSsfQWHh0II6uuo+ T3Q54io7RxF8wR/t4MY8SK9vCfclXlCuiND6NV5jM2b8EtGuq32Z0u4333ra12Lwy11C GFXA== 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=/bpgNFEEEHFp3I4MMXNQdyMCGOvS5iUmikjSLkbeKh4=; b=D62Jv3/MPdur5IME9a8DZmwuK/3sraosYwzJVBf3EpKEbI68Wfu77S1vF9E4G0i5K8 e7TOwUXvlyIK+/FnuUKlELo/PPeVEvjBX28Jc+zFk0ZCUKbHW6PWPN19kS8qjMPFCWTc 1E8Lg54amejWo++aKg7MGTGb1QB554V3ykyYRRgFstq7Rr/SOy5x4r4ZgzhDyTx4CeCv GmGYuQNILi7EUiPr5rdNuU1an93wxyYaS9NREaZl3ZAy7ZjsHpISSZVR++tnlV4KZf8y 325jvC9Aap4x4o7tNYoDb/JInRc0n0bD3ossTu0vuSJLymSTsEwwfQjbKVnBcUVs+Dce lg5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=d0DoqJqE; 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 k22si243432ejz.317.2019.02.19.01.29.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 01:29:36 -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=d0DoqJqE; 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 CCC7C294AA7 for ; Tue, 19 Feb 2019 10:29:33 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id 5A8E73EA38B for ; Tue, 19 Feb 2019 10:29:18 +0100 (CET) Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 99BA2600BD5 for ; Tue, 19 Feb 2019 10:29:18 +0100 (CET) Received: by mail-pg1-x531.google.com with SMTP id r124so9870882pgr.3 for ; Tue, 19 Feb 2019 01:29:17 -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=LD/rTB9YoyOFPue5glYjkELhJJhqNxQ+N3hMvoqVil4=; b=d0DoqJqE/KTFSNErIE72nA1a/ltvrpeXwZ/GMUtYusAwt46uopCt5ba3kX8e/ZiOII SmXiIeVYdpP57UboPbjZNoM45Yc5HSXGlI6P5bmvHSimet2uMW8CUbHs3CUq39xNkOM5 2/5d8cAhXcqFdUjNqOX9ayon/tl91SbVtaLdW61/42fgMngDE+jw8ADTmNNEkTKYmL9n h2j9LryQERqKhyKpqRq46rhoJX5GqQ4eDCqvKL7yQ6fSvh6X94xfG2NQ6gCic1gEKAop 3Hd6bH19EPT8rycv7Peb9tJfg/N0WOOF+5qoHztGmHTCJBGTRhkHqtUKOUtsrG+9TU4X YGpQ== 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=LD/rTB9YoyOFPue5glYjkELhJJhqNxQ+N3hMvoqVil4=; b=H2xNBRFsqLN9csH1chuZNGCMLxk4VMNXy/3D2pn4Mh0nUiiw9/ect4doYwD/AKlfk9 nPIpsNzoExMBcErCnTuPly45fe5Rsz1bpuwudHRCffmZUt4QsccEEnx6KV/Jm0uQHElR Z7z2hTnrQE5cW1mwA9Fl+xKx8gIT0c5tmyEuPaitncppq+KOTGD9kZkKoJdB6LySTunA 2pty9IDS3lQBmQZQTHZnYZantstkMDZVUzNaq1yGZHVNq0tYn9MY5gVJKwbpH/hXzLjs Fk+l6fHvzMelhma2agenaVuwUMt9FgUbClxfwOh9ukwSpqIUtwgiRx+QpZC9fjZvlTiU 54Gg== X-Gm-Message-State: AHQUAuaoBf6Vsx/ze4kH4/QtrlWsXqsJuZskyED1UY3QZ7gugegleTIx WjBfZi/kAQ3dlw4bfpArQ7xerlyNyYb/pA== X-Received: by 2002:a63:4e1d:: with SMTP id c29mr23537957pgb.433.1550568555794; Tue, 19 Feb 2019 01:29:15 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id n19sm34442229pfg.67.2019.02.19.01.29.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Feb 2019 01:29:15 -0800 (PST) From: Sumit Garg To: ltp@lists.linux.it Date: Tue, 19 Feb 2019 14:58:17 +0530 Message-Id: <1550568500-10871-5-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-5.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-5.smtp.seeweb.it Cc: daniel.thompson@linaro.org Subject: [LTP] [PATCH v3 4/7] syscalls/fsync: 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" fsync04 tests to sync file 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/fsync/.gitignore | 1 + testcases/kernel/syscalls/fsync/fsync04.c | 61 ++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 testcases/kernel/syscalls/fsync/fsync04.c diff --git a/runtest/syscalls b/runtest/syscalls index dba0dee..0d09509 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -347,6 +347,7 @@ fstatfs02_64 fstatfs02_64 fsync01 fsync01 fsync02 fsync02 fsync03 fsync03 +fsync04 fsync04 ftruncate01 ftruncate01 ftruncate01_64 ftruncate01_64 diff --git a/testcases/kernel/syscalls/fsync/.gitignore b/testcases/kernel/syscalls/fsync/.gitignore index 3c694a4..4b5ea83 100644 --- a/testcases/kernel/syscalls/fsync/.gitignore +++ b/testcases/kernel/syscalls/fsync/.gitignore @@ -1,3 +1,4 @@ /fsync01 /fsync02 /fsync03 +/fsync04 diff --git a/testcases/kernel/syscalls/fsync/fsync04.c b/testcases/kernel/syscalls/fsync/fsync04.c new file mode 100644 index 0000000..72c73ce --- /dev/null +++ b/testcases/kernel/syscalls/fsync/fsync04.c @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Sumit Garg + */ + +/* + * fsync04 + * + * It basically tests fsync() to sync test file 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_fsync(void) +{ + int fd; + + fd = tst_sync_device_write(TST_FILE, TST_FILE_SIZE_MB); + + TEST(fsync(fd)); + if (TST_RET != 0) + tst_brk(TFAIL | TTERRNO, "fsync(fd) failed"); + + if (tst_sync_device_check(TST_FILE_SIZE_MB)) + tst_res(TPASS, "Test file synced to device"); + else + tst_res(TFAIL, "Failed to sync test file 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_fsync, +};