l.h.s.t.t.TestHWDBSubmissionProcessing(TestCaseHWDB) : class documentation

Part of lp.hardwaredb.scripts.tests.test_hwdb_submission_processing View In Hierarchy

Tests for processing of HWDB submissions.
Method test_buildDeviceList Test of SubmissionParser.buildDeviceList().
Method test_buildHalDeviceList Test the creation of list HALDevice instances for a submission.
Method makeUdevDeviceParsedData Build test data that can be passed to buildUdevDevice().
Method test_buildUdevDeviceList Test the creation of UdevDevice instances for a submission.
Method test_buildUdevDeviceList_root_node_has_dmi_data The root node of a udev submissions has DMI data.
Method test_buildUdevDeviceList_sysfs_data Optional sysfs data is passed to UdevDevice instances.
Method test_buildUdevDeviceList_no_sysfs_data Sysfs data is not required (maverick and natty submissions).
Method test_buildUdevDeviceList_invalid_device_path Test the creation of UdevDevice instances for a submission.
Method test_buildUdevDeviceList_missing_root_device Test the creation of UdevDevice instances for a submission.
Method test_kernel_package_name_hal_data Test of SubmissionParser.kernel_package_name.
Method test_kernel_package_hal_data_name_inconsistent Test of SubmissionParser.kernel_package_name.
Method test_kernel_package_name_hal_data_no_kernel_version_in_hal_data Test of SubmissionParser.kernel_package_name.
Method test_kernel_package_name_hal_data_no_package_data Test of SubmissionParser.kernel_package_name.
Method test_kernel_package_name_udev_data Test of SubmissionParser.kernel_package_name for udev data.
Method test_kernel_package_udev_data_name_inconsistent Test of SubmissionParser.kernel_package_name.
Method test_kernel_package_name_udev_data_no_kernel_version_in_summary Test of SubmissionParser.kernel_package_name.
Method test_kernel_package_name_udev_data_no_package_data Test of SubmissionParser.kernel_package_name.
Method testHALDeviceConstructor Test of the HALDevice constructor.
Method testHALDeviceGetProperty Test of HALDevice.getProperty.
Method testHALDeviceParentUDI Test of HALDevice.parent_udi.
Method testHALDeviceDeviceId Test of HALDevice.device_id.
Method testHALDevicePciClass Test of HALDevice.pci_class.
Method testHALDevicePciSubClass Test of HALDevice.pci_subclass.
Method testHALDeviceUsbVendorId Test of HALDevice.usb_vendor_id.
Method testHALDeviceUsbProductId Test of HALDevice.usb_product_id.
Method testHALDeviceScsiVendor Test of HALDevice.scsi_vendor.
Method testHALDeviceScsiModel Test of HALDevice.scsi_model.
Method testHALDeviceDriverName Test of HALDevice.driver_name.
Method testHalDeviceRawBus test of HALDevice.raw_bus.
Method test_HALDevice_scsi_controller_usb_storage_device test of HALDevice.scsi_controller.
Method test_HALDevice_scsi_controller_pci_controller test of HALDevice.scsi_controller.
Method test_HALDevice_scsi_controller_non_scsi_device test of HALDevice.scsi_controller.
Method test_HALDevice_scsi_controller_no_grandparent test of HALDevice.scsi_controller.
Method test_HALDevice_scsi_controller_no_parent test of HALDevice.scsi_controller.
Method testHALDeviceGetRealBus Test of HALDevice.real_bus, generic case.
Method testHALDeviceGetRealBusSystem Test of HALDevice.real_bus, for the tested machine itself.
Method testHALDeviceGetRealBusScsiUsb Test of HALDevice.real_bus for info.bus=='scsi' and a USB device.
Method testHALDeviceGetRealBusScsiPci Test of HALDevice.real_bus for info.bus=='scsi'.
Method testHALDeviceGetRealBusScsiDeviceWithoutGrandparent Test of HALDevice.real_bus for a device without a grandparent.
Method testHALDeviceGetRealBusScsiDeviceWithoutParent Test of HALDevice.real_bus for a device without a parent.
Method testHALDeviceGetRealBusScsiDeviceWithBogusPciGrandparent Test of HALDevice.real_bus for a device with a bogus grandparent.
Method testHALDeviceGetRealBusPci Test of HALDevice.real_bus for info.bus=='pci'.
Method testHALDeviceGetRealBusUnknown Test of HALDevice.real_bus for unknown values of info.bus.
Method test_HALDevice_is_root_device_for_root_device Test of HALDevice.is_root_device for the root device.
Method test_HALDevice_is_root_device_for_non_root_device Test of HALDevice.is_root_device for a non-root device.
Method renameInfoBusToInfoSubsystem Rename the property info.bus in a device list to info.subsystem.
Method testHALDeviceRealDeviceRegularBus Test of HALDevice.is_real_device: regular info.bus property.
Method testHALDeviceRealDeviceNoBus Test of HALDevice.is_real_device: No info.bus property.
Method testHALDeviceRealDeviceHALBusValueIgnored Test of HALDevice.is_real_device: ignored values of info.bus.
Method runTestHALDeviceRealDeviceScsiDevicesPciController Test of HALDevice.is_real_device: info.bus == 'scsi'.
Method testHALDeviceRealDeviceScsiDevicesPciController Test of HALDevice.is_real_device: info.bus == 'scsi'.
Method testHALDeviceRealDeviceScsiDeviceUsbStorage Test of HALDevice.is_real_device: info.bus == 'scsi'.
Method testHALDeviceRealDeviceRootDevice Test of HALDevice.is_real_device for the root node.
Method testHALDeviceRealChildren Test of HALDevice.getRealChildren.
Method testHasReliableDataRegularCase Test of HALDevice.has_reliable_data, regular case.
Method testHasReliableDataNotProcessible Test of HALDevice.has_reliable_data, bus without reliable data.
Method testHasReliableDataRootDevice Test of HALDevice.has_reliable_data, root device.
Method testHasReliableDataForInsuffientData Test of HALDevice.has_reliable_data, insufficent device data.
Method testHasReliableDataIDEDevice Test of HALDevice.has_reliable_data, for IDE devices.
Method testHALDeviceSCSIVendorModelNameRegularCase Test of HALDevice.getScsiVendorAndModelName, regular case.
Method testHALDeviceSCSIVendorModelNameATADiskShortModelName Test of HALDevice.getScsiVendorAndModelName, ATA disk (1).
Method testHALDeviceSCSIVendorModelNameATADiskLongModelName Test of HALDevice.getScsiVendorAndModelName, ATA disk (2).
Method testHALDeviceVendorFromInfoVendor Test of HALDevice.vendor, regular case.
Method testHALDeviceVendorFromBusVendor Test of HALDevice.vendor, value copied from ${bus}.vendor.
Method testHALDeviceVendorScsi Test of HALDevice.vendor for SCSI devices: regular case.
Method testHALDeviceVendorScsiAta Test of HALDevice.vendor for SCSI devices: fake IDE/SATA disks.
Method testHALDeviceVendorSystem Test of HALDevice.vendor for the machine itself.
Method testHALDeviceProductFromInfoProduct Test of HALDevice.product, regular case.
Method testHALDeviceProductFromBusProduct Test of HALDevice.product, value copied from ${bus}.product.
Method testHALDeviceProductScsi Test of HALDevice.product for SCSI devices: regular case.
Method testHALDeviceProductScsiAta Test of HALDevice.product for SCSI devices: fake IDE/SATA disks.
Method testHALDeviceProductSystem Test of HALDevice.product for the machine itself.
Method testHALDeviceVendorId Test of HALDevice.vendor_id.
Method testHALDeviceVendorIdScsi Test of HALDevice.vendor_id for SCSI devices.
Method testHALDeviceVendorIdScsiAta Test of HALDevice.vendor_id for SCSI devices: fake IDE/SATA disks.
Method testHALDeviceVendorIdSystem Test of HALDevice.vendor_id for the machine itself.
Method testHALDeviceProductId Test of HALDevice.product_id.
Method testHALDeviceProductIdScsi Test of HALDevice.product_id for SCSI devices.
Method testHALDeviceProductIdScsiAta Test of HALDevice.product_id for SCSI devices: fake IDE/SATA disks.
Method testHALDeviceProductIdSystem Test of HALDevice.product_id for the machine itself.
Method testVendorIDForDB Test of HALDevice.vendor_id_for_db.
Method testVendorIDForDBSystem Test of HALDevice.vendor_id_for_db.
Method testProductIDForDB Test of HALDevice.product_id_for_db.
Method testProductIDForDBSystem Test of HALDevice.product_id_for_db.

Inherited from TestCaseHWDB:

Method setUp Setup the test environment.
Method assertWarningMessage Search for message in the log entries for submission_key.
Method assertErrorMessage Search for log_message in the log entries for submission_key.

Inherited from TestCase (via TestCaseHWDB):

Method becomeDbUser Commit, then log into the database as dbuser.
Method __str__ The string representation of a test is its id.
Method useContext Use the supplied context in this test.
Method makeTemporaryDirectory Create a temporary directory, and return its path.
Method installKarmaRecorder Set up and return a KarmaRecorder.
Method assertProvides Assert 'obj' correctly provides 'interface'.
Method assertNotifies Assert that a callable performs a given notification.
Method assertNoNotification Assert that no notifications are generated by the callable.
Method assertSqlAttributeEqualsDate Fail unless the value of the attribute is equal to the date.
Method assertTextMatchesExpressionIgnoreWhitespace Undocumented
Method assertIsInstance Assert that an instance is an instance of assert_class.
Method assertIsNot Assert that expected is not the same object as observed.
Method assertContentEqual Assert that 'iter1' has the same content as 'iter2'.
Method assertRaisesWithContent Check if the given exception is raised with given content.
Method assertBetween Assert that 'variable' is strictly between two boundaries.
Method assertVectorEqual Apply assertEqual to all given pairs in one go.
Method expectedLog Expect a log to be written that matches the regex.
Method pushConfig Push some key-value pairs into a section of the config.
Method attachOopses Undocumented
Method attachLibrarianLog Include the logChunks from fixture in the test details.
Method assertStatementCount Assert that the expected number of SQL statements occurred.
Method useTempDir Use a temporary directory for this test.
Method assertEmailHeadersEqual Assert that two email headers are equal.
Method assertStartsWith Undocumented
Method assertEndsWith Asserts that s ends with suffix.
Method checkPermissions Check if the used_permissions match expected_permissions.
Method assertEmailQueueLength Pop the email queue, assert its length, and return it.
Method _unfoldEmailHeader Unfold a multiline email header.
def test_buildDeviceList(self):
Test of SubmissionParser.buildDeviceList().
def test_buildHalDeviceList(self):
Test the creation of list HALDevice instances for a submission.
def makeUdevDeviceParsedData(self, paths, sysfs_data=None):
Build test data that can be passed to buildUdevDevice().
def test_buildUdevDeviceList(self):
Test the creation of UdevDevice instances for a submission.
def test_buildUdevDeviceList_root_node_has_dmi_data(self):
The root node of a udev submissions has DMI data.
def test_buildUdevDeviceList_sysfs_data(self):
Optional sysfs data is passed to UdevDevice instances.
def test_buildUdevDeviceList_no_sysfs_data(self):
Sysfs data is not required (maverick and natty submissions).
def test_buildUdevDeviceList_invalid_device_path(self):
Test the creation of UdevDevice instances for a submission.

All device paths must start with '/devices'. Any other device path makes the submission invalid.

def test_buildUdevDeviceList_missing_root_device(self):
Test the creation of UdevDevice instances for a submission.

Each submission must contain a udev node for the root device.

def test_kernel_package_name_hal_data(self):
Test of SubmissionParser.kernel_package_name.

Regular case.

def test_kernel_package_hal_data_name_inconsistent(self):
Test of SubmissionParser.kernel_package_name.

Test a name inconsistency.

def test_kernel_package_name_hal_data_no_kernel_version_in_hal_data(self):
Test of SubmissionParser.kernel_package_name.

Test without HAL property system.kernel.version.

def test_kernel_package_name_hal_data_no_package_data(self):
Test of SubmissionParser.kernel_package_name.

Test without any package data. In this case, SubmissionParser.kernel_package_name is the value of the property system.kernel.version if the root HAL device. No further checks are done.

def test_kernel_package_name_udev_data(self):
Test of SubmissionParser.kernel_package_name for udev data.

Variant for udev data, regular case.

def test_kernel_package_udev_data_name_inconsistent(self):
Test of SubmissionParser.kernel_package_name.

Variant for udev data, name inconsistency.

def test_kernel_package_name_udev_data_no_kernel_version_in_summary(self):
Test of SubmissionParser.kernel_package_name.

Test without the summary sub-node <kernel-release>.

def test_kernel_package_name_udev_data_no_package_data(self):
Test of SubmissionParser.kernel_package_name.

Variant for udev data, test without any package data. In this case, SubmissionParser.kernel_package_name is the value of the property system.kernel.version if the root HAL device. No further checks are done.

def testHALDeviceConstructor(self):
Test of the HALDevice constructor.
def testHALDeviceGetProperty(self):
Test of HALDevice.getProperty.
def testHALDeviceParentUDI(self):
Test of HALDevice.parent_udi.
def testHALDeviceDeviceId(self):
Test of HALDevice.device_id.
def testHALDevicePciClass(self):
Test of HALDevice.pci_class.
def testHALDevicePciSubClass(self):
Test of HALDevice.pci_subclass.
def testHALDeviceUsbVendorId(self):
Test of HALDevice.usb_vendor_id.
def testHALDeviceUsbProductId(self):
Test of HALDevice.usb_product_id.
def testHALDeviceScsiVendor(self):
Test of HALDevice.scsi_vendor.
def testHALDeviceScsiModel(self):
Test of HALDevice.scsi_model.
def testHALDeviceDriverName(self):
Test of HALDevice.driver_name.
def testHalDeviceRawBus(self):
test of HALDevice.raw_bus.
def test_HALDevice_scsi_controller_usb_storage_device(self):
test of HALDevice.scsi_controller.

The physical device is a USB storage device.

def test_HALDevice_scsi_controller_pci_controller(self):
test of HALDevice.scsi_controller.

Variant for a SCSI device connected to a PCI controller.

def test_HALDevice_scsi_controller_non_scsi_device(self):
test of HALDevice.scsi_controller.

Variant for non-SCSI devices.

def test_HALDevice_scsi_controller_no_grandparent(self):
test of HALDevice.scsi_controller.

Variant for a SCSI device without a grandparent device.

def test_HALDevice_scsi_controller_no_parent(self):
test of HALDevice.scsi_controller.

Variant for a SCSI device without a parent device.

def testHALDeviceGetRealBus(self):
Test of HALDevice.real_bus, generic case.

For most buses as "seen" by HAL, HALDevice.real_bus returns a unique HWBus value.

def testHALDeviceGetRealBusSystem(self):
Test of HALDevice.real_bus, for the tested machine itself.
def testHALDeviceGetRealBusScsiUsb(self):
Test of HALDevice.real_bus for info.bus=='scsi' and a USB device.

Memory sticks, card readers and USB->IDE/SATA adapters use SCSI emulation; HALDevice.real_bus treats these devices as "black boxes", and thus returns None.

def testHALDeviceGetRealBusScsiPci(self):
Test of HALDevice.real_bus for info.bus=='scsi'.

Many non-SCSI devices support the SCSI command, and the Linux kernel can treat them like SCSI devices. The real bus of these devices can be found by looking at the PCI class and subclass of the host controller of the possibly fake SCSI device. The real bus of these device can be IDE, ATA, SATA or SCSI.

def testHALDeviceGetRealBusScsiDeviceWithoutGrandparent(self):
Test of HALDevice.real_bus for a device without a grandparent.
def testHALDeviceGetRealBusScsiDeviceWithoutParent(self):
Test of HALDevice.real_bus for a device without a parent.
def testHALDeviceGetRealBusScsiDeviceWithBogusPciGrandparent(self):
Test of HALDevice.real_bus for a device with a bogus grandparent.

The PCI device class must be PCI_CLASS_STORAGE.

def testHALDeviceGetRealBusPci(self):
Test of HALDevice.real_bus for info.bus=='pci'.

If info.bus == 'pci', we may have a real PCI device or a PCCard.

def testHALDeviceGetRealBusUnknown(self):
Test of HALDevice.real_bus for unknown values of info.bus.
def test_HALDevice_is_root_device_for_root_device(self):
Test of HALDevice.is_root_device for the root device.
def test_HALDevice_is_root_device_for_non_root_device(self):
Test of HALDevice.is_root_device for a non-root device.
def renameInfoBusToInfoSubsystem(self, devices):
Rename the property info.bus in a device list to info.subsystem.

Older HAL version store the device bus in the property info.bus; newer versions store the bus in info.subsystem.

The parameter devices is a list of dictionaries as used in the methods below. This method replaces all dictionary entries with the key info.bus by entries with the key info.subsystem in order to allow easy testing of both variants.

def testHALDeviceRealDeviceRegularBus(self):
Test of HALDevice.is_real_device: regular info.bus property.

See below for exceptions, if info.bus == 'usb_device' or if info.bus == 'usb'.

def testHALDeviceRealDeviceNoBus(self):
Test of HALDevice.is_real_device: No info.bus property.
def testHALDeviceRealDeviceHALBusValueIgnored(self):
Test of HALDevice.is_real_device: ignored values of info.bus.

A HAL device is considered to not be a real device, if its info.bus proerty is 'drm', 'dvb', 'memstick_host', 'net', 'scsi_generic', 'scsi_host', 'sound', 'ssb', 'tty', 'usb' or 'video4linux'.

def runTestHALDeviceRealDeviceScsiDevicesPciController(self, devices, bus_property_name):
Test of HALDevice.is_real_device: info.bus == 'scsi'.

The (fake or real) SCSI device is connected to a PCI controller. Though the real bus may not be SCSI, all devices for the busses SCSI, IDE, ATA, SATA, SAS are treated as real devices.

def testHALDeviceRealDeviceScsiDevicesPciController(self):
Test of HALDevice.is_real_device: info.bus == 'scsi'.

The (fake or real) SCSI device is connected to a PCI controller. Though the real bus may not be SCSI, all devices for the busses SCSI, IDE, ATA, SATA, SAS are treated as real devices.

def testHALDeviceRealDeviceScsiDeviceUsbStorage(self):
Test of HALDevice.is_real_device: info.bus == 'scsi'.

USB storage devices are treated as SCSI devices by HAL; we do not consider them to be real devices.

def testHALDeviceRealDeviceRootDevice(self):
Test of HALDevice.is_real_device for the root node.
def testHALDeviceRealChildren(self):
Test of HALDevice.getRealChildren.
def testHasReliableDataRegularCase(self):
Test of HALDevice.has_reliable_data, regular case.
def testHasReliableDataNotProcessible(self):
Test of HALDevice.has_reliable_data, bus without reliable data.
def testHasReliableDataRootDevice(self):
Test of HALDevice.has_reliable_data, root device.

The root device has the info.subsystem or info.bus property set to 'unknown'. While we treat other devices with ths bus value as useless, the root device is real.

def testHasReliableDataForInsuffientData(self):
Test of HALDevice.has_reliable_data, insufficent device data.

Test for a HAL device that should be processible but does not provide enough data. Aside from a bus, we need a vendor ID, a product ID and a product name.

def testHasReliableDataIDEDevice(self):
Test of HALDevice.has_reliable_data, for IDE devices.

Many IDE devices do not provide vendor and product IDs. This is a known problem and hence not worth a log message.

def testHALDeviceSCSIVendorModelNameRegularCase(self):
Test of HALDevice.getScsiVendorAndModelName, regular case.
def testHALDeviceSCSIVendorModelNameATADiskShortModelName(self):
Test of HALDevice.getScsiVendorAndModelName, ATA disk (1).

Test of an ATA disk with a short model name. The Linux kenrel sets the vendor name to "ATA" and inserts the real vendor name into the model string.

def testHALDeviceSCSIVendorModelNameATADiskLongModelName(self):
Test of HALDevice.getScsiVendorAndModelName, ATA disk (2).

Test of an ATA disk with a short model name. The Linux kenrel sets the vendor name to "ATA" and ignores the real vendor name,

def testHALDeviceVendorFromInfoVendor(self):
Test of HALDevice.vendor, regular case.

The value is copied from info.vendor, if available.

def testHALDeviceVendorFromBusVendor(self):
Test of HALDevice.vendor, value copied from ${bus}.vendor.

If the property info.vendor does not exist, ${bus}.vendor is tried.

def testHALDeviceVendorScsi(self):
Test of HALDevice.vendor for SCSI devices: regular case.
def testHALDeviceVendorScsiAta(self):
Test of HALDevice.vendor for SCSI devices: fake IDE/SATA disks.
def testHALDeviceVendorSystem(self):
Test of HALDevice.vendor for the machine itself.
def testHALDeviceProductFromInfoProduct(self):
Test of HALDevice.product, regular case.

The value is copied from info.product, if available.

def testHALDeviceProductFromBusProduct(self):
Test of HALDevice.product, value copied from ${bus}.product.

If the property info.product does not exist, ${bus}.product

def testHALDeviceProductScsi(self):
Test of HALDevice.product for SCSI devices: regular case.
def testHALDeviceProductScsiAta(self):
Test of HALDevice.product for SCSI devices: fake IDE/SATA disks.
def testHALDeviceProductSystem(self):
Test of HALDevice.product for the machine itself.
def testHALDeviceVendorId(self):
Test of HALDevice.vendor_id.

Many buses have a numerical vendor ID. Except for the special cases tested below, HWDevice.vendor_id returns the HAL property ${bus}.vendor_id.

def testHALDeviceVendorIdScsi(self):
Test of HALDevice.vendor_id for SCSI devices.

The SCSI specification does not know about a vendor ID, we use the vendor string as returned by INQUIRY command as the ID.

def testHALDeviceVendorIdScsiAta(self):
Test of HALDevice.vendor_id for SCSI devices: fake IDE/SATA disks.
def testHALDeviceVendorIdSystem(self):
Test of HALDevice.vendor_id for the machine itself.
def testHALDeviceProductId(self):
Test of HALDevice.product_id.

Many buses have a numerical product ID. Except for the special cases tested below, HWDevice.product_id returns the HAL property ${bus}.product_id.

def testHALDeviceProductIdScsi(self):
Test of HALDevice.product_id for SCSI devices.

The SCSI specification does not know about a product ID, we use the product string as returned by INQUIRY command as the ID.

def testHALDeviceProductIdScsiAta(self):
Test of HALDevice.product_id for SCSI devices: fake IDE/SATA disks.
def testHALDeviceProductIdSystem(self):
Test of HALDevice.product_id for the machine itself.
def testVendorIDForDB(self):
Test of HALDevice.vendor_id_for_db.
def testVendorIDForDBSystem(self):
Test of HALDevice.vendor_id_for_db.
def testProductIDForDB(self):
Test of HALDevice.product_id_for_db.
def testProductIDForDBSystem(self):
Test of HALDevice.product_id_for_db.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.