blob: a63827b1139b14c8b1f8ffef28b706161a5f6715 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2019 Oracle, Inc. All Rights Reserved.
#
# FS QA Test No. 528
#
# Check that statx btime (aka creation time) is plausibly close to when
# we created a file. A bug caught during code review of xfs patches revealed
# that there weren't any sanity checks of the btime values.
#
. ./common/preamble
_begin_fstest auto quick
testfile=$TEST_DIR/$seq.txt
# Override the default cleanup function.
_cleanup()
{
cd /
rm -f $tmp.* $testfile
}
# Import common functions.
. ./common/attr
. ./common/filter
# real QA test starts here
_supported_fs generic
_require_test
_require_xfs_io_command "statx" "-r"
_require_btime
rm -f $testfile
# Create a file and the time we created it
now=$(date +%s)
touch $testfile
# Make sure the reported btime is within 5 seconds of the time we recorded
# just prior to creating the file.
btime=$(date +%s -d "$($XFS_IO_PROG -c "statx -v -m $STATX_BTIME" $testfile | \
grep 'stat.btime =' | cut -d '=' -f 2)")
test -n "$btime" || echo "error: did not see btime in output??"
_within_tolerance "btime" "$btime" "$now" 1 5 -v
status=0
exit
|