Skip to content

Commit 4500373

Browse files
Merge pull request #1356 from vojtechtrefny/master_tests-parted-remove
tests: Use sfdisk instead of parted to create partitions in tests
2 parents 7830d04 + fc3bd75 commit 4500373

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

misc/udisks-tasks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
- python3-monotonic
5151
- cryptsetup
5252
- vdo
53-
- parted
53+
- util-linux
5454
when: ansible_distribution == 'Fedora'
5555

5656
####### CentOS
@@ -107,5 +107,5 @@
107107
- python3-systemd
108108
- cryptsetup
109109
- vdo
110-
- parted
110+
- util-linux
111111
when: ansible_distribution == 'CentOS'

src/tests/dbus-tests/test_loop.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ def test_40_create_read_only(self):
197197
@udiskstestcase.tag_test(udiskstestcase.TestTags.UNSTABLE)
198198
def test_50_create_no_part_scan(self):
199199
# create a partition on the file (future loop device)
200-
ret, out = self.run_command("parted %s mklabel msdos" % self.LOOP_DEVICE_FILENAME)
200+
ret, out = self.run_command("echo -e 'label:dos' | sfdisk %s" % self.LOOP_DEVICE_FILENAME)
201201
self.assertEqual(ret, 0)
202-
ret, out = self.run_command("parted %s mkpart primary ext2 1 10" % self.LOOP_DEVICE_FILENAME)
202+
ret, out = self.run_command("echo -e 'size=9M, type=L\n' | sfdisk %s" % self.LOOP_DEVICE_FILENAME)
203203
self.assertEqual(ret, 0)
204204

205205
opts = dbus.Dictionary({"no-part-scan": dbus.Boolean(True)}, signature=dbus.Signature('sv'))

src/tests/integration-test

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,16 +1185,13 @@ class Fstab(UDisksTestCase):
11851185
cls.orig_fstab = '/etc/fstab.udiskstest'
11861186
shutil.copy2('/etc/fstab', cls.orig_fstab)
11871187

1188-
# create one partition
1189-
subprocess.check_call(
1190-
['parted', '-s', cls.device, 'mklabel', 'gpt'], stdout=subprocess.PIPE)
1191-
subprocess.check_call(
1192-
['parted', '-s', cls.device, 'mkpart', 'primary', '0', '64'],
1193-
stdout=subprocess.PIPE)
11941188
cls.p1label = 'udtestp1'
1195-
subprocess.check_call(
1196-
['parted', '-s', cls.device, 'name', '1', cls.p1label],
1197-
stdout=subprocess.PIPE)
1189+
1190+
# create one partition
1191+
subprocess.check_call("echo -e 'label:gpt' | sfdisk %s" % cls.device,
1192+
stdout=subprocess.PIPE, shell=True)
1193+
subprocess.check_call("echo -e 'size=60M, type=L, name=%s\n' | sfdisk %s" % (cls.p1label, cls.device),
1194+
stdout=subprocess.PIPE, shell=True)
11981195
cls.sync()
11991196
blkid = subprocess.check_output(
12001197
['blkid', '-oudev', '-p', cls.devname(1)], universal_newlines=True).splitlines()

0 commit comments

Comments
 (0)