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: 1044566 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="d0DoqJqE"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 443b6T07CVz9rxp for ; Tue, 19 Feb 2019 20:29:36 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 4D0783EA4FC for ; Tue, 19 Feb 2019 10:29:32 +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-Google-Smtp-Source: AHgI3IazrY9EZSm06bbnZobKe/3FEf1GZQybcPm+fUolE+VChLuhDTVRAw8C62ANd/JMopg+B4BDdQ== 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+incoming=patchwork.ozlabs.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, +};