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 seqres=$RESULT_DIR/$seq
22 echo "QA output created by $seq"
26 status=1 # failure is the default!
27 trap "_cleanup; exit \$status" 0 1 2 3 15
32 rm -f $tmp.* $fake_logfile $fake_rtfile $fake_datafile
35 # get standard environment, filters and checks
39 # real QA test starts here
42 _require_scratch_nocheck
43 _require_command "$XFS_ADMIN_PROG" "xfs_admin"
47 # Create some fake sparse files for testing external devices and whatnot
48 fake_datafile=$TEST_DIR/$seq.scratch.data
50 truncate -s 500m $fake_datafile
52 fake_logfile=$TEST_DIR/$seq.scratch.log
54 truncate -s 500m $fake_logfile
56 fake_rtfile=$TEST_DIR/$seq.scratch.rt
58 truncate -s 500m $fake_rtfile
60 # Save the original variables
61 orig_ddev=$SCRATCH_DEV
62 orig_external=$USE_EXTERNAL
63 orig_logdev=$SCRATCH_LOGDEV
64 orig_rtdev=$SCRATCH_RTDEV
67 echo "$@" | tee -a $seqres.full
69 SCRATCH_DEV=$orig_ddev
70 USE_EXTERNAL=$orig_external
71 SCRATCH_LOGDEV=$orig_logdev
72 SCRATCH_RTDEV=$orig_rtdev
76 _scratch_mkfs -L oldlabel >> $seqres.full
77 _scratch_xfs_db -c label
78 _scratch_xfs_admin -L newlabel "$@" >> $seqres.full
79 _scratch_xfs_db -c label
80 _scratch_xfs_repair -n &>> $seqres.full || echo "Check failed?"
83 scenario "S1: Check that label setting with file image"
84 SCRATCH_DEV=$fake_datafile
87 scenario "S2: Check that setting with logdev works"
89 SCRATCH_LOGDEV=$fake_logfile
92 scenario "S3: Check that setting with rtdev works"
94 SCRATCH_RTDEV=$fake_rtfile
97 scenario "S4: Check that setting with rtdev + logdev works"
99 SCRATCH_LOGDEV=$fake_logfile
100 SCRATCH_RTDEV=$fake_rtfile
103 scenario "S5: Check that setting with nortdev + nologdev works"
109 scenario "S6: Check that setting with bdev incorrectly flagged as file works"