blob: 75418805d1f41a1a72325c3a8fa04961a8804352 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2021 Oracle. All Rights Reserved.
#
# FS QA Test No. 156
#
# Functional testing for xfs_admin to make sure that it handles option parsing
# correctly for functionality that's relevant to V5 filesystems. It doesn't
# test the options that apply only to V4 filesystems because that disk format
# is deprecated.
. ./common/preamble
_begin_fstest auto quick admin
# Import common functions.
. ./common/filter
# real QA test starts here
_supported_fs xfs
_require_scratch
_require_command "$XFS_ADMIN_PROG" "xfs_admin"
note() {
echo "$@" | tee -a $seqres.full
}
note "S0: Initialize filesystem"
_scratch_mkfs -L origlabel -m uuid=babababa-baba-baba-baba-babababababa >> $seqres.full
_scratch_xfs_db -c label -c uuid
_scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
note "S1: Set a filesystem label"
_scratch_xfs_admin -L newlabel >> $seqres.full
_scratch_xfs_db -c label
_scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
note "S2: Clear filesystem label"
_scratch_xfs_admin -L -- >> $seqres.full
_scratch_xfs_db -c label
_scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
note "S3: Try to set oversized label"
_scratch_xfs_admin -L thisismuchtoolongforxfstohandle >> $seqres.full
_scratch_xfs_db -c label
_scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
note "S4: Set filesystem UUID"
_scratch_xfs_admin -U deaddead-dead-dead-dead-deaddeaddead >> $seqres.full
_scratch_xfs_db -c uuid
_scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
note "S5: Zero out filesystem UUID"
_scratch_xfs_admin -U nil >> $seqres.full
_scratch_xfs_db -c uuid
_scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
note "S6: Randomize filesystem UUID"
old_uuid="$(_scratch_xfs_db -c uuid)"
_scratch_xfs_admin -U generate >> $seqres.full
new_uuid="$(_scratch_xfs_db -c uuid)"
if [ "$new_uuid" = "$old_uuid" ]; then
echo "UUID randomization failed? $old_uuid == $new_uuid"
fi
_scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
note "S7: Restore original filesystem UUID"
if _check_scratch_xfs_features V5 >/dev/null; then
# Only V5 supports the metauuid feature that enables us to restore the
# original UUID after a change.
_scratch_xfs_admin -U restore >> $seqres.full
_scratch_xfs_db -c uuid
else
echo "UUID = babababa-baba-baba-baba-babababababa"
fi
# success, all done
status=0
exit
|