2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2021 Oracle. All Rights Reserved.
7 # Functional testing for xfs_admin to ensure that it parses arguments correctly
8 # with regards to data devices that are files, external logs, and realtime
11 # Because this test synthesizes log and rt devices (by modifying the test run
12 # configuration), it does /not/ require the ability to mount the scratch
13 # filesystem. This increases test coverage while isolating the weird bits to a
16 # This is partially a regression test for "xfs_admin: pick up log arguments
17 # correctly", insofar as the issue fixed by that patch was discovered with an
18 # earlier revision of this test.
21 _begin_fstest auto quick admin
23 # Override the default cleanup function.
27 rm -f $tmp.* $fake_logfile $fake_rtfile $fake_datafile
30 # Import common functions.
33 # real QA test starts here
36 _require_scratch_nocheck
37 _require_command "$XFS_ADMIN_PROG" "xfs_admin"
39 # Create some fake sparse files for testing external devices and whatnot
40 fake_datafile=$TEST_DIR/$seq.scratch.data
42 truncate -s 500m $fake_datafile
44 fake_logfile=$TEST_DIR/$seq.scratch.log
46 truncate -s 500m $fake_logfile
48 fake_rtfile=$TEST_DIR/$seq.scratch.rt
50 truncate -s 500m $fake_rtfile
52 # Save the original variables
53 orig_ddev=$SCRATCH_DEV
54 orig_external=$USE_EXTERNAL
55 orig_logdev=$SCRATCH_LOGDEV
56 orig_rtdev=$SCRATCH_RTDEV
59 echo "$@" | tee -a $seqres.full
61 SCRATCH_DEV=$orig_ddev
62 USE_EXTERNAL=$orig_external
63 SCRATCH_LOGDEV=$orig_logdev
64 SCRATCH_RTDEV=$orig_rtdev
68 _scratch_mkfs -L oldlabel >> $seqres.full
69 _scratch_xfs_db -c label
70 _scratch_xfs_admin -L newlabel "$@" >> $seqres.full
71 _scratch_xfs_db -c label
72 _scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
75 scenario "S1: Check that label setting with file image"
76 SCRATCH_DEV=$fake_datafile
79 scenario "S2: Check that setting with logdev works"
81 SCRATCH_LOGDEV=$fake_logfile
84 scenario "S3: Check that setting with rtdev works"
86 SCRATCH_RTDEV=$fake_rtfile
89 scenario "S4: Check that setting with rtdev + logdev works"
91 SCRATCH_LOGDEV=$fake_logfile
92 SCRATCH_RTDEV=$fake_rtfile
95 scenario "S5: Check that setting with nortdev + nologdev works"
101 scenario "S6: Check that setting with bdev incorrectly flagged as file works"