blob: 8222d7eee9332a4182fcf8eb7c79318036853e7b (
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2021 Oracle. All Rights Reserved.
#
# FS QA Test No. 157
#
# Functional testing for xfs_admin to ensure that it parses arguments correctly
# with regards to data devices that are files, external logs, and realtime
# devices.
#
# Because this test synthesizes log and rt devices (by modifying the test run
# configuration), it does /not/ require the ability to mount the scratch
# filesystem. This increases test coverage while isolating the weird bits to a
# single test.
#
# This is partially a regression test for "xfs_admin: pick up log arguments
# correctly", insofar as the issue fixed by that patch was discovered with an
# earlier revision of this test.
. ./common/preamble
_begin_fstest auto quick admin
# Override the default cleanup function.
_cleanup()
{
cd /
rm -f $tmp.* $fake_logfile $fake_rtfile $fake_datafile
}
# Import common functions.
. ./common/filter
# real QA test starts here
_supported_fs xfs
_require_test
_require_scratch_nocheck
_require_command "$XFS_ADMIN_PROG" "xfs_admin"
# Create some fake sparse files for testing external devices and whatnot
fake_datafile=$TEST_DIR/$seq.scratch.data
rm -f $fake_datafile
truncate -s 500m $fake_datafile
fake_logfile=$TEST_DIR/$seq.scratch.log
rm -f $fake_logfile
truncate -s 500m $fake_logfile
fake_rtfile=$TEST_DIR/$seq.scratch.rt
rm -f $fake_rtfile
truncate -s 500m $fake_rtfile
# Save the original variables
orig_ddev=$SCRATCH_DEV
orig_external=$USE_EXTERNAL
orig_logdev=$SCRATCH_LOGDEV
orig_rtdev=$SCRATCH_RTDEV
scenario() {
echo "$@" | tee -a $seqres.full
SCRATCH_DEV=$orig_ddev
USE_EXTERNAL=$orig_external
SCRATCH_LOGDEV=$orig_logdev
SCRATCH_RTDEV=$orig_rtdev
}
check_label() {
_scratch_mkfs -L oldlabel >> $seqres.full
_scratch_xfs_db -c label
_scratch_xfs_admin -L newlabel "$@" >> $seqres.full
_scratch_xfs_db -c label
_scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
}
scenario "S1: Check that label setting with file image"
SCRATCH_DEV=$fake_datafile
check_label -f
scenario "S2: Check that setting with logdev works"
USE_EXTERNAL=yes
SCRATCH_LOGDEV=$fake_logfile
check_label
scenario "S3: Check that setting with rtdev works"
USE_EXTERNAL=yes
SCRATCH_RTDEV=$fake_rtfile
check_label
scenario "S4: Check that setting with rtdev + logdev works"
USE_EXTERNAL=yes
SCRATCH_LOGDEV=$fake_logfile
SCRATCH_RTDEV=$fake_rtfile
check_label
scenario "S5: Check that setting with nortdev + nologdev works"
USE_EXTERNAL=
SCRATCH_LOGDEV=
SCRATCH_RTDEV=
check_label
scenario "S6: Check that setting with bdev incorrectly flagged as file works"
check_label -f
# success, all done
status=0
exit
|