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: 10812287 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 82E2613B4 for ; Thu, 14 Feb 2019 10:01:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 740BF2CA1A for ; Thu, 14 Feb 2019 10:01:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 682742CCD9; Thu, 14 Feb 2019 10:01:21 +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=unavailable 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 04A3F2CA1A for ; Thu, 14 Feb 2019 10:01:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438182AbfBNKBU (ORCPT ); Thu, 14 Feb 2019 05:01:20 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:43530 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438159AbfBNKBK (ORCPT ); Thu, 14 Feb 2019 05:01:10 -0500 Received: by mail-pg1-f194.google.com with SMTP id v28so2804044pgk.10 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=knmunug9L2fcie8obOIavlq4+OoJihfJzE1of2f1/zfLhZmXgkx98MuFQl27GkXoDZ 2g/kcb20LuB67l2lEpILT1Yv1kj67xIT3+i041fOJUAfCzkmplKW0sk53c3N8byQYBvX WBie/gmNDlU5pSMhTHr6o7vvqUcLCceUngqHpO3XTVG0IH2prbxQ6VI2crId0jGXG/Em tsYIiXC1lKlkVjereXycys/Gu9UblvFERElwAkdnHMso8WOrzO7F3T4X3Ne49On57oGV bgteFnvQ3VhhYTujrPaIvGXAS0/jxKtJ9O8plHxAD3Ngk97bzeKH1Q9ReUQwjeW0evXs Ihtg== X-Gm-Message-State: AHQUAub7EO03yvtLPpgq/C8x2KAhXCosJ4uosEWmW0O7TG4BCGz4ytfu nr6AQTm0exD9PKxHuzFNWuU/GQ== 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-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@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