Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Use sfdisk instead of parted to create partitions in tests #1356

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions misc/udisks-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- python3-monotonic
- cryptsetup
- vdo
- parted
- util-linux
when: ansible_distribution == 'Fedora'

####### CentOS
Expand Down Expand Up @@ -107,5 +107,5 @@
- python3-systemd
- cryptsetup
- vdo
- parted
- util-linux
when: ansible_distribution == 'CentOS'
4 changes: 2 additions & 2 deletions src/tests/dbus-tests/test_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ def test_40_create_read_only(self):
@udiskstestcase.tag_test(udiskstestcase.TestTags.UNSTABLE)
def test_50_create_no_part_scan(self):
# create a partition on the file (future loop device)
ret, out = self.run_command("parted %s mklabel msdos" % self.LOOP_DEVICE_FILENAME)
ret, out = self.run_command("echo -e 'label:dos' | sfdisk %s" % self.LOOP_DEVICE_FILENAME)
self.assertEqual(ret, 0)
ret, out = self.run_command("parted %s mkpart primary ext2 1 10" % self.LOOP_DEVICE_FILENAME)
ret, out = self.run_command("echo -e 'size=9M, type=L\n' | sfdisk %s" % self.LOOP_DEVICE_FILENAME)
self.assertEqual(ret, 0)

opts = dbus.Dictionary({"no-part-scan": dbus.Boolean(True)}, signature=dbus.Signature('sv'))
Expand Down
15 changes: 6 additions & 9 deletions src/tests/integration-test
Original file line number Diff line number Diff line change
Expand Up @@ -1185,16 +1185,13 @@ class Fstab(UDisksTestCase):
cls.orig_fstab = '/etc/fstab.udiskstest'
shutil.copy2('/etc/fstab', cls.orig_fstab)

# create one partition
subprocess.check_call(
['parted', '-s', cls.device, 'mklabel', 'gpt'], stdout=subprocess.PIPE)
subprocess.check_call(
['parted', '-s', cls.device, 'mkpart', 'primary', '0', '64'],
stdout=subprocess.PIPE)
cls.p1label = 'udtestp1'
subprocess.check_call(
['parted', '-s', cls.device, 'name', '1', cls.p1label],
stdout=subprocess.PIPE)

# create one partition
subprocess.check_call("echo -e 'label:gpt' | sfdisk %s" % cls.device,
stdout=subprocess.PIPE, shell=True)
subprocess.check_call("echo -e 'size=60M, type=L, name=%s\n' | sfdisk %s" % (cls.p1label, cls.device),
stdout=subprocess.PIPE, shell=True)
cls.sync()
blkid = subprocess.check_output(
['blkid', '-oudev', '-p', cls.devname(1)], universal_newlines=True).splitlines()
Expand Down