From patchwork Thu Feb 14 10:00:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10812273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1451E13B4 for ; Thu, 14 Feb 2019 10:01:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 017B72CA1A for ; Thu, 14 Feb 2019 10:01:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E97D02CD3E; Thu, 14 Feb 2019 10:01:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 440B12CA1A for ; Thu, 14 Feb 2019 10:01:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438166AbfBNKBL (ORCPT ); Thu, 14 Feb 2019 05:01:11 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:44760 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438156AbfBNKBK (ORCPT ); Thu, 14 Feb 2019 05:01:10 -0500 Received: by mail-pg1-f195.google.com with SMTP id y1so2799509pgk.11 for ; Thu, 14 Feb 2019 02:01:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V1G1bYaq+Km34RtW+askrdx+tkF2tFwueJG4dIbkPeU=; b=ifdVfFk0kW/IIFB8WwdV72Z5zOa+dcqSXcayZEKzpjOldBkQtPG1dDGADxg7jRHanq lqtuH6c3Ts3p6Pw00eubcFHxMZ1LVcx2dtxQWTJ3PEPQ0fsnsvn7hVeMxPjiTHpXhjI/ lHRli2E/l7df8XeZytTiC73YTJKLizSkB+RLKQlM6lXI8jtqAt9g/jZb/zrAMGebK58K ulj6ICONDTdHq4S5eLU/nw7h1wpfwpjqmTlbjSzuRFyEtFc50jWRdr+9u7wUiZu6Gb+L CvgUt/mpWsuK8cjMmOfCD6R4BAAcWMEpNktr7ZtmajNLsKcyni7oZep2kZB4x3v7Um/r OwaA== 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:mime-version:content-transfer-encoding; bh=V1G1bYaq+Km34RtW+askrdx+tkF2tFwueJG4dIbkPeU=; b=tcRr1wmzwuuf5pJl3jR8rvk7Q9RE4jT8E8YK6ZbpjCILuyAomYObo2f1qxxf7/yAFz EPJ/e1hi+pq+Tt0AV8+YAyaLrxP78nnDIMQs2maowb2md+uBhzAKDbMClo3K63d1Vrvj St0OmCTuQXJjzH/i+V1RtM3C0PafPsqzz63NDT78bRlkqsdno1Sz+6UDaYa1nBwqbV7S XmxldYXFS3gAFjprLlsAV5UPKQx8WFUN/XHen2rJTa8/h/R3CpgcBuMuM8f2cPqPuvL1 DY2as82eKL41aqDnyQ9iyYWb5HkbEZL57myE8Bub2o609kcmPPmOg57tMlzoTIr2sDGv hFKw== X-Gm-Message-State: AHQUAuZGlS5RdG+Cz57I40C/3gSJbF15DzYWRQi2rbHwa/BH40F5LUba we5xQMKAyd4tfeJpTO9yZ28IoA== X-Google-Smtp-Source: AHgI3IZIAJ2VnYK3yffJToNRbYzNLIRAyaxiNDlheljliI94feBaBjQoFhYs3ER9wmq+6PXudHZ08g== X-Received: by 2002:a65:4101:: with SMTP id w1mr2941529pgp.257.1550138469062; Thu, 14 Feb 2019 02:01:09 -0800 (PST) Received: from vader.thefacebook.com ([2620:10d:c090:180::1:5849]) by smtp.gmail.com with ESMTPSA id i184sm2686952pfc.41.2019.02.14.02.01.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 02:01:08 -0800 (PST) From: Omar Sandoval To: linux-fsdevel@vger.kernel.org, Al Viro Cc: kernel-team@fb.com, linux-api@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org Subject: [PATCH] generic: add a test for AT_UTIME_BTIME Date: Thu, 14 Feb 2019 02:00:14 -0800 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval Test that on filesystems supporting btime, the timestamp is updated as expected. Signed-off-by: Omar Sandoval --- common/rc | 14 ++++++++++ tests/generic/526 | 64 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/526.out | 14 ++++++++++ tests/generic/group | 1 + 4 files changed, 93 insertions(+) create mode 100755 tests/generic/526 create mode 100644 tests/generic/526.out diff --git a/common/rc b/common/rc index b8ed1776..d2f43a21 100644 --- a/common/rc +++ b/common/rc @@ -3843,6 +3843,20 @@ _require_btime() rm -f $TEST_DIR/test_creation_time } +_require_utime_btime() +{ + _require_btime + _require_xfs_io_command utimes + testio=`$XFS_IO_PROG -f -c "utimes 0 0 0 0 0 0" "$TEST_DIR/$$.xfs_io" 2>&1` + echo $testio | grep -q "expected 4 arguments" && \ + _notrun "xfs_io utimes btime support is missing" + echo $testio | grep -q "Operation not supported" && \ + _notrun "updating inode creation time not supported by this filesystem" + echo $testio | grep -q "Invalid" && \ + _notrun "updating inode creation time not supported by this kernel" + rm -f $testfile > /dev/null 2>&1 +} + _require_scratch_btime() { _require_scratch diff --git a/tests/generic/526 b/tests/generic/526 new file mode 100755 index 00000000..c2e47a27 --- /dev/null +++ b/tests/generic/526 @@ -0,0 +1,64 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2019 Omar Sandoval. All Rights Reserved. +# +# FS QA Test 526 +# +# Test basic AT_UTIME_BTIME functionality. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* + rm -f "$TEST_DIR/$$" +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full +_supported_fs generic +_supported_os Linux +_require_test +_require_utime_btime + +SEC=683153828 +UTIME_NOW=$(((1 << 30) - 1)) +UTIME_OMIT=$(((1 << 30) - 2)) + +touch "$TEST_DIR/$$" + +echo "Set btime" +$XFS_IO_PROG -c "utimes 0 $UTIME_OMIT 0 $UTIME_OMIT $SEC 0" "$TEST_DIR/$$" +$XFS_IO_PROG -c 'statx -r' "$TEST_DIR/$$" | grep btime + +echo "Set atime and mtime" +$XFS_IO_PROG -c "utimes 0 $UTIME_NOW 0 $UTIME_NOW" "$TEST_DIR/$$" +$XFS_IO_PROG -c 'statx -r' "$TEST_DIR/$$" | grep btime + +echo "Omit btime" +$XFS_IO_PROG -c "utimes 0 $UTIME_NOW 0 $UTIME_NOW 0 $UTIME_OMIT" "$TEST_DIR/$$" +$XFS_IO_PROG -c 'statx -r' "$TEST_DIR/$$" | grep btime + +echo "Cycle mount" +_test_cycle_mount +$XFS_IO_PROG -c 'statx -r' "$TEST_DIR/$$" | grep btime + +echo "Set btime to now" +$XFS_IO_PROG -c "utimes 0 $UTIME_OMIT 0 $UTIME_OMIT 0 $UTIME_NOW" "$TEST_DIR/$$" +# The timestamp changed, so this shouldn't output anything. +$XFS_IO_PROG -c 'statx -r' "$TEST_DIR/$$" | grep -w "$SEC" + +status=0 +exit diff --git a/tests/generic/526.out b/tests/generic/526.out new file mode 100644 index 00000000..f9ec18e9 --- /dev/null +++ b/tests/generic/526.out @@ -0,0 +1,14 @@ +QA output created by 526 +Set btime +stat.btime.tv_sec = 683153828 +stat.btime.tv_nsec = 0 +Set atime and mtime +stat.btime.tv_sec = 683153828 +stat.btime.tv_nsec = 0 +Omit btime +stat.btime.tv_sec = 683153828 +stat.btime.tv_nsec = 0 +Cycle mount +stat.btime.tv_sec = 683153828 +stat.btime.tv_nsec = 0 +Set btime to now diff --git a/tests/generic/group b/tests/generic/group index cfd003d3..2e0203fc 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -528,3 +528,4 @@ 523 auto quick attr 524 auto quick 525 auto quick rw +526 auto quick