From patchwork Thu Feb 21 09:00:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158877 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp242542jaa; Thu, 21 Feb 2019 01:00:55 -0800 (PST) X-Google-Smtp-Source: AHgI3IZmcAP6K8or/DXtCD8jQqU7DEPrzp1az7dDZzGh7WSO3yupdsgdSfurdeGP4bvO8OC1wdGC X-Received: by 2002:a17:906:ca09:: with SMTP id jt9mr8472117ejb.74.1550739655848; Thu, 21 Feb 2019 01:00:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739655; cv=none; d=google.com; s=arc-20160816; b=GnSNbZOwYAyw4zAJ1/I3atH7dhIxVRiP1qY7r3MzlyxT3pi6QAHJf/ng1nVafNd5Wy CStWNI5NpyBNEQ9OcY2J0t8KvirHXYpxWURFlsQFBH2n7HuetjWsU5zrSq5ggAXvLFYD aC+aTGP46iPbKhnMzPF4Ita12t691DUSJVVkpX7SNxPFZcgjEQrgHq6rByqEjFLoYYs0 5Orfe2UdYUj/9UZNnyRuM1Wx4sWE2ri1rMGlznlPI11LD4hw/qBsWmyfHh76AXVOvdCz dfWgSx+jlXqEVwViGC2dBqiGuMWcOcGqCHy0MLQAx2b/mxrdHd7Ujhw7CWmXNb25xTp7 vjRw== 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=z8BecS6fLYQEJ00rmBESO9o72GCqvExk3JIxEsLBkPE=; b=A7HbnjQbfua+uLKEugt3AxK/rVEgT14VLiFEPSJrkmjqJIJ8BUiuf80bb02eT/MsaM t3YcnHqcaT2wbarIJchJMGqDAvWiSXe8r0W9SIBsCpbB6+pXw9C8R8GfA1wmd9bWjMva lZn1oHq1PYqTfy6zGNYZxC0ZTQYSloCAjH712X1LzMBQCFMd9at+bMdXzNhzg+M0GSfs RLgGfU+/TZERwbnu1kU8zH8Lrtr0A+gze3Nb4hvz16bAdwCp5sKYHDHcFcxXNBCgSF91 46nbuURePNqymPW2OZ2AqajBclkcHqU9k2XHjc50kYOhsS24Kh/28OR/obiaNqrVtzDC MnOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=P+hIUvQD; 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 gx17si1143646ejb.28.2019.02.21.01.00.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 01:00:55 -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=P+hIUvQD; 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 44B173EA293 for ; Thu, 21 Feb 2019 10:00:55 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) by picard.linux.it (Postfix) with ESMTP id 4A0ED3EA0CD for ; Thu, 21 Feb 2019 10:00:50 +0100 (CET) Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 10F5F201406 for ; Thu, 21 Feb 2019 10:00:50 +0100 (CET) Received: by mail-pg1-x544.google.com with SMTP id r11so13459945pgp.6 for ; Thu, 21 Feb 2019 01:00:49 -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=jNUd4eLku/WiUSnGz+4YUU68EW3EaILulUvnMGu8ipU=; b=P+hIUvQDvEScxNwr0L7JzQZ2R7srPPnydOwW1iub143St0Jivc2hOXhqEi0anbFuac 3lSfTdt90AZ4t7eQ2OmhJCWSBjzHsYSPY8Oam/1BS7ePEnh0V+IMkXcCBIDX5g+uFGnR 5YpGrQ/GiGn2G2pDBfcgaIqpgBAwghOQZA79Z2PDZut1OpKhd7UZ0FrVGMXOQm1O7+HU uPQ8WnfSmjnehOp+BLdeFZDJkANvPxPzoyLXOAfFcWizewIurrlulDeyS3grr3WU/7iR AoLXm699eZx3+dNG5EwwB/iQTCKQc/P2capnTxpfg/W39wvkfIfYjZbkhS0m7NyUSWKD vOjw== 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=jNUd4eLku/WiUSnGz+4YUU68EW3EaILulUvnMGu8ipU=; b=SOzHXyPaSDKLPOCikG+Ih1L4yDvDzrrUfnz4h2uVI4DytbjMAgMyKEBh4pIuARaRww gNi0qYo5/tqS1iEHVj/1W4ae6/nYG1Jw4ln3bTCb2FF0DoTXoXWzOpwk6Hpx6mCZa2io oYD0+TNiQ4sjOqp2n3dR2tHXNEY3ASdpUWTUZtJTaKWRoB+Yce1sD4qzij73H/utJexH LvYFQ8ArNwlYteIJSqxfexb9RxszXZeeYpVpRX6+1uR3Tz+der7oQ7YMuYsaHofpcUSr 2TAW3ju6rwtYBLc4WLfToEjTpMKjtdY1IgQVTvsneyjjHj6xwAlt2Qq8wpJpMwHM+KyA F7cg== X-Gm-Message-State: AHQUAuYY083/VKLbIwlmIRQlav1hAKyU5tTW3czI0DqR+fv2mXYfLu1z HX+5do10OKM83P8ILE6CxCj7Rg== X-Received: by 2002:a62:20c9:: with SMTP id m70mr38065032pfj.118.1550739648353; Thu, 21 Feb 2019 01:00:48 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id v4sm27703948pff.77.2019.02.21.01.00.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Feb 2019 01:00:47 -0800 (PST) From: Sumit Garg To: chrubis@suse.cz, ltp@lists.linux.it Date: Thu, 21 Feb 2019 14:30:08 +0530 Message-Id: <1550739616-24054-2-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-7.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-7.smtp.seeweb.it Cc: daniel.thompson@linaro.org Subject: [LTP] [PATCH v4 1/9] lib/tst_device: add new api tst_dev_bytes_written() 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" This api reads test block device stat file and returns the bytes written since the last invocation of this api. Signed-off-by: Sumit Garg --- include/tst_device.h | 7 +++++++ lib/tst_device.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/tst_device.h b/include/tst_device.h index 7ac2883..61902b7 100644 --- a/include/tst_device.h +++ b/include/tst_device.h @@ -44,4 +44,11 @@ int tst_umount(const char *path); */ int tst_clear_device(const char *dev); +/* + * Reads test block device stat file and returns the bytes written since the + * last call of this function. + * @dev: test block device + */ +unsigned long tst_dev_bytes_written(const char *dev); + #endif /* TST_DEVICE_H__ */ diff --git a/lib/tst_device.c b/lib/tst_device.c index fd4e277..65fcc13 100644 --- a/lib/tst_device.c +++ b/lib/tst_device.c @@ -45,6 +45,7 @@ static char dev_path[1024]; static int device_acquired; +static unsigned long prev_dev_sec_write; static const char *dev_variants[] = { "/dev/loop%i", @@ -364,3 +365,31 @@ int tst_umount(const char *path) errno = err; return -1; } + +unsigned long tst_dev_bytes_written(const char *dev) +{ + struct stat st; + unsigned long dev_sec_write = 0, dev_bytes_written, io_ticks = 0; + char dev_stat_path[1024]; + + snprintf(dev_stat_path, sizeof(dev_stat_path), "/sys/block/%s/stat", + strrchr(dev, '/') + 1); + + if (stat(dev_stat_path, &st) != 0) + tst_brkm(TCONF, NULL, "Test device stat file: %s not found", + dev_stat_path); + + SAFE_FILE_SCANF(NULL, dev_stat_path, + "%*s %*s %*s %*s %*s %*s %lu %*s %*s %lu", + &dev_sec_write, &io_ticks); + + if (!io_ticks) + tst_brkm(TCONF, NULL, "Test device stat file: %s broken", + dev_stat_path); + + dev_bytes_written = (dev_sec_write - prev_dev_sec_write) * 512; + + prev_dev_sec_write = dev_sec_write; + + return dev_bytes_written; +} From patchwork Thu Feb 21 09:00:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158879 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp242705jaa; Thu, 21 Feb 2019 01:01:05 -0800 (PST) X-Google-Smtp-Source: AHgI3IacRboVTiQQC/acXHHe1uEJAWXUDaSBp8ykhIuO8aagcFFxncDxq61+s2T2mQHDSz2eOgXd X-Received: by 2002:a17:906:c811:: with SMTP id cx17-v6mr26086928ejb.50.1550739665154; Thu, 21 Feb 2019 01:01:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739665; cv=none; d=google.com; s=arc-20160816; b=QB0IDyie3lt7BILWivJetUdM7Gv9p0OG0DOIrDQrFZjp0wuDiKOzcm85hcFqLya7bI ChAneph8vYhyU4f8Zv41IJgQRkriKreRk5EZvUHKmsDpoD2kAG7DHfv2W+/pQERJSrmL Ht/LjCYUKGf5bL0rmKZbQEo15S3EpV5656e2MTCmIOnVQnO9ps5B6Ph1307Fbn0/t6FA IJ/KFx03TEprdJdAGea42Z8o+YxGRCwbyZam/yzSGUdoQO03Mx1lIA1VFSFS01XUnobT lAZn/xsvyNaW+AO0cbEU6oAUG0HLU7ZVSGUbiSbSEWvax78x6YBBneEF5JrreHkphYIS urmQ== 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=WI/i8En7kEagnn6cKHHXseKEARZ4jrIgXbLLb4yMvtk=; b=SSNDUrE5eN/l2PqEXpoA++7asDGwNF8PVJPe+VlfZFMVYNV56zJ8NSIOMp//v4P0Sb NepoHVG962XWUxtnD8Od5nfIZ0nShByZwk7/aktGHSyTGD0yFtqBOjrBv7OlkVDwhKNR jcrOnMvcqCTCHe+H9tsEt640Dc8A5nZ6RiWrYrXFSPTCZfmds6Hm6S8v9IDJB/QZFv43 0eiBSdYs35hM1bMIEzvGyR/w4pqDPGlw9uRIilPD7KtYlWpTc02ZwMJLptzciJzJdVKi fHNB3ot8LOWnOoKY5XFTAxyI6c9YKtmqnhu3qqg6irlWjfM/i2XfzB43LsDiWKlXIrXg xAeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=rLo7nZwr; 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 p13si929815ejx.192.2019.02.21.01.01.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 01:01:05 -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=rLo7nZwr; 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 BB0EF294AA8 for ; Thu, 21 Feb 2019 10:01:04 +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 69AA93EA1DB for ; Thu, 21 Feb 2019 10:00:55 +0100 (CET) Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) (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 26462603451 for ; Thu, 21 Feb 2019 10:00:55 +0100 (CET) Received: by mail-pl1-x644.google.com with SMTP id p19so2623553plo.2 for ; Thu, 21 Feb 2019 01:00:53 -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=ku8aYMwyBI0tAVhQgpsiM/AWo/PIHRtI4J3ODZmAkWU=; b=rLo7nZwrDhcTOizA9R6JhNLMqt164OUtXP4S5+sjE3DPmseuZ6PtQQUVONs5jGDi7w Xjfv+gRvgmkB7cL/TzMvI0zbzXT+Kc3i1UDmL2fR47VTvp6BtfEqBr1XfJFIHHFE/Ogp yHS0Uyot1jnBdnDBje9VWrLm4hbXfZhmATQaLt7Ckdrhq6sYF/iXd6IYUlVEn5iwdFZS BBx/DI9fm2RePSm4htJd95CGMha1WTtkeQHFzIrx2XYJ/U8SBQgbYOgp75LgcYF99Bxc ltlvibIniirI4ehq8ykbIwIE3eIla9lGFRsKGW1LPbV3X63o/7/ppY31Z5MKiXpLywRz XOYA== 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=ku8aYMwyBI0tAVhQgpsiM/AWo/PIHRtI4J3ODZmAkWU=; b=rKEuN8qB5sFFlFiBvNLuAj2xuD4UwkT+31Dsj6SLxZMZZA8IMwQlWIZdeZwCcitH5G yg9X78ZcGF0o+bN+kuhls9Ky74/dYwigczmQxPZgtjQQKOzggEwMJpXM5sZkV9DCRb5j Ml/5k94r9qsXIs/xxzBSsOdZxdtZ/D8akhmuXApu0beKkLsumkap15MTcEB6qts8cjWQ dCNS+lVsDgg90ZHKYcXj1M7Xq0rJvNR3J2jCa5ookTJGwK6NGY/v6cqsObuW5WgE/xbP JnrRgt0XraW9ppNU7CWf1cM6I3gHvhFRKQyp4cYmg5HkCH0CQxKBgotyvchN1+/h8hVD DDxg== X-Gm-Message-State: AHQUAubnAeMHb08vuVpdKt4kJpL2S10izEvpkqVg8WCBfnnVratyagc+ 75KvhxJgduLuyEaNI2lEUguMS0IaRaBHtA== X-Received: by 2002:a17:902:8e8b:: with SMTP id bg11mr42058317plb.332.1550739652466; Thu, 21 Feb 2019 01:00:52 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id v4sm27703948pff.77.2019.02.21.01.00.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Feb 2019 01:00:51 -0800 (PST) From: Sumit Garg To: chrubis@suse.cz, ltp@lists.linux.it Date: Thu, 21 Feb 2019 14:30:09 +0530 Message-Id: <1550739616-24054-3-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-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 v4 2/9] lib: split tst_fill_file() to create new tst_fill_fd() 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" Split tst_fill_file() api to create new tst_fill_fd() api which could be used to fill file using fd and allows syscalls tests to operate on fd. Signed-off-by: Sumit Garg --- include/tst_fs.h | 9 +++++++++ lib/tst_fill_file.c | 40 +++++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/include/tst_fs.h b/include/tst_fs.h index 23f139d..b2b19ad 100644 --- a/include/tst_fs.h +++ b/include/tst_fs.h @@ -139,6 +139,15 @@ int tst_dir_is_empty_(void (*cleanup)(void), const char *name, int verbose); int tst_get_path(const char *prog_name, char *buf, size_t buf_len); /* + * Fill a file with specified pattern + * @fd: file descriptor + * @pattern: pattern + * @bs: block size + * @bcount: blocks count + */ +int tst_fill_fd(int fd, char pattern, size_t bs, size_t bcount); + +/* * Creates/ovewrites a file with specified pattern * @path: path to file * @pattern: pattern diff --git a/lib/tst_fill_file.c b/lib/tst_fill_file.c index 7baead8..f2bc52d 100644 --- a/lib/tst_fill_file.c +++ b/lib/tst_fill_file.c @@ -28,40 +28,46 @@ #include "test.h" -int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount) +int tst_fill_fd(int fd, char pattern, size_t bs, size_t bcount) { - int fd; - size_t counter; + size_t i; char *buf; - fd = open(path, O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR); - if (fd < 0) - return -1; - /* Filling a memory buffer with provided pattern */ buf = malloc(bs); - if (buf == NULL) { - close(fd); - + if (buf == NULL) return -1; - } - for (counter = 0; counter < bs; counter++) - buf[counter] = pattern; + for (i = 0; i < bs; i++) + buf[i] = pattern; /* Filling the file */ - for (counter = 0; counter < bcount; counter++) { + for (i = 0; i < bcount; i++) { if (write(fd, buf, bs) != (ssize_t)bs) { free(buf); - close(fd); - unlink(path); - return -1; } } free(buf); + return 0; +} + +int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount) +{ + int fd; + + fd = open(path, O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR); + if (fd < 0) + return -1; + + if (tst_fill_fd(fd, pattern, bs, bcount)) { + close(fd); + unlink(path); + return -1; + } + if (close(fd) < 0) { unlink(path); From patchwork Thu Feb 21 09:00:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158880 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp242789jaa; Thu, 21 Feb 2019 01:01:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IZvXLe6EsTZOpJDzgUQxhVlTzfs70kIKS5Lqm1mww6mMyNM4idzHW3Rbo0tr+w5QQDpkSxc X-Received: by 2002:a50:e007:: with SMTP id e7mr30806756edl.10.1550739669401; Thu, 21 Feb 2019 01:01:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739669; cv=none; d=google.com; s=arc-20160816; b=q4blkLxCtLkPvwpTHxp3H0mr1pe8YhvJsApqm9rcwsDRrMgvtWLrOg31h1h/053t1O yA19uClTUtZSeQXkY0n9+xr7ldpgACoeKlHgr5gCheC1nGvgUCleIxJeDoCCDQ7h6zqL 9LKMNJctnAsPeXmolZeiKNQouu/SLBo+Pa1/QWEhkkl8ShZ0A00IFDbkHtywfPr2OMdc zkG5NfHiqoowtoGsO418YD/wj/GCQIyeESJLdZV38IWNQkSl2eFVlyuDeHl0OxkBUe8s RCT0A/9s/6ngCqVTi+KdybW+ltoeqoHVxTZC4graroAKNqHPixUWPaFZRJu58+cGtRm0 6uBg== 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=XWLaeIAq7XnjfxRDB21Z7CDhdeV4BSNurQwu0tU4Eu4=; b=ILi9bJ73nsAXKSSSkJxtwgWzjM8nhFAU0+BBMHEESGJZr+uhBb0GHjyvPdFgcOGdGu 5IN0i5fBNcbgEQ7P+NYf4qqNy3TGye3XUDK2e0OW7hkDdSULy/C20yGsB6JxNkw2SexZ dvvkvRuFhGOjhCuWFjWkJNPVCoU42hkURXb0enirsOzJjXQOHmzOrz/nY2OMmUskAoKH VwPfkU4eBldUPk53Shwi8mmmHyio1frHwUuv2OiXyi6qwjNIdIXmMB6nBpznotUiGUCZ ok1nfNTNWbP4Wz/pk1y+hAkRae02bJHNu4yXXvwsmRPSRUfVyr7pe8WlM65Dye4YzL9T sxIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VoXAW83O; 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 i22si3732766edv.214.2019.02.21.01.01.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 01:01:09 -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=VoXAW83O; 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 E9C8E3EA188 for ; Thu, 21 Feb 2019 10:01:08 +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 [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 703193EA220 for ; Thu, 21 Feb 2019 10:00:59 +0100 (CET) Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (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 ECBCB603468 for ; Thu, 21 Feb 2019 10:00:58 +0100 (CET) Received: by mail-pg1-x542.google.com with SMTP id s198so13477963pgs.2 for ; Thu, 21 Feb 2019 01:00:57 -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=yj7G0mt6IAhXzXs48C/jPh3OpUgtTFYOPpqse8N1/Cs=; b=VoXAW83Od4KoXwbCo4mqVQOtsgY8z51Z6fvP11E6tDdVuAAHEkxNwENru2Ok5wuPgi DKmRfHRdPV68C6fLgM6H6GspNeaAmkq75mNfgBG038CUvPZDXHPcD13VVkoC0CrSepzq bz7tAMH5AFQUCICXdj73N4+lKGrL+eFNBEBpfQc9ikzjN6DwL2/dgOR7quBht1ee0ECK Yy2Za5ur6LRNcc+VBo1b0e9EDJLWaGS5L+cwI+Nqh6Mi6IyhdFPi2ek4VA7R/x7SlMZf LKCL/6gKu3qUR4czLwdLE7c2cPonEERNhy8rG7IxYUtxh5wOIyEtOq9rWHye35pRjlyr G6dg== 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=yj7G0mt6IAhXzXs48C/jPh3OpUgtTFYOPpqse8N1/Cs=; b=ZCjnKWXCIEo6rn59HmOfXWT+VdBDn59fERxEaZRB9LbjHVS1Xr4WYmCy8iS7CiWPH7 rH9gUN5zJyyXFtHlb4vJ0+EnsQ4CQsOPYzAUl1M7T+VFNiBv/nlLsumzn2mSuVC8MRsi zb1KOm/oCDL7SSRqusqZ30YYwrXyJzM20LIFN+fyvFHk/AUGJFC5ZB9yR3PmT89o1cDL XKs8X0DMy5kuYaC391rd5A03m2k5//wfSx/MKiFx1VgBrU0yCtq/K12k0XvJCQVes4bl 7v2Hf55Q08rlUKpV12ORS9D17o6VVe02MW+BwXrIE4Qqme0RDD520UZVTNtRpGKMrFu8 5CeQ== X-Gm-Message-State: AHQUAubkprieJHPgPkw3IqgfUxGPmyjdNOsczBoRvIz+AiHcSDsHyTSL Ce5QZlfWPG/jDqJcG5MXVtFhHA== X-Received: by 2002:a62:1043:: with SMTP id y64mr39688451pfi.78.1550739656366; Thu, 21 Feb 2019 01:00:56 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id v4sm27703948pff.77.2019.02.21.01.00.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Feb 2019 01:00:55 -0800 (PST) From: Sumit Garg To: chrubis@suse.cz, ltp@lists.linux.it Date: Thu, 21 Feb 2019 14:30:10 +0530 Message-Id: <1550739616-24054-4-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-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 v4 3/9] lib/tst_test: define TEST_VOID() macro 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" Define TEST_VOID() macro for syscalls whose return type is void like sync() etc. Signed-off-by: Sumit Garg --- include/tst_test.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/tst_test.h b/include/tst_test.h index 12dda2e..03c88e3 100644 --- a/include/tst_test.h +++ b/include/tst_test.h @@ -216,6 +216,13 @@ void tst_reinit(void); TST_ERR = errno; \ } while (0) +#define TEST_VOID(SCALL) \ + do { \ + errno = 0; \ + SCALL; \ + TST_ERR = errno; \ + } while (0) + extern long TST_RET; extern int TST_ERR; From patchwork Thu Feb 21 09:00:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158881 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp242890jaa; Thu, 21 Feb 2019 01:01:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IbwsF0tDg77S8wd/AU7DVwAB1zWjQSnG9kj/Y68WidgYa91IWzGLu4jP3xV3W3sjw30EYw5 X-Received: by 2002:a50:9e0a:: with SMTP id z10mr29319222ede.39.1550739673622; Thu, 21 Feb 2019 01:01:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739673; cv=none; d=google.com; s=arc-20160816; b=bCN7mCegVEhUEgcdB1Zulo4eRTA2QayFy7cvXTsDlmXruaKJa2nVvsEnv37KoPM1wr SHMBJ3KQgswscePSfKg4lGGk7UhaqvZ7znUYe7gzwVJgNlZ+8RRjD37tMrq/Cgc4XDy3 k5InykJvla5uGsNrho2aUsN/89FXvU6PgvUfDeB7qAbXOEdvft41+HJgzX3fmXxLioER EdkND7NGDVzpgLkN+Ipq+MlAFiHPHGYipMMFYdLmYyUGTNEqSVSnB5Fse/G+FAaZsm2Q 3GftQbQd7HbcHmHoXhlvnPFhDjCo8S5Qm3YBQl70SjFoscYHRjAs7qYZ83sqyAo8gKnU O1Og== 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=TfDJFXUhQ6VfNwr6i0aPxzDy6//i1D50diidxwiZxUI=; b=BRj7Zc5GaoPLtaIL1AZ/4h6W9KboeYEx74jRTXM1uANB15rVNOpPiy+TVUoMrZgurg eO0WY4U5epF4Mvkf06NUrxVq/x+B2uae7OjJah8qlSAJjSbDfWFJsps+Mgx4f8IAiZ3/ wVbtUUCa1rbaE4AzH8qF0nvsyzP/HvTtrO+I5G4qC/OrMt3H4GoqPC6zo0BR1TWoqarx 0/PJC5VaIbYd9LXYrtZ7xUBFv0GGmP3TV7CeGKufN47rXpiaAUvnFgXhZEl4Nz38MFHh 5skINzNXceL8lHAZzjhCPWnRqv50Q01VvxDKsieZjWLdXYG+NI+7hdROme07vdNX0Grv 1A4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gIBes8sa; 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 p1si2530956eja.16.2019.02.21.01.01.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 01:01:13 -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=gIBes8sa; 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 33C38294AEC for ; Thu, 21 Feb 2019 10:01:13 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) by picard.linux.it (Postfix) with ESMTP id B21E0294ABC for ; Thu, 21 Feb 2019 10:01:05 +0100 (CET) Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id A89B714060CE for ; Thu, 21 Feb 2019 10:01:01 +0100 (CET) Received: by mail-pf1-x442.google.com with SMTP id i19so419050pfd.0 for ; Thu, 21 Feb 2019 01:01:01 -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=U2pa7TA3bk4YVlWvqiVBiXnjF1vDDfcWhaSu4nF0rAc=; b=gIBes8sa1eV/Z/ubXYexxsT27G2cTQSZlP3w6L5Cr/odJFwC7atdmbiFvOLDIhsH7E GPYCTzf8tAbsxfFxJiNlOcsXHZ7Ip7laiCZdiQ93LqpDNz+pRdOrquEd5pSnOr5PxNdl FB/8PQ8hfu4I8lSPZ+ulfjXMaOWiE5/EAPAFMO9C1eBl67Cr57dYw3D35y2QEdOIP4m+ bEKHYuSrG+NhhsqhoCEsHR8OaQPpvEYDQ20owhPlD7Ia36hHKPhkpNa7fv1hf/CeC+zq 6W5TnrL6XUNxJ3B+NIgF0efk7xWZvbp6sx9oXlNbR3HB6Fud10tHoOu8BqAbBej+mJCa A3jQ== 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=U2pa7TA3bk4YVlWvqiVBiXnjF1vDDfcWhaSu4nF0rAc=; b=RitXwQ2puwqNvnSXj1M1OGU9gGpguzcv8O9y/HeLBcV6LNZVShEr6TBaVbKaQA5Bmu vb6dr53IM1EJbtdIezN6xCLVk4o7uEX6yQfVoWOtf8NFmpoo2efwtRP97TG3cZ8wcyuK mTWnfYnBRyCepw1F4cf5RA8U8gk4sZYk+qPoyan6eeC6jOpNyRnGgU/NStP0hN8Xknon zyf2J4wFA2ptAfkrmMMeUaykNZSRGw9x3E2z1PgN997ky5roquT1mmr6Ikg7q/TN/YA1 uCkfZ1uZ7GKLRMDn2tSGYsKCXGlRh++oNEHZEqlTEyTsBC2uvFg00j6G69iVdK8W1IE2 AjKQ== X-Gm-Message-State: AHQUAuasynoPHg03mF6hJRb0PLrbFQzXKOWcGrXcwgVe2IIUK2Eyw6KV CccOCLjY73miNAlhXbAPEvin8g== X-Received: by 2002:a63:fe58:: with SMTP id x24mr33585121pgj.255.1550739660214; Thu, 21 Feb 2019 01:01:00 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id v4sm27703948pff.77.2019.02.21.01.00.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Feb 2019 01:00:59 -0800 (PST) From: Sumit Garg To: chrubis@suse.cz, ltp@lists.linux.it Date: Thu, 21 Feb 2019 14:30:11 +0530 Message-Id: <1550739616-24054-5-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-6.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-6.smtp.seeweb.it Cc: daniel.thompson@linaro.org Subject: [LTP] [PATCH v4 4/9] syscalls: add syncfs() 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" syncfs01 tests to sync filesystem having large dirty file pages to block device. Also, it tests all supported filesystems on a test block device. Signed-off-by: Sumit Garg --- configure.ac | 1 + include/lapi/syncfs.h | 21 ++++++++ m4/ltp-syncfs.m4 | 10 ++++ runtest/syscalls | 2 + testcases/kernel/syscalls/syncfs/.gitignore | 1 + testcases/kernel/syscalls/syncfs/Makefile | 8 +++ testcases/kernel/syscalls/syncfs/check_syncfs.h | 19 +++++++ testcases/kernel/syscalls/syncfs/syncfs01.c | 67 +++++++++++++++++++++++++ 8 files changed, 129 insertions(+) create mode 100644 include/lapi/syncfs.h create mode 100644 m4/ltp-syncfs.m4 create mode 100644 testcases/kernel/syscalls/syncfs/.gitignore create mode 100644 testcases/kernel/syscalls/syncfs/Makefile create mode 100644 testcases/kernel/syscalls/syncfs/check_syncfs.h create mode 100644 testcases/kernel/syscalls/syncfs/syncfs01.c diff --git a/configure.ac b/configure.ac index caea344..9122b6d 100644 --- a/configure.ac +++ b/configure.ac @@ -231,6 +231,7 @@ LTP_CHECK_TPACKET_V3 LTP_CHECK_RLIMIT64 LTP_DETECT_HOST_CPU LTP_CHECK_PERF_EVENT +LTP_CHECK_SYNCFS if test "x$with_numa" = xyes; then LTP_CHECK_SYSCALL_NUMA diff --git a/include/lapi/syncfs.h b/include/lapi/syncfs.h new file mode 100644 index 0000000..1341c6b --- /dev/null +++ b/include/lapi/syncfs.h @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Sumit Garg + */ + +#ifndef SYNCFS_H +#define SYNCFS_H + +#include +#include "config.h" +#include "lapi/syscalls.h" + +#if !defined(HAVE_SYNCFS) +int syncfs(int fd) +{ + return tst_syscall(__NR_syncfs, fd); +} +#endif + +#endif /* SYNCFS_H */ diff --git a/m4/ltp-syncfs.m4 b/m4/ltp-syncfs.m4 new file mode 100644 index 0000000..836a055 --- /dev/null +++ b/m4/ltp-syncfs.m4 @@ -0,0 +1,10 @@ +dnl SPDX-License-Identifier: GPL-2.0-or-later +dnl Copyright (c) 2019 Linaro Limited. All rights reserved. + +dnl +dnl LTP_CHECK_SYNCFS +dnl ---------------------------- +dnl +AC_DEFUN([LTP_CHECK_SYNCFS],[ +AC_CHECK_FUNCS(syncfs,,) +]) diff --git a/runtest/syscalls b/runtest/syscalls index 668c87c..9442740 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1346,6 +1346,8 @@ symlinkat01 symlinkat01 sync01 sync01 sync02 sync02 +syncfs01 syncfs01 + #testcases for sync_file_range sync_file_range01 sync_file_range01 diff --git a/testcases/kernel/syscalls/syncfs/.gitignore b/testcases/kernel/syscalls/syncfs/.gitignore new file mode 100644 index 0000000..6066295 --- /dev/null +++ b/testcases/kernel/syscalls/syncfs/.gitignore @@ -0,0 +1 @@ +syncfs01 diff --git a/testcases/kernel/syscalls/syncfs/Makefile b/testcases/kernel/syscalls/syncfs/Makefile new file mode 100644 index 0000000..3e6c2f4 --- /dev/null +++ b/testcases/kernel/syscalls/syncfs/Makefile @@ -0,0 +1,8 @@ +# Copyright (c) 2019 - Linaro Limited. All rights reserved. +# SPDX-License-Identifier: GPL-2.0-or-later + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk + +include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/testcases/kernel/syscalls/syncfs/check_syncfs.h b/testcases/kernel/syscalls/syncfs/check_syncfs.h new file mode 100644 index 0000000..26991d2 --- /dev/null +++ b/testcases/kernel/syscalls/syncfs/check_syncfs.h @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Sumit Garg + */ + +#ifndef CHECK_SYNCFS_H +#define CHECK_SYNCFS_H + +void check_syncfs(void) +{ + int ret; + + ret = syncfs(-1); + if (ret == -1 && errno == EINVAL) + tst_brk(TCONF, "syncfs() not supported"); +} + +#endif /* CHECK_SYNCFS_H */ diff --git a/testcases/kernel/syscalls/syncfs/syncfs01.c b/testcases/kernel/syscalls/syncfs/syncfs01.c new file mode 100644 index 0000000..4382a34 --- /dev/null +++ b/testcases/kernel/syscalls/syncfs/syncfs01.c @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Sumit Garg + */ + +/* + * Test syncfs + * + * It basically tests syncfs() to sync filesystem 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 "lapi/syncfs.h" +#include "tst_test.h" +#include "check_syncfs.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_syncfs(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(syncfs(fd)); + + if (TST_RET) + tst_brk(TFAIL | TTERRNO, "syncfs(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 filesystem synced to device"); + else + tst_res(TFAIL, "Failed to sync test filesystem to device"); +} + +static void setup(void) +{ + check_syncfs(); +} + +static struct tst_test test = { + .needs_root = 1, + .mount_device = 1, + .all_filesystems = 1, + .mntpoint = MNTPOINT, + .setup = setup, + .test_all = verify_syncfs, +}; From patchwork Thu Feb 21 09:00:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158882 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp242984jaa; Thu, 21 Feb 2019 01:01:19 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia/1+ubEuWF86gZR2F9oDRKLlXNnkjFgoDFc8BcJAFIwvJpPCt2U96ljY4+c702LGfoG+62 X-Received: by 2002:a50:8bf9:: with SMTP id n54mr29739819edn.197.1550739678927; Thu, 21 Feb 2019 01:01:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739678; cv=none; d=google.com; s=arc-20160816; b=0MrN0FyXygSjh8iRpNvgl49iJq6EpBwEVw3xdtg743xruNSL8qjx228gHkZ3ORdisL ntnTCW2WIhbQJPj61nNO7veg3VZ1R8MMw1yIeXUszafW8CKEWDhSUz3ozq0RSmBOinxi PWbHJPOJV3xV2ZB36vB/elG9KR8B79Y0wvDy5hUjFMZEK1zg/3tTsTXcL7k/OpfTEgGo R07pmmLwh4WM1d5mPMw+gc8s3r8liUfhHI1OGK3/BvThylWm/x5fvmJPgga9snnlPvC7 jjVWHbcImQnoezeuvtGWU6H388OQR0ICdfEVYVc8UPamdKg1BYRgc8x5lG0iUksg4kcY Whbw== 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=8uo2SY+T6UYra+UXXzBDeo1/vQOHQO2XB/eJ4P8f3+M=; b=zJDNKNf/PIYq1yV8GdwnjT6AOkvG+0um6cATz1IbPpIdJ/qaxc3cR6jEysYC8oCUce UR3BkvRjYSpvZhOiP19qCCSgg+wE1GXav/VrnNGxeErFiZuon6ttwbQ7SDfslEfAvK5u wg1S/vAVGJMN+iApAdBmfbBU8o3GzNzVTAtq+Od/e6lKlmrYtzGSi7qh5tHVL8OQGM1m uGlGamslYfhoAXuaYdQ8Jtp5tP0fh0gohnD5mBKeG+rfRg/mzM9kAH+mWlW+UOhZkwJH aL/7bu73TObXrrkSaa20gwMMGMkls0PLFvNAcmqDlI388BXg5/v3hEgSSigrg5QuK4QQ lijw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ONKzi9Rj; 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 e2si2257527ejs.33.2019.02.21.01.01.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 01:01:18 -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=ONKzi9Rj; 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 3E137294AC1 for ; Thu, 21 Feb 2019 10:01:18 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) by picard.linux.it (Postfix) with ESMTP id AD724294AD5 for ; Thu, 21 Feb 2019 10:01:06 +0100 (CET) Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 9C09220157A for ; Thu, 21 Feb 2019 10:01:05 +0100 (CET) Received: by mail-pl1-x634.google.com with SMTP id s1so13836781plp.9 for ; Thu, 21 Feb 2019 01:01:05 -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=2q9SLiu/LSR9DP7ZEVFCQ84x3EbPsdW8j8twBELQXoI=; b=ONKzi9RjdD6zdpbRs76LBI5b7X+zOj4EVESjLqM4xOFUCxIMR/fl9U7pFwYoGVwf+l DihIQQvTbxfOQP4reRFfeHiyqaD/Th8EYeHhuX0uMgIDExQQxXmR1+sEJGkNnNabzC4V YCJVHMCoteDwspUqmU2KJtr+A+RoGmLXdKvNxAtkM5GmZ32mtc8x8fDD+VBqjjbjTzl6 U5b2/+9lD5tDHxprFDYBBsqBEZTpZUYJ2YCYlbcF0klDfkWVBz2taywQ9ylCNVKOpbUf tIrH/aqa0JbKsPa2G2qO4tXkKfrpVnqUDHlcBpYZAwrlfZDhd0UNTcY/qZjmpBp2jNzm Q9Tg== 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=2q9SLiu/LSR9DP7ZEVFCQ84x3EbPsdW8j8twBELQXoI=; b=KiC2bJH8Dq30JpzmUM+sh6IgAsxNwyVhWGHZJznoEj3EWPPNvjpgG/mXsQv8dwql3+ GAtQPZQa3Je5WrKANn8WVcJ2Gkn1trGAwkeQsiFm5iCCA7HyglNj/xfSnO/v5bKbIXfR 7ZJZzjQDMrKW1fSGcX6x6tdeGDygP5yRYgkwnV3pBlRuYKMnbni2zrNdCDUJFtYidupT VYdaRN86MmZkxwwGAOYIn41MYTjoT2Yfk5LuDqJxoGAuiWgXkdxyMb618ua0pO1O3GIy orA6xcMB5cpUNdit7rxrmKvvBb/0yul/Dmf1Qkj2JGaAmf1a4iraS1FcGjhnvJ45lVpq vXyA== X-Gm-Message-State: AHQUAubiGiV17QNjrCz7GkwxN3fpAAc5iAjw1z7B+i8IyVOdeevI6Wga RvjKsjzWOGAjfsAZaicsfQhgCA== X-Received: by 2002:a17:902:bc89:: with SMTP id bb9mr41613828plb.212.1550739664229; Thu, 21 Feb 2019 01:01:04 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id v4sm27703948pff.77.2019.02.21.01.01.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Feb 2019 01:01:03 -0800 (PST) From: Sumit Garg To: chrubis@suse.cz, ltp@lists.linux.it Date: Thu, 21 Feb 2019 14:30:12 +0530 Message-Id: <1550739616-24054-6-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-7.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-7.smtp.seeweb.it Cc: daniel.thompson@linaro.org Subject: [LTP] [PATCH v4 5/9] syscalls/sync: 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" sync03 tests to sync file having large dirty file pages to block device. It tests all supported filesystems on a test block device. Signed-off-by: Sumit Garg --- runtest/syscalls | 1 + testcases/kernel/syscalls/sync/.gitignore | 1 + testcases/kernel/syscalls/sync/sync03.c | 60 +++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 testcases/kernel/syscalls/sync/sync03.c diff --git a/runtest/syscalls b/runtest/syscalls index 9442740..dba0dee 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1345,6 +1345,7 @@ symlinkat01 symlinkat01 sync01 sync01 sync02 sync02 +sync03 sync03 syncfs01 syncfs01 diff --git a/testcases/kernel/syscalls/sync/.gitignore b/testcases/kernel/syscalls/sync/.gitignore index d8d304d..04f4710 100644 --- a/testcases/kernel/syscalls/sync/.gitignore +++ b/testcases/kernel/syscalls/sync/.gitignore @@ -1,2 +1,3 @@ /sync01 /sync02 +/sync03 diff --git a/testcases/kernel/syscalls/sync/sync03.c b/testcases/kernel/syscalls/sync/sync03.c new file mode 100644 index 0000000..4dc2ff6 --- /dev/null +++ b/testcases/kernel/syscalls/sync/sync03.c @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Sumit Garg + */ + +/* + * sync03 + * + * It basically tests sync() 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_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_sync(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_VOID(sync()); + + if (TST_RET) + tst_brk(TFAIL | TTERRNO, "sync() 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 synced to device"); + else + tst_res(TFAIL, "Failed to sync test file to device"); +} + +static struct tst_test test = { + .needs_root = 1, + .mount_device = 1, + .all_filesystems = 1, + .mntpoint = MNTPOINT, + .test_all = verify_sync, +}; From patchwork Thu Feb 21 09:00:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158883 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp243095jaa; Thu, 21 Feb 2019 01:01:23 -0800 (PST) X-Google-Smtp-Source: AHgI3Iay2CqqkeGFOxZbUQX67zDCmFxCHLGdjsNvDyqhYsJbSke3EhtmoGadkeX4jS7oom1qq+r7 X-Received: by 2002:a50:a622:: with SMTP id d31mr31757540edc.228.1550739683884; Thu, 21 Feb 2019 01:01:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739683; cv=none; d=google.com; s=arc-20160816; b=dZi6+v15umiU5N0dnPJ6MF/Tl1VRBQxvW84dUx0r2M73V6qc36tIc8rnqLUdYmDz48 R6Vfn6QaMPNtwHYzQXpu6E0osemr0vAUZufDSRfINQ6qyBN6MpaqVBnhxqxJsY/wM79v qUHDtmONIkzeU8wBZPUavk1m3Dz6qg/5yQ08KDcphrJk8IrABgIft0LFTdQ908ao1kxW lEGjaJsuS02bqCJ/vwl6MRj8fQsZ4SNpX3oP9n+Mx0o+k174VxJ1BTyan2L3O5n2PzNh hry/6RhQjF8igVJMFA7vSvGFNjshdguJU+1wI5tunqUA0862ZD6Ny4Pv+t4aDotJYZp2 9gFQ== 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=1oFsZgV6It2I/jUtVRFl2x0/y9h0809fDxd+kpI+4PQ=; b=zF+eVX+GK580lgFiU7DJ8CIbSFUnP9CNibUrm1aQuOtL1bngsBas05LzF1w4R1BgwU dntK6jSHoiRP2DCSHS/hb0JlHAvN7indvqsYJjDs446KUBrHBd2d90bAKrBbLbYxAsHR ovGrwdvMzG8VYAcJA523NXlKqxO/nUwE9+BHvjp1aOOhgIshEBiqz9EzrrrtpZg4K5gl CTr0FxiBYIa5KC0e//+fAmxUUt/AY0bkxTAvDjIOPGHD/V1Jvd2AMIDR+tjy2FqL1gdA qlt2ZA6n73ZAWVcqKfQXqtQ8SV0eTobjqQfkaMfKx62frrrCD9Ubobh4HrWaa6NOBgli KSzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="HyycqY/3"; 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 p37si7838759edc.272.2019.02.21.01.01.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 01:01:23 -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="HyycqY/3"; 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 E7F93294AEF for ; Thu, 21 Feb 2019 10:01:21 +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 [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 7A7493EA20B for ; Thu, 21 Feb 2019 10:01:10 +0100 (CET) Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) (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 BDBB4603453 for ; Thu, 21 Feb 2019 10:01:10 +0100 (CET) Received: by mail-pf1-x42c.google.com with SMTP id g6so13417444pfh.13 for ; Thu, 21 Feb 2019 01:01:09 -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=kf7JgvHXw82F8Uw2a5AQUPKBZR0XwFJP0TUSBj2BawI=; b=HyycqY/3L9TsPnAMZ/6sO2AZniLwU/dicm3NChhWLkC+LuNNYe3R/io0HRodgNTTT9 GDbmuTIwBM9wAYsf9BttKc29kfH6LvJi4nl+C1GRWNQxuDV5PoQhZk2r6DrZXhCtEe6t EKWuL+D/uOACUSpPB8SK2pAERzXjiqHhGqPn/POmzBDLM77wDW8ZBh1U67ZpZeCQ1Uhh 1bmFDdPnxq4kxd08UQOOspHdYll8s8bcMPjLemcGKmwjbGS8sxAdNMDqBa+Lnvr/zBfY 9h49t9DaQISYnI7M6M78IamK8QkG+NZOzyj8SaS4/4TLzIE3wTbddtrRha3I4ODQUp8Y faSA== 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=kf7JgvHXw82F8Uw2a5AQUPKBZR0XwFJP0TUSBj2BawI=; b=Vayy3sbKu5z5Fz5wAZYxtS5jNxjI9lyZGd3EzdYaLQMFDGdpmx7q73aTukBFUdnCZL 1yImY7iP6CCaf2yu8mHIXdduUrmo5I3kAKhaDCAtSyUa6/Ndkc3XUv/MPudZG0/ngKuy CIwLYf1w1VfEE0LtVkbCwLDEn2WIwj62SaXALle7fVSfQ0LdABNIMzr7IUgslaRf2mje iTcTTOwkNIS2gurLXOMo7cKjqMnOyRnTXUeW5rzQVir+QiYcN/AslE+ebpVTAzq5kEVG AqVD2ipVhKtfGUEMhG2kfb+v7EMunkET/xoRZrdB+DJHCVZxalGQrf6Lke9t8kayVvQ+ z6dA== X-Gm-Message-State: AHQUAuYZMyz4GB71JsY4R42rEZrPGvlOtXzpZqMezmUJJ04Ox3ZPNyOP ttTrqanN448im2VWZ9jjhEb+Uw== X-Received: by 2002:a63:d846:: with SMTP id k6mr33947931pgj.251.1550739668111; Thu, 21 Feb 2019 01:01:08 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id v4sm27703948pff.77.2019.02.21.01.01.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Feb 2019 01:01:07 -0800 (PST) From: Sumit Garg To: chrubis@suse.cz, ltp@lists.linux.it Date: Thu, 21 Feb 2019 14:30:13 +0530 Message-Id: <1550739616-24054-7-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-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 v4 6/9] 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 | 60 ++++++++++++++++++++++++++++++ 3 files changed, 62 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..4b5b586 --- /dev/null +++ b/testcases/kernel/syscalls/fsync/fsync04.c @@ -0,0 +1,60 @@ +// 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_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_fsync(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(fsync(fd)); + + if (TST_RET) + tst_brk(TFAIL | TTERRNO, "fsync(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 synced to device"); + else + tst_res(TFAIL, "Failed to sync test file to device"); +} + +static struct tst_test test = { + .needs_root = 1, + .mount_device = 1, + .all_filesystems = 1, + .mntpoint = MNTPOINT, + .test_all = verify_fsync, +}; 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, +}; From patchwork Thu Feb 21 09:00:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158885 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp243270jaa; Thu, 21 Feb 2019 01:01:32 -0800 (PST) X-Google-Smtp-Source: AHgI3IZsMDcxjO6KbScTfA7PNNOnFeCOxCbJK674JtFA5EcbBju2gBqFrWt2EQqHG7ejJhQf9E65 X-Received: by 2002:a17:906:5e0d:: with SMTP id n13mr8531401eju.139.1550739692206; Thu, 21 Feb 2019 01:01:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739692; cv=none; d=google.com; s=arc-20160816; b=kxJpesEFPm/SRfWRJWzsrLSm9SYFWofZN8LU8yM4T3l5jier9EBF1ifRr/LCnVWHxC yrFVjdmTirJEZXTAZlxevwrO0a6ui5Tt36/7OGLgAdTkUiR2Wfpu5WFNApkzUII5T32y RltvkVZYL5dUuM/krzFDA+h0TE3mBlHpp4uGUS/othAlU4nY9fkIFfKBbOIGkWQqTj4h +aPjFjMX7ipz0jYujc6fND2jetpTGVmKW2Q0uoIo4OIhUt2UgnlKMWAq5mwHg/46m6MY 2X/LilXopweZeFYM8MJeMKwW74nAIeLVeBM4t4amn690ZT9zejpKynHGxu5i/UVhNd4h JHpQ== 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=Ny1J9SuFdQsLYWMoMqhJ4HKt0skzqGaFUXR0q2TICbM=; b=CfNJEMYjG7p089BuJX9ltG2XSpP33fQDvIPweKWQkWgZvg/YStxJuANgTL3XKMM/+/ Qo/IUW1MMbA8eEWfhK4uuo3hME8ln9jb1S2jsz/IFKNRJ3CeOuLC5K5H5HpdJsv0czPG GiCoLxDPz7dqv30HzEDpf5wgE8tqkpoU2VuZ1Je6DouM641fZKOIWFcZfncWTlDb2OY7 mvY0Ead1/8KBfyEWysYG5NfEBIfs2oDZMPWMrDMnWoc8CpQHOnaa58Tp6hRm0qtgYBzl TIjI7nkRr0JmdNiZtrw8gs1pbP85WjU4JnKZc0qc1gIQX7xumvnqo5eX30/HZWQYDc0p 7U5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=tXs9MEkW; 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 n11si3615588edn.99.2019.02.21.01.01.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 01:01:32 -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=tXs9MEkW; 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 183C8294A94 for ; Thu, 21 Feb 2019 10:01:30 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) by picard.linux.it (Postfix) with ESMTP id 9F8D7294AD7 for ; Thu, 21 Feb 2019 10:01:20 +0100 (CET) Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 0475860165D for ; Thu, 21 Feb 2019 10:01:18 +0100 (CET) Received: by mail-pf1-x441.google.com with SMTP id h1so13425230pfo.7 for ; Thu, 21 Feb 2019 01:01: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=NX61GZqQlo6N8y0MvlFka7W8ofBR2MpVX39i7sy/+SY=; b=tXs9MEkWjUngtjdt2VMAd/Zd1iM6yk7h1X5NeqTu/uhOal6GKTwFm0IluJfR92a6Y2 YUwi0QMybr/G1HgMrzzM2kUlZdZp33bYI5HNqOfwUd0Kr58RPXLn5E2tEXfk+pypWspJ TqP5CGD+suzZ84noJLXg6CU/5Ua0LL4c6MoJiQtpk2TwmSYWaw+lih5BAGGDaqEBbCi3 uUuKxLXN1OiXK7yCO/nOCV1igkzmk94vLxtC20JWIcmcptruQw+st+1ip1gA1w4RK/4v QVaNjAgBToF1K5LjSPEni6O6knzFP1968T1Swp4+ZHgZNAkS7sYbHVAcqOCGSQrEiKuV QPNA== 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=NX61GZqQlo6N8y0MvlFka7W8ofBR2MpVX39i7sy/+SY=; b=ITcedZZhYs2XZXHrwwZJer3ziR9EwfVk4W9dTfnglaPLNfmdVnaGtU5WuacuVQq9fG yRe+EhjFPb+LEk/zfnwQGKRYr2Q0KnmzJHyv0oYAL2CGyzQonbypEYftg27p+g4Cim2f lyV+V7mz8tJU30gH0tDzYzRtelyEPW3pbCdZ8gp7ecRkXM2TytqshhO0NGER1P4cnEJR FxotB6DXHsXptJqDH/ygsSpiWIRonrTYi1Xahce0lU318Qi6py06BwlAB9uoI4Ln77+l EP8DnOvFXwgL8DtkQ6RpQe2AsxhT0nHF5Yf3YFqIvJ2kl0Y7Z7gZfxOivojyAONDbRVu KDrw== X-Gm-Message-State: AHQUAuZ1LhZ/twhBLzVMCzXUcRkh/oqqvS8oz9r14epT38jjF+xrynle Z/Ijvi9PCTsReAodnagKXmpprQ== X-Received: by 2002:a62:1981:: with SMTP id 123mr39089783pfz.69.1550739676380; Thu, 21 Feb 2019 01:01:16 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id v4sm27703948pff.77.2019.02.21.01.01.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Feb 2019 01:01:15 -0800 (PST) From: Sumit Garg To: chrubis@suse.cz, ltp@lists.linux.it Date: Thu, 21 Feb 2019 14:30:15 +0530 Message-Id: <1550739616-24054-9-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-2.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-2.smtp.seeweb.it Cc: daniel.thompson@linaro.org Subject: [LTP] [PATCH v4 8/9] syscalls/sync_file_range: Use C library wrapper if present 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" Add config check for C library wrapper for sync_file_range() syscall. Also, check for sync_file_range() presence via dummy call rather than kernel version check. And move fallback api to: include/lapi/sync_file_range.h Signed-off-by: Sumit Garg --- configure.ac | 1 + include/lapi/sync_file_range.h | 57 ++++++++++++++++++++ m4/ltp-sync_file_range.m4 | 10 ++++ .../sync_file_range/check_sync_file_range.h | 21 ++++++++ .../syscalls/sync_file_range/sync_file_range01.c | 62 ++-------------------- 5 files changed, 94 insertions(+), 57 deletions(-) create mode 100644 include/lapi/sync_file_range.h create mode 100644 m4/ltp-sync_file_range.m4 create mode 100644 testcases/kernel/syscalls/sync_file_range/check_sync_file_range.h diff --git a/configure.ac b/configure.ac index 9122b6d..d15bff3 100644 --- a/configure.ac +++ b/configure.ac @@ -232,6 +232,7 @@ LTP_CHECK_RLIMIT64 LTP_DETECT_HOST_CPU LTP_CHECK_PERF_EVENT LTP_CHECK_SYNCFS +LTP_CHECK_SYNC_FILE_RANGE if test "x$with_numa" = xyes; then LTP_CHECK_SYSCALL_NUMA diff --git a/include/lapi/sync_file_range.h b/include/lapi/sync_file_range.h new file mode 100644 index 0000000..e2d35fc --- /dev/null +++ b/include/lapi/sync_file_range.h @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) International Business Machines Corp., 2008 + */ + +#ifndef SYNC_FILE_RANGE_H +#define SYNC_FILE_RANGE_H + +#include +#include "config.h" +#include "lapi/syscalls.h" + +#if !defined(HAVE_SYNC_FILE_RANGE) + +#ifdef TST_TEST_H__ +# define TST_SYSCALL tst_syscall +#else +# define TST_SYSCALL ltp_syscall +#endif + +/***************************************************************************** + * Wraper function to call sync_file_range system call + ******************************************************************************/ +static inline long sync_file_range(int fd, off64_t offset, off64_t nbytes, + unsigned int flags) +{ +#if (defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__)) +# if (__WORDSIZE == 32) +# if __BYTE_ORDER == __BIG_ENDIAN + return TST_SYSCALL(__NR_sync_file_range2, fd, flags, + (int)(offset >> 32), (int)offset, (int)(nbytes >> 32), + (int)nbytes); +# elif __BYTE_ORDER == __LITTLE_ENDIAN + return TST_SYSCALL(__NR_sync_file_range2, fd, flags, (int)offset, + (int)(offset >> 32), nbytes, (int)(nbytes >> 32)); +# endif +# else + return TST_SYSCALL(__NR_sync_file_range2, fd, flags, offset, nbytes); +# endif +#elif (defined(__s390__) || defined(__s390x__)) && __WORDSIZE == 32 + return TST_SYSCALL(__NR_sync_file_range, fd, (int)(offset >> 32), + (int)offset, (int)(nbytes >> 32), (int)nbytes, flags); +#elif defined(__mips__) && __WORDSIZE == 32 +# if __BYTE_ORDER == __BIG_ENDIAN + return TST_SYSCALL(__NR_sync_file_range, fd, 0, (int)(offset >> 32), + (int)offset, (int)(nbytes >> 32), (int)nbytes, flags); +# elif __BYTE_ORDER == __LITTLE_ENDIAN + return TST_SYSCALL(__NR_sync_file_range, fd, 0, (int)offset, + (int)(offset >> 32), (int)nbytes, (int)(nbytes >> 32), flags); +# endif +#else + return TST_SYSCALL(__NR_sync_file_range, fd, offset, nbytes, flags); +#endif +} +#endif + +#endif /* SYNC_FILE_RANGE_H */ diff --git a/m4/ltp-sync_file_range.m4 b/m4/ltp-sync_file_range.m4 new file mode 100644 index 0000000..b47a091 --- /dev/null +++ b/m4/ltp-sync_file_range.m4 @@ -0,0 +1,10 @@ +dnl SPDX-License-Identifier: GPL-2.0-or-later +dnl Copyright (c) 2019 Linaro Limited. All rights reserved. + +dnl +dnl LTP_CHECK_SYNC_FILE_RANGE +dnl ---------------------------- +dnl +AC_DEFUN([LTP_CHECK_SYNC_FILE_RANGE],[ +AC_CHECK_FUNCS(sync_file_range,,) +]) diff --git a/testcases/kernel/syscalls/sync_file_range/check_sync_file_range.h b/testcases/kernel/syscalls/sync_file_range/check_sync_file_range.h new file mode 100644 index 0000000..4698c55 --- /dev/null +++ b/testcases/kernel/syscalls/sync_file_range/check_sync_file_range.h @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Sumit Garg + */ + +#ifndef CHECK_SYNC_FILE_RANGE_H +#define CHECK_SYNC_FILE_RANGE_H + +int check_sync_file_range(void) +{ + int ret; + + ret = sync_file_range(-1, 0, 0, 0); + if (ret == -1 && errno == EINVAL) + return 0; + + return 1; +} + +#endif /* CHECK_SYNC_FILE_RANGE_H */ diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c index cebb919..3a97183 100644 --- a/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c +++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range01.c @@ -92,7 +92,8 @@ #include #include "test.h" -#include "lapi/syscalls.h" +#include "lapi/sync_file_range.h" +#include "check_sync_file_range.h" #ifndef SYNC_FILE_RANGE_WAIT_BEFORE #define SYNC_FILE_RANGE_WAIT_BEFORE 1 @@ -190,48 +191,6 @@ void setup(void) sfd = open(spl_file, O_RDWR | O_CREAT, 0700); } -/***************************************************************************** - * Wraper function to call sync_file_range system call - ******************************************************************************/ -static inline long syncfilerange(int fd, off64_t offset, off64_t nbytes, - unsigned int flags) -{ -/* arm and powerpc */ -#if (defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__)) -#if (__WORDSIZE == 32) -#if __BYTE_ORDER == __BIG_ENDIAN - return ltp_syscall(__NR_sync_file_range2, fd, flags, - (int)(offset >> 32), (int)offset, (int)(nbytes >> 32), - (int)nbytes); -#elif __BYTE_ORDER == __LITTLE_ENDIAN - return ltp_syscall(__NR_sync_file_range2, fd, flags, (int)offset, - (int)(offset >> 32), nbytes, (int)(nbytes >> 32)); -#endif -#else - return ltp_syscall(__NR_sync_file_range2, fd, flags, offset, nbytes); -#endif - -/* s390 */ -#elif (defined(__s390__) || defined(__s390x__)) && __WORDSIZE == 32 - return ltp_syscall(__NR_sync_file_range, fd, (int)(offset >> 32), - (int)offset, (int)(nbytes >> 32), (int)nbytes, flags); - -/* mips */ -#elif defined(__mips__) && __WORDSIZE == 32 -#if __BYTE_ORDER == __BIG_ENDIAN - return ltp_syscall(__NR_sync_file_range, fd, 0, (int)(offset >> 32), - (int)offset, (int)(nbytes >> 32), (int)nbytes, flags); -#elif __BYTE_ORDER == __LITTLE_ENDIAN - return ltp_syscall(__NR_sync_file_range, fd, 0, (int)offset, - (int)(offset >> 32), (int)nbytes, (int)(nbytes >> 32), flags); -#endif - -/* other */ -#else - return ltp_syscall(__NR_sync_file_range, fd, offset, nbytes, flags); -#endif -} - /******************************************************************************/ /* */ /* Function: main */ @@ -258,24 +217,13 @@ int main(int ac, char **av) tst_parse_opts(ac, av, NULL, NULL); -#if defined(__powerpc__) || defined(__powerpc64__) /* for PPC, kernel version > 2.6.21 needed */ - if (tst_kvercmp(2, 16, 22) < 0) { - tst_brkm(TCONF, NULL, - "System doesn't support execution of the test"); - } -#else - /* For other archs, need kernel version > 2.6.16 */ - - if (tst_kvercmp(2, 6, 17) < 0) { - tst_brkm(TCONF, NULL, - "System doesn't support execution of the test"); - } -#endif + if (!check_sync_file_range()) + tst_brkm(TCONF, NULL, "sync_file_range() not supported"); setup(); for (test_index = 0; test_index < TST_TOTAL; test_index++) { - TEST(syncfilerange + TEST(sync_file_range (*(test_data[test_index].fd), test_data[test_index].offset, test_data[test_index].nbytes, From patchwork Thu Feb 21 09:00:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 158886 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp243367jaa; Thu, 21 Feb 2019 01:01:36 -0800 (PST) X-Google-Smtp-Source: AHgI3IYe3ZzHSvzJN9ob4Xm80tZnIz95z3m+RqZCuAdZzYz+ENRJ30J8GOTotzKYVOVjB71szQZR X-Received: by 2002:a50:ad13:: with SMTP id y19mr9322390edc.86.1550739696526; Thu, 21 Feb 2019 01:01:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739696; cv=none; d=google.com; s=arc-20160816; b=Yhiy6XvrXNMo+AyHeI0G8SdgIscJ/YJuO/+fuMWkFl5QSvPaymIm6xLEHo67X2kI1N OYRpnaWq34zs1jY3WEdxpaTKQtLxM0VleSMZW0d3htdi3l2qNQd2mzIvlvEsdM2MIfl8 pqiM+Mjvk/WVFopF5f//BiuE0Z9wnBFGvhT9ZCuyY3/1pOoVhobJUg8BS2yuBGFFkVY5 VUeeTZSfcIbbZZ7BpbQaE7ytFjL3XdvpH3k9xaebV0/gSsU+4bke+XfPhIzuesx408ug UqoVFKumS5jMKyH2tSfxLZo0Lq0naoesIsjXhz2L9zYIB4m28OYmXzIZNwbC3Jbm39Le DkNw== 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=WUslyZugxCFUdQmL4PwhGVyz7N5TUlQawkQ35OcI28w=; b=ynJHwdKvW3DBx55MNijZrHgpLjgVNa8cGtWcshtAUOi7N1S1qVumR1CauKW5+IMC7T 9SA47fxDKcXpyUr+Bm5K2s4H1UwvXyfdBSIDwHUqukm0i7SU/k0aSP1dEz0gLjUFAlzE HKwcc8rlDgqVALftcCRN4PB872KL8qgAMcAvEg0AJdh4ifOdQmDcJsP4GswuoY6Uq4Rb RnamI/mZacOg0PS+oAtW5QUSrv6Qr2HQptOc9PD+CNkdrDhUCxtyXS59HygJUPXLcf/l ROC9SyGXHTIE/l3M1slOwSrNvhhp5nSMu/0QxL/CqcrsO1o/ytNtFC5QUsVt3jNvm+vF dTTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OZuBh9xK; 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 s18si3664397eju.94.2019.02.21.01.01.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 01:01:36 -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=OZuBh9xK; 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 B7A7F294AF5 for ; Thu, 21 Feb 2019 10:01:33 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) by picard.linux.it (Postfix) with ESMTP id EE414294AD0 for ; Thu, 21 Feb 2019 10:01:22 +0100 (CET) Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 3373314060C4 for ; Thu, 21 Feb 2019 10:01:22 +0100 (CET) Received: by mail-pf1-x434.google.com with SMTP id g6so13417744pfh.13 for ; Thu, 21 Feb 2019 01:01:22 -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=F92beSL+Zz4DDHhLrK1rfCKy0tQb83IJc8nXkg/yPf4=; b=OZuBh9xKCahbdn6g441ui7AeGoaZDRUZLf2YyQ3+90JQpCAuVpemC8jhCIzqs6bRlx TC2aWJWik++OgrOD59769lTBf+LO2h2TOgRB4xo9SpNbUyEeyiIDeOLGuH7SnC9BwQUE BU+MJPiRDWvM3zzh9Kly9H82GzQmPRif7QjCrSaJhHwFj5xQO+4+NnKbm5EQHvRdmQyj Qe3fX0BltSzZDm+fGNGENYpi6h5CcpHLS63Aqrj497XhbhhVnYGKgjY0b1rLH3uL+Yzd 30uRVYuQfdAnrD6F1h3DxnI+GK2W5ZoNaK9nJHzmxfgWn3+sdCGt4BanKYpyMqWlh95R GADQ== 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=F92beSL+Zz4DDHhLrK1rfCKy0tQb83IJc8nXkg/yPf4=; b=PIIfiFUJV2YjibTrEj95c//NAOBWjlg9LqcCNgjMjD3UW3kkPEKzRslTIZY5khBTou 8E2Rssf2h4b+swvbd1CeS3/Yf1bL9sE+SaTYvcteu3jPpqDh53BJpMZTtLUZ+C+z8kl4 Jcdc/vQ9hD8s3KsoGHeVQnVIvdYXK2Nq6FW9v/IIs8zjcgPJ6KI9gX2jaaBYRqDOv8jM Rn0OScOD2ITu9EzA8npRgRzTqSzMZjmdQN0nobCAD2XnKhv8veCcy5AiagpfohATEzkH zO/lmf6eSwtuQkgZVbdy/yLFqh6Me7/HVVdE6zIsMbAen83UCygpk/0sEc43Wi2pvK0b ZjZw== X-Gm-Message-State: AHQUAuY7L1gzaQsR7ONmlO5FTxU7nek3R2+Thn2pyX4rJT6Ri7Fg38wR XNIJQN+IT5qnc92HWSPbX2BdO8Hww7aqng== X-Received: by 2002:aa7:9255:: with SMTP id 21mr6317759pfp.8.1550739680488; Thu, 21 Feb 2019 01:01:20 -0800 (PST) Received: from localhost.localdomain ([117.252.69.94]) by smtp.gmail.com with ESMTPSA id v4sm27703948pff.77.2019.02.21.01.01.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Feb 2019 01:01:19 -0800 (PST) From: Sumit Garg To: chrubis@suse.cz, ltp@lists.linux.it Date: Thu, 21 Feb 2019 14:30:16 +0530 Message-Id: <1550739616-24054-10-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-6.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-6.smtp.seeweb.it Cc: daniel.thompson@linaro.org Subject: [LTP] [PATCH v4 9/9] syscalls/sync_file_range: 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" sync_file_range02 tests to sync file data range 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 + .../kernel/syscalls/sync_file_range/.gitignore | 1 + .../syscalls/sync_file_range/sync_file_range02.c | 72 ++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 testcases/kernel/syscalls/sync_file_range/sync_file_range02.c diff --git a/runtest/syscalls b/runtest/syscalls index aaad651..70d3561 100644 --- a/runtest/syscalls +++ b/runtest/syscalls @@ -1353,6 +1353,7 @@ syncfs01 syncfs01 #testcases for sync_file_range sync_file_range01 sync_file_range01 +sync_file_range02 sync_file_range02 syscall01 syscall01 diff --git a/testcases/kernel/syscalls/sync_file_range/.gitignore b/testcases/kernel/syscalls/sync_file_range/.gitignore index 3f6bd75..e6485f7 100644 --- a/testcases/kernel/syscalls/sync_file_range/.gitignore +++ b/testcases/kernel/syscalls/sync_file_range/.gitignore @@ -1 +1,2 @@ /sync_file_range01 +/sync_file_range02 diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c new file mode 100644 index 0000000..37ea68a --- /dev/null +++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2019 Linaro Limited. All rights reserved. + * Author: Sumit Garg + */ + +/* + * sync_file_range02 + * + * It basically tests sync_file_range() to sync test file range 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" +#include "lapi/sync_file_range.h" +#include "check_sync_file_range.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_sync_file_range(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(sync_file_range(fd, 0, TST_FILE_SIZE_MB * SIZE_MB, + SYNC_FILE_RANGE_WAIT_BEFORE | + SYNC_FILE_RANGE_WRITE | + SYNC_FILE_RANGE_WAIT_AFTER)); + + if (TST_RET) + tst_brk(TFAIL | TTERRNO, "sync_file_range() 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 range synced to device"); + else + tst_res(TFAIL, "Failed to sync test file range to device"); +} + +static void setup(void) +{ + if (!check_sync_file_range()) + tst_brk(TCONF, "sync_file_range() not supported"); +} + +static struct tst_test test = { + .needs_root = 1, + .mount_device = 1, + .all_filesystems = 1, + .mntpoint = MNTPOINT, + .setup = setup, + .test_all = verify_sync_file_range, +};