generic: add test for boundary in xfs_attr_shortform_verify
[xfstests-dev.git] / tests / generic / 245
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2010 Christoph Hellwig.  All Rights Reserved.
4 #
5 # FS QA Test No. 245
6 #
7 # Check that directory renames onto non-empty targets fail
8 #
9 # Based on a bug report and testcase from  Vlado Plaga <rechner@vlado-do.de>
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18
19 # get standard environment, filters and checks
20 . ./common/rc
21 . ./common/filter
22
23 # real QA test starts here
24 _supported_fs generic
25 _supported_os Linux
26 _require_test
27
28 dir=$TEST_DIR/test-mv
29
30 _cleanup()
31 {
32         rm -rf $dir
33 }
34
35 # According to the rename(2) manpage you can get either EEXIST or ENOTEMPTY as an
36 # error for trying to rename a non-empty directory, so just catch the error for
37 # ENOTMEMPTY and replace it with the EEXIST output so that either result passes
38 _filter_directory_not_empty()
39 {
40         sed -e "s,Directory not empty,File exists,g"
41 }
42  
43 trap "_cleanup ; exit \$status" 0 1 2 3 15
44
45 mkdir $dir
46
47 mkdir $dir/aa
48 mkdir $dir/ab
49 touch $dir/aa/1
50 mkdir $dir/ab/aa
51 touch $dir/ab/aa/2
52
53 mv $dir/ab/aa/ $dir 2>&1 | _filter_test_dir | _filter_directory_not_empty
54
55 status=0
56 exit $status