2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc. All Rights Reserved.
7 # Test directory mtime and ctime are updated when moving a file onto an
8 # existing file in the directory
10 # Regression test for commit:
11 # 0b23076 ext3: fix update of mtime and ctime on rename
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
17 status=0 # success is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
23 rm -rf $TEST_DIR/testdir_$seq
24 rm -f $TEST_DIR/testfile.$seq
27 # get standard environment, filters and checks
31 # real QA test starts here
36 echo "Silence is golden"
38 mkdir -p $TEST_DIR/testdir_$seq
39 touch $TEST_DIR/testdir_$seq/testfile
40 touch $TEST_DIR/testfile.$seq
42 mtime1=`stat -c %Y $TEST_DIR/testdir_$seq`
43 ctime1=`stat -c %Z $TEST_DIR/testdir_$seq`
46 mv $TEST_DIR/testfile.$seq $TEST_DIR/testdir_$seq/testfile
48 mtime2=`stat -c %Y $TEST_DIR/testdir_$seq`
49 ctime2=`stat -c %Z $TEST_DIR/testdir_$seq`
51 if [ "$mtime1" == "$mtime2" ]; then
52 echo "mtime not updated"
55 if [ "$ctime1" == "$ctime2" ]; then
56 echo "ctime not updated"