v1: https://www.redhat.com/archives/libvir-list/2014-February/msg01620.html v2: Split the mocked part into a separate file and only build the test on Linux. Remove 'serial' files. Get out of testDeviceFind earlier if failure is expected and use a switch. Switches are nice. Check number of returned devices more often in testUSBList, not just at the end. Ján Tomko (2): Add tests for virUSBDeviceFind functions Add a test for virUSBDeviceList functions .gitignore | 1 + cfg.mk | 3 +- tests/Makefile.am | 22 ++ tests/virusbmock.c | 99 +++++++ tests/virusbtest.c | 292 +++++++++++++++++++++ .../sys_bus_usb/devices/1-1.5.3.1/devnum | 1 + .../sys_bus_usb/devices/1-1.5.3.1/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.3.1/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.3.3/devnum | 1 + .../sys_bus_usb/devices/1-1.5.3.3/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.3.3/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.3/devnum | 1 + .../sys_bus_usb/devices/1-1.5.3/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.3/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.4/devnum | 1 + .../sys_bus_usb/devices/1-1.5.4/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.4/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.5/devnum | 1 + .../sys_bus_usb/devices/1-1.5.5/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.5/idVendor | 1 + .../sys_bus_usb/devices/1-1.5.6/devnum | 1 + .../sys_bus_usb/devices/1-1.5.6/idProduct | 1 + .../sys_bus_usb/devices/1-1.5.6/idVendor | 1 + .../sys_bus_usb/devices/1-1.5/devnum | 1 + .../sys_bus_usb/devices/1-1.5/idProduct | 1 + .../sys_bus_usb/devices/1-1.5/idVendor | 1 + .../sys_bus_usb/devices/1-1.6/devnum | 1 + .../sys_bus_usb/devices/1-1.6/idProduct | 1 + .../sys_bus_usb/devices/1-1.6/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/1-1/devnum | 1 + .../sys_bus_usb/devices/1-1/idProduct | 1 + .../sys_bus_usb/devices/1-1/idVendor | 1 + .../sys_bus_usb/devices/2-1.2/devnum | 1 + .../sys_bus_usb/devices/2-1.2/idProduct | 1 + .../sys_bus_usb/devices/2-1.2/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/2-1/devnum | 1 + .../sys_bus_usb/devices/2-1/idProduct | 1 + .../sys_bus_usb/devices/2-1/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb1/devnum | 1 + .../sys_bus_usb/devices/usb1/idProduct | 1 + .../sys_bus_usb/devices/usb1/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb2/devnum | 1 + .../sys_bus_usb/devices/usb2/idProduct | 1 + .../sys_bus_usb/devices/usb2/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb3/devnum | 1 + .../sys_bus_usb/devices/usb3/idProduct | 1 + .../sys_bus_usb/devices/usb3/idVendor | 1 + .../virusbtestdata/sys_bus_usb/devices/usb4/devnum | 1 + .../sys_bus_usb/devices/usb4/idProduct | 1 + .../sys_bus_usb/devices/usb4/idVendor | 1 + 50 files changed, 461 insertions(+), 1 deletion(-) create mode 100644 tests/virusbmock.c create mode 100644 tests/virusbtest.c create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.6/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.6/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.6/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/2-1.2/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/2-1.2/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/2-1.2/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/2-1/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/2-1/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/2-1/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb1/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb1/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb1/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb2/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb2/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb2/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb3/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb3/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb3/idVendor create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb4/devnum create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb4/idProduct create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb4/idVendor -- 1.8.3.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list