Link: https://github.com/koverstreet/bcachefs/issues/743 Signed-off-by: Alyssa Ross <hi@xxxxxxxxx> --- This is an adapted version of generic/258, but it tests that the stored timestamp is accurate to the second, rather than just testing the timestamp remains negative. I created a new test rather than just making 258 more precise, because I understand that there may be filesystems that don't store timestamps that accurately by design. As an example, I've heard that FAT only has 2 second precision, so this patch is an RFC because I'm not sure how I should write a _require function (if at all) that restricts the test to filesystems that are expected to be able to do this. tests/generic/363 | 26 ++++++++++++++++++++++++++ tests/generic/363.out | 2 ++ 2 files changed, 28 insertions(+) create mode 100755 tests/generic/363 create mode 100644 tests/generic/363.out diff --git a/tests/generic/363 b/tests/generic/363 new file mode 100755 index 00000000..50459d01 --- /dev/null +++ b/tests/generic/363 @@ -0,0 +1,26 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2011 Red Hat, Inc. All Rights Reserved. +# Copyright (c) 2024 Alyssa Ross. All Rights Reserved. +# +# FS QA Test 363 +# +# Test timestamps prior to epoch with nanosecond components are +# accurate to the second. +# bcachefs was slightly off. +# +. ./common/preamble +_begin_fstest auto quick bigtime + +_require_test +_require_negative_timestamps + +TESTFILE=$TEST_DIR/timestamp-test.txt + +# Create a file with a timestamp prior to the epoch +touch -d "1969-07-20T03:55:59.750000000+0100" $TESTFILE +stat -c %X $TESTFILE + +# success, all done +status=0 +exit diff --git a/tests/generic/363.out b/tests/generic/363.out new file mode 100644 index 00000000..052bacfd --- /dev/null +++ b/tests/generic/363.out @@ -0,0 +1,2 @@ +QA output created by 363 +-14245441 -- 2.45.2