* Thu Apr 22 2021 Tomas Bzatek <tbzatek@redhat.com> - 2.9.2-5

- Fix Drive.ATA test failures

Resolves: #1950051
This commit is contained in:
Tomas Bzatek 2021-04-22 18:40:51 +02:00
parent c660bcf168
commit 9e81bb0fce
6 changed files with 120 additions and 9 deletions

View File

@ -1 +0,0 @@
1

View File

@ -1,5 +0,0 @@
---
standard-inventory-qcow2:
qemu:
m: 5G

View File

@ -33,7 +33,10 @@
tests:
- start-lsmd:
dir: .
run: "systemctl start libstoragemgmt.service"
run: "systemctl start libstoragemgmt.service; systemctl status libstoragemgmt.service; exit 0"
- start-iscsi:
dir: .
run: "systemctl start iscsi-init.service; systemctl status iscsi-init.service; exit 0"
- udisksctl-dump:
dir: .
run: "/usr/bin/udisksctl dump"
@ -41,7 +44,9 @@
- increase-timeouts:
dir: ./source/src/tests/
run: "find -name '*.py' -or -name integration-test | while read i; do sed -e 's/time\\.sleep(/time.sleep(5*/' -i $i; done"
- define-test-modules:
dir: ./source/src/tests/dbus-tests/
run: "echo \"UDISKS_MODULES_ENABLED = { 'lvm2', 'iscsi', 'lsm' }\" > config_h.py"
- dbus-tests-start:
dir: .

View File

@ -0,0 +1,64 @@
From c21ad308b1313a35cafa1664e5eb4772925bc005 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Thu, 22 Apr 2021 18:05:29 +0200
Subject: [PATCH 1/2] tests: Mark Drive.ATA tests as unstable
Some of the tests operate on physical ATA drives, comparing values between
smartctl output and udisks. Different libraries used, different approach
to retrieve some ATA features and values. Turned out this is not working
correctly on some SATA disks with each approach giving slightly different
results, presumably for the quirks in place.
---
src/tests/dbus-tests/test_drive_ata.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/tests/dbus-tests/test_drive_ata.py b/src/tests/dbus-tests/test_drive_ata.py
index 3187367e..e91bd02f 100644
--- a/src/tests/dbus-tests/test_drive_ata.py
+++ b/src/tests/dbus-tests/test_drive_ata.py
@@ -4,7 +4,7 @@ import re
import unittest
import time
-from udiskstestcase import UdisksTestCase
+import udiskstestcase
SMART_CMDLINE_FAIL = 1 << 0
SMART_OPEN_READ_FAIL = 1 << 1
@@ -32,7 +32,7 @@ def _get_sata_disks():
for disk in _get_sata_disks():
- ret, out = UdisksTestCase.run_command("smartctl -a /dev/%s" % disk)
+ ret, out = udiskstestcase.UdisksTestCase.run_command("smartctl -a /dev/%s" % disk)
# Only the following bits in the exit status mean the device failed to
# provide valid SMART data, others may be set for different reasons (see
@@ -46,7 +46,7 @@ for disk in _get_sata_disks():
else:
smart_unsupported.add(disk)
-class UdisksDriveAtaTest(UdisksTestCase):
+class UdisksDriveAtaTest(udiskstestcase.UdisksTestCase):
'''Noninvasive tests for the Drive.Ata interface'''
def get_smart_setting(self, disk, attr, out_prefix):
@@ -102,6 +102,7 @@ class UdisksDriveAtaTest(UdisksTestCase):
intro_data = drive_intro.Introspect()
self.assertNotIn('interface name="org.freedesktop.UDisks2.Drive.Ata"', intro_data)
+ @udiskstestcase.tag_test(udiskstestcase.TestTags.UNSTABLE)
@unittest.skipUnless(smart_supported, "No disks supporting S.M.A.R.T. available")
def test_properties(self):
for disk in smart_supported:
@@ -148,6 +149,7 @@ class UdisksDriveAtaTest(UdisksTestCase):
# ninth field is the raw value
self.assertEqual(int(pwon_s.value / 3600), int(pwon_attr[8]))
+ @udiskstestcase.tag_test(udiskstestcase.TestTags.UNSTABLE)
@unittest.skipUnless(smart_supported, "No disks supporting S.M.A.R.T. available")
def test_smart_get_attributes(self):
for disk in smart_supported:
--
2.30.2

View File

@ -0,0 +1,43 @@
From 1358d1e5208d71d5a70f17a242eda00f079a9d0b Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Thu, 22 Apr 2021 18:20:48 +0200
Subject: [PATCH 2/2] tests: Handle missing /dev/disk/by-path gracefully
Limited testing environments may not have this path always available.
---
src/tests/dbus-tests/test_drive_ata.py | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/tests/dbus-tests/test_drive_ata.py b/src/tests/dbus-tests/test_drive_ata.py
index e91bd02f..37740c60 100644
--- a/src/tests/dbus-tests/test_drive_ata.py
+++ b/src/tests/dbus-tests/test_drive_ata.py
@@ -20,14 +20,17 @@ DISK_PATH = "/dev/disk/by-path/"
def _get_sata_disks():
sata_disks = []
- by_path = os.listdir(DISK_PATH)
- for dev in by_path:
- if "ata" in dev and "part" not in dev:
- path = os.path.realpath(os.path.join(DISK_PATH, dev))
- name = os.path.basename(path)
- if name.startswith("sd"):
- # ignore devices like CD drives etc.
- sata_disks.append(name)
+ try:
+ by_path = os.listdir(DISK_PATH)
+ for dev in by_path:
+ if "ata" in dev and "part" not in dev:
+ path = os.path.realpath(os.path.join(DISK_PATH, dev))
+ name = os.path.basename(path)
+ if name.startswith("sd"):
+ # ignore devices like CD drives etc.
+ sata_disks.append(name)
+ except:
+ pass
return sata_disks
--
2.30.2

View File

@ -48,7 +48,7 @@
Name: udisks2
Summary: Disk Manager
Version: 2.9.2
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2+
URL: https://github.com/storaged-project/udisks
Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2
@ -62,6 +62,8 @@ Patch5: udisks-2.10.0-g_mkdtemp-leak.patch
Patch6: udisks-2.10.0-mdraid-iochannel-data.patch
Patch7: udisks-2.10.0-mdraid-g_source_attach.patch
Patch8: udisks-2.10.0-Ignore-Extended-Boot-Loader-GPT-partition.patch
Patch9: udisks-2.10.0-tests-drive_ata-apm.patch
Patch10: udisks-2.10.0-tests-no-dev_disk-by-path.patch
BuildRequires: make
BuildRequires: glib2-devel >= %{glib2_version}
@ -437,6 +439,9 @@ fi
%endif
%changelog
* Thu Apr 22 2021 Tomas Bzatek <tbzatek@redhat.com> - 2.9.2-5
- Fix Drive.ATA test failures
* Tue Apr 20 2021 Tomas Bzatek <tbzatek@redhat.com> - 2.9.2-4
- Fix a couple of issues found by Coverity (#1938890)
- Ignore systemd "Extended Boot Loader" GPT partition