generic: test for non-zero used blocks while writing into a file
[xfstests-dev.git] / tests / overlay / 007
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test 007
6 #
7 # Test getcwd() failure after unsuccessful rmdir
8 #
9 # Upstream commit ce9113bbcbf4 ("ovl: fix getcwd() failure after unsuccessful
10 # rmdir") fixed this issue
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23         cd /
24         rm -f $tmp.*
25         rm -rf $TEST_DIR/$seq
26 }
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31
32 rm -f $seqres.full
33
34 # real QA test starts here
35 _supported_fs overlay
36 _require_test
37
38 rm -rf $TEST_DIR/$seq
39
40 # make a non-empty dir $seq
41 mkdir -p $TEST_DIR/$seq/$seq.sub
42 # cd to it and call rmdir on it, rmdir should fail
43 cd $TEST_DIR/$seq
44 rmdir ../$seq >>$seqres.full 2>&1
45 # getcwd should return the correct current dir
46 pwd | _filter_test_dir
47
48 # success, all done
49 status=0
50 exit