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
35 echo "Silence is golden"
37 mkdir -p $TEST_DIR/testdir_$seq
38 touch $TEST_DIR/testdir_$seq/testfile
39 touch $TEST_DIR/testfile.$seq
41 mtime1=`stat -c %Y $TEST_DIR/testdir_$seq`
42 ctime1=`stat -c %Z $TEST_DIR/testdir_$seq`
45 mv $TEST_DIR/testfile.$seq $TEST_DIR/testdir_$seq/testfile
47 mtime2=`stat -c %Y $TEST_DIR/testdir_$seq`
48 ctime2=`stat -c %Z $TEST_DIR/testdir_$seq`
50 if [ "$mtime1" == "$mtime2" ]; then
51 echo "mtime not updated"
54 if [ "$ctime1" == "$ctime2" ]; then
55 echo "ctime not updated"