xfs/419: remove irrelevant swapfile test
[xfstests-dev.git] / tests / xfs / 156
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2021 Oracle.  All Rights Reserved.
4 #
5 # FS QA Test No. 156
6 #
7 # Functional testing for xfs_admin to make sure that it handles option parsing
8 # correctly for functionality that's relevant to V5 filesystems.  It doesn't
9 # test the options that apply only to V4 filesystems because that disk format
10 # is deprecated.
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 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # real QA test starts here
32 _supported_fs xfs
33 _require_scratch
34 _require_command "$XFS_ADMIN_PROG" "xfs_admin"
35
36 rm -f $seqres.full
37
38 note() {
39         echo "$@" | tee -a $seqres.full
40 }
41
42 note "S0: Initialize filesystem"
43 _scratch_mkfs -L origlabel -m uuid=babababa-baba-baba-baba-babababababa >> $seqres.full
44 _scratch_xfs_db -c label -c uuid
45 _scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
46
47 note "S1: Set a filesystem label"
48 _scratch_xfs_admin -L newlabel >> $seqres.full
49 _scratch_xfs_db -c label
50 _scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
51
52 note "S2: Clear filesystem label"
53 _scratch_xfs_admin -L -- >> $seqres.full
54 _scratch_xfs_db -c label
55 _scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
56
57 note "S3: Try to set oversized label"
58 _scratch_xfs_admin -L thisismuchtoolongforxfstohandle >> $seqres.full
59 _scratch_xfs_db -c label
60 _scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
61
62 note "S4: Set filesystem UUID"
63 _scratch_xfs_admin -U deaddead-dead-dead-dead-deaddeaddead >> $seqres.full
64 _scratch_xfs_db -c uuid
65 _scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
66
67 note "S5: Zero out filesystem UUID"
68 _scratch_xfs_admin -U nil >> $seqres.full
69 _scratch_xfs_db -c uuid
70 _scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
71
72 note "S6: Randomize filesystem UUID"
73 old_uuid="$(_scratch_xfs_db -c uuid)"
74 _scratch_xfs_admin -U generate >> $seqres.full
75 new_uuid="$(_scratch_xfs_db -c uuid)"
76 if [ "$new_uuid" = "$old_uuid" ]; then
77         echo "UUID randomization failed? $old_uuid == $new_uuid"
78 fi
79 _scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
80
81 note "S7: Restore original filesystem UUID"
82 if _check_scratch_xfs_features V5 >/dev/null; then
83         # Only V5 supports the metauuid feature that enables us to restore the
84         # original UUID after a change.
85         _scratch_xfs_admin -U restore >> $seqres.full
86         _scratch_xfs_db -c uuid
87 else
88         echo "UUID = babababa-baba-baba-baba-babababababa"
89 fi
90
91 # success, all done
92 status=0
93 exit