Merge ~canonical-kernel-team/+git/autotest-client-tests:phlin/xfstests-loopdev into ~canonical-kernel-team/+git/autotest-client-tests:master

Proposed by Po-Hsu Lin
Status: Merged
Merged at revision: 89adabb73aa7d5aebad6358d4da54545dacbe686
Proposed branch: ~canonical-kernel-team/+git/autotest-client-tests:phlin/xfstests-loopdev
Merge into: ~canonical-kernel-team/+git/autotest-client-tests:master
Diff against target: 239 lines (+42/-24)
6 files modified
ubuntu_xfstests_btrfs/control.ubuntu (+6/-6)
ubuntu_xfstests_btrfs/create-test-partitions (+8/-2)
ubuntu_xfstests_ext4/control.ubuntu (+6/-6)
ubuntu_xfstests_ext4/create-test-partitions (+8/-2)
ubuntu_xfstests_xfs/control.ubuntu (+6/-6)
ubuntu_xfstests_xfs/create-test-partitions (+8/-2)
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Review via email: mp+446174@code.launchpad.net

Commit message

Use loop device for the test, courtesy to Francis who add this code
on AWS cloud first. This patch was ported from there and rebased
on the xfstest build fix (LP: #2008049), and use /dev/loop0 for
finding which free loop device to use.

By doing so we can avoid destroying data in /dev/sdb accidentally.
Also it can reduce the hardware limit of this test, it will no
longer require a scratch drive to run but just 100G free disk space.

Description of the change

The required 100G disk space might be debatable here. But I didn't try out to see how much disk space we need.

The next thing we need to do is:
 * Add some limitation to this test, so that it won't be tested with smaller instances.
 * Improve the test granularity to make it easier to read / debug with
 * (Optional) Cherry-pick the test cases like what we did for ubuntu_zfs_xfs_generic test

To post a comment you must log in.
Revision history for this message
Sean Feole (sfeole) wrote :

According to the XFSTests doc, the biggest disk exercised is 20GB ( This is only for BIGTEST and BIGSCRATCH tests & bigalloc_4k)
https://github.com/tytso/xfstests-bld/blob/master/Documentation/what-is-xfstests.md

I don't see a problem with lowering 100GB -> 20GB unless there is some urgent need for it.

Revision history for this message
Francis Ginther (fginther) wrote :

The "#DEVICE=$1" lines can be removed, otherwise this looks good. Thanks for taking this over the finish line.

This *should* work as is bare-metal hosts where we likely have a sufficiently large root disk. The cloud VMs would need work as I don't know of any instance that gives us 100GB or more by default. However, we did start down the path of having some "custom deploy" logic would is specified in the a-c-t directories and then acted upon by ckct when deploying the instance. This ran into some problems, but I think we could solve them given some more attention.

review: Approve
Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

Applied with size reduced to 20G and the "#DEVICE=$1" lines removed.
Let's see how it goes.
Thanks!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/ubuntu_xfstests_btrfs/control.ubuntu b/ubuntu_xfstests_btrfs/control.ubuntu
2index 69fce73..78eb9b9 100644
3--- a/ubuntu_xfstests_btrfs/control.ubuntu
4+++ b/ubuntu_xfstests_btrfs/control.ubuntu
5@@ -14,13 +14,13 @@ for uarg in args:
6 key, val = uarg.split('=')
7 argdict[key] = val
8
9-# For right now, all of our (Ubuntu) testing makes use of a single,
10-# scratch device.
11+# Use a free loop device for the test, so it's less hardware dependent and safer.
12+# Only use a scratch device when requested.
13 #
14 if 'UBUNTU_SCRATCH_DEVICE' in argdict:
15 device = argdict['UBUNTU_SCRATCH_DEVICE']
16 else:
17- device = '/dev/sdb'
18+ device = utils.system_output('losetup -f')
19
20
21 # Create all the partitions we want. These are determined by looking
22@@ -38,7 +38,7 @@ else:
23 os.environ['XFSTESTS_TEST_DRIVE'] = device
24
25 # TEST_DEV: "device containing TEST PARTITION"
26-os.environ['TEST_DEV'] = '%s1' % device
27+os.environ['TEST_DEV'] = '%sp1' % device
28
29 # TEST_DIR: "mount point of TEST PARTITION"
30 test_mountpoint = os.path.join(job.tmpdir, 'xfstests-test')
31@@ -47,7 +47,7 @@ if not os.path.isdir(test_mountpoint):
32 os.environ['TEST_DIR'] = test_mountpoint
33
34 # SCRATCH_DEV "device containing SCRATCH PARTITION"
35-os.environ['SCRATCH_DEV'] = '%s2' % device
36+os.environ['SCRATCH_DEV'] = '%sp2' % device
37
38 # SCRATCH_MNT "mount point for SCRATCH PARTITION"
39 # By default, we create a directory under autotest
40@@ -59,7 +59,7 @@ if not os.path.isdir(scratch_mountpoint):
41 os.environ['SCRATCH_MNT'] = scratch_mountpoint
42
43 # SCRATCH_LOGDEV "device for scratch-fs external log"
44-os.environ['SCRATCH_LOGDEV'] = '/dev/sdb3'
45+os.environ['SCRATCH_LOGDEV'] = '%sp3' % device
46
47 # SCRATCH_RTDEV "device for scratch-fs realtime data"
48 # os.environ['SCRATCH_RTDEV'] = ''
49diff --git a/ubuntu_xfstests_btrfs/create-test-partitions b/ubuntu_xfstests_btrfs/create-test-partitions
50index 089bea6..67cb1ec 100644
51--- a/ubuntu_xfstests_btrfs/create-test-partitions
52+++ b/ubuntu_xfstests_btrfs/create-test-partitions
53@@ -3,7 +3,12 @@
54
55 set +x
56
57-DEVICE=$1
58+# Create the block_file and loop device, this would require 20G (count=20 * 1G)
59+# disk space as suggested in what-is-xfstests.md from XFSTests doc
60+sudo dd if=/dev/zero of=/block_file bs=1G count=20
61+sudo losetup -fP /block_file
62+DEVICE=$(sudo losetup -a|grep block_file|cut -d":" -f1)
63+
64 FS=$2
65
66 if [ -z $DEVICE ]; then
67@@ -48,11 +53,12 @@ fi
68
69 sleep 60 # Give things a minute to settle before creating new partitions
70
71+ORIG_DEVICE=${DEVICE}
72 [[ $DEVICE =~ ^/dev/loop[0-9]{1,}$ ]] && DEVICE=${DEVICE}p
73
74 for i in `seq 1 5`
75 do
76 sudo mkfs.$FS $FS_OPT ${DEVICE}$i
77 done
78-sudo parted $DEVICE print
79+sudo parted $ORIG_DEVICE print
80
81diff --git a/ubuntu_xfstests_ext4/control.ubuntu b/ubuntu_xfstests_ext4/control.ubuntu
82index f81ecde..4561ced 100644
83--- a/ubuntu_xfstests_ext4/control.ubuntu
84+++ b/ubuntu_xfstests_ext4/control.ubuntu
85@@ -14,13 +14,13 @@ for uarg in args:
86 key, val = uarg.split('=')
87 argdict[key] = val
88
89-# For right now, all of our (Ubuntu) testing makes use of a single,
90-# scratch device.
91+# Use a free loop device for the test, so it's less hardware dependent and safer.
92+# Only use a scratch device when requested.
93 #
94 if 'UBUNTU_SCRATCH_DEVICE' in argdict:
95 device = argdict['UBUNTU_SCRATCH_DEVICE']
96 else:
97- device = '/dev/sdb'
98+ device = utils.system_output('losetup -f')
99
100
101 # Create all the partitions we want. These are determined by looking
102@@ -38,7 +38,7 @@ else:
103 os.environ['XFSTESTS_TEST_DRIVE'] = device
104
105 # TEST_DEV: "device containing TEST PARTITION"
106-os.environ['TEST_DEV'] = '%s1' % device
107+os.environ['TEST_DEV'] = '%sp1' % device
108
109 # TEST_DIR: "mount point of TEST PARTITION"
110 test_mountpoint = os.path.join(job.tmpdir, 'xfstests-test')
111@@ -47,7 +47,7 @@ if not os.path.isdir(test_mountpoint):
112 os.environ['TEST_DIR'] = test_mountpoint
113
114 # SCRATCH_DEV "device containing SCRATCH PARTITION"
115-os.environ['SCRATCH_DEV'] = '%s2' % device
116+os.environ['SCRATCH_DEV'] = '%sp2' % device
117
118 # SCRATCH_MNT "mount point for SCRATCH PARTITION"
119 # By default, we create a directory under autotest
120@@ -59,7 +59,7 @@ if not os.path.isdir(scratch_mountpoint):
121 os.environ['SCRATCH_MNT'] = scratch_mountpoint
122
123 # SCRATCH_LOGDEV "device for scratch-fs external log"
124-os.environ['SCRATCH_LOGDEV'] = '/dev/sdb3'
125+os.environ['SCRATCH_LOGDEV'] = '%sp3' % device
126
127 # SCRATCH_RTDEV "device for scratch-fs realtime data"
128 # os.environ['SCRATCH_RTDEV'] = ''
129diff --git a/ubuntu_xfstests_ext4/create-test-partitions b/ubuntu_xfstests_ext4/create-test-partitions
130index 089bea6..67cb1ec 100644
131--- a/ubuntu_xfstests_ext4/create-test-partitions
132+++ b/ubuntu_xfstests_ext4/create-test-partitions
133@@ -3,7 +3,12 @@
134
135 set +x
136
137-DEVICE=$1
138+# Create the block_file and loop device, this would require 20G (count=20 * 1G)
139+# disk space as suggested in what-is-xfstests.md from XFSTests doc
140+sudo dd if=/dev/zero of=/block_file bs=1G count=20
141+sudo losetup -fP /block_file
142+DEVICE=$(sudo losetup -a|grep block_file|cut -d":" -f1)
143+
144 FS=$2
145
146 if [ -z $DEVICE ]; then
147@@ -48,11 +53,12 @@ fi
148
149 sleep 60 # Give things a minute to settle before creating new partitions
150
151+ORIG_DEVICE=${DEVICE}
152 [[ $DEVICE =~ ^/dev/loop[0-9]{1,}$ ]] && DEVICE=${DEVICE}p
153
154 for i in `seq 1 5`
155 do
156 sudo mkfs.$FS $FS_OPT ${DEVICE}$i
157 done
158-sudo parted $DEVICE print
159+sudo parted $ORIG_DEVICE print
160
161diff --git a/ubuntu_xfstests_xfs/control.ubuntu b/ubuntu_xfstests_xfs/control.ubuntu
162index 0cfad11..4e2c7ea 100644
163--- a/ubuntu_xfstests_xfs/control.ubuntu
164+++ b/ubuntu_xfstests_xfs/control.ubuntu
165@@ -14,13 +14,13 @@ for uarg in args:
166 key, val = uarg.split('=')
167 argdict[key] = val
168
169-# For right now, all of our (Ubuntu) testing makes use of a single,
170-# scratch device.
171+# Use a free loop device for the test, so it's less hardware dependent and safer.
172+# Only use a scratch device when requested.
173 #
174 if 'UBUNTU_SCRATCH_DEVICE' in argdict:
175 device = argdict['UBUNTU_SCRATCH_DEVICE']
176 else:
177- device = '/dev/sdb'
178+ device = utils.system_output('losetup -f')
179
180
181 # Create all the partitions we want. These are determined by looking
182@@ -38,7 +38,7 @@ else:
183 os.environ['XFSTESTS_TEST_DRIVE'] = device
184
185 # TEST_DEV: "device containing TEST PARTITION"
186-os.environ['TEST_DEV'] = '%s1' % device
187+os.environ['TEST_DEV'] = '%sp1' % device
188
189 # TEST_DIR: "mount point of TEST PARTITION"
190 test_mountpoint = os.path.join(job.tmpdir, 'xfstests-test')
191@@ -47,7 +47,7 @@ if not os.path.isdir(test_mountpoint):
192 os.environ['TEST_DIR'] = test_mountpoint
193
194 # SCRATCH_DEV "device containing SCRATCH PARTITION"
195-os.environ['SCRATCH_DEV'] = '%s2' % device
196+os.environ['SCRATCH_DEV'] = '%sp2' % device
197
198 # SCRATCH_MNT "mount point for SCRATCH PARTITION"
199 # By default, we create a directory under autotest
200@@ -59,7 +59,7 @@ if not os.path.isdir(scratch_mountpoint):
201 os.environ['SCRATCH_MNT'] = scratch_mountpoint
202
203 # SCRATCH_LOGDEV "device for scratch-fs external log"
204-os.environ['SCRATCH_LOGDEV'] = '/dev/sdb3'
205+os.environ['SCRATCH_LOGDEV'] = '%sp3' % device
206
207 # SCRATCH_RTDEV "device for scratch-fs realtime data"
208 # os.environ['SCRATCH_RTDEV'] = ''
209diff --git a/ubuntu_xfstests_xfs/create-test-partitions b/ubuntu_xfstests_xfs/create-test-partitions
210index 089bea6..67cb1ec 100644
211--- a/ubuntu_xfstests_xfs/create-test-partitions
212+++ b/ubuntu_xfstests_xfs/create-test-partitions
213@@ -3,7 +3,12 @@
214
215 set +x
216
217-DEVICE=$1
218+# Create the block_file and loop device, this would require 20G (count=20 * 1G)
219+# disk space as suggested in what-is-xfstests.md from XFSTests doc
220+sudo dd if=/dev/zero of=/block_file bs=1G count=20
221+sudo losetup -fP /block_file
222+DEVICE=$(sudo losetup -a|grep block_file|cut -d":" -f1)
223+
224 FS=$2
225
226 if [ -z $DEVICE ]; then
227@@ -48,11 +53,12 @@ fi
228
229 sleep 60 # Give things a minute to settle before creating new partitions
230
231+ORIG_DEVICE=${DEVICE}
232 [[ $DEVICE =~ ^/dev/loop[0-9]{1,}$ ]] && DEVICE=${DEVICE}p
233
234 for i in `seq 1 5`
235 do
236 sudo mkfs.$FS $FS_OPT ${DEVICE}$i
237 done
238-sudo parted $DEVICE print
239+sudo parted $ORIG_DEVICE print
240

Subscribers

People subscribed via source and target branches

to all changes: