Mock the /sys/bus/usb directory and test the finding
(and not finding) of some USB devices.
---
.gitignore | 1 +
cfg.mk | 3 +-
tests/Makefile.am | 12 +
tests/virusbtest.c | 268 +++++++++++++++++++++
.../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.1/serial | 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.3/serial | 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.3/serial | 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.4/serial | 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.5/serial | 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.6/serial | 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.5/serial | 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 +
.../sys_bus_usb/devices/1-1.6/serial | 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 +
.../virusbtestdata/sys_bus_usb/devices/1-1/serial | 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 +
.../sys_bus_usb/devices/2-1.2/serial | 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/2-1/serial | 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/usb1/serial | 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/usb2/serial | 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/usb3/serial | 1 +
.../virusbtestdata/sys_bus_usb/devices/usb4/devnum | 1 +
.../sys_bus_usb/devices/usb4/idProduct | 1 +
.../sys_bus_usb/devices/usb4/idVendor | 1 +
.../virusbtestdata/sys_bus_usb/devices/usb4/serial | 1 +
64 files changed, 343 insertions(+), 1 deletion(-)
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.1/serial
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.3/serial
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.3/serial
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.4/serial
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.5/serial
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.6/serial
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.5/serial
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.6/serial
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/1-1/serial
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.2/serial
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/2-1/serial
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/usb1/serial
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/usb2/serial
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/usb3/serial
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
create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb4/serial
diff --git a/.gitignore b/.gitignore
index 69c81df..f6dc440 100644
--- a/.gitignore
+++ b/.gitignore
@@ -218,6 +218,7 @@
/tests/virsystemdtest
/tests/virtimetest
/tests/viruritest
+/tests/virusbtest
/tests/vmwarevertest
/tests/vmx2xmltest
/tests/xencapstest
diff --git a/cfg.mk b/cfg.mk
index fa2638f..ff889b9 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -941,7 +941,8 @@ exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
exclude_file_name_regexp--sc_copyright_usage = \
^COPYING(|\.LESSER)$$
-exclude_file_name_regexp--sc_flags_usage =
^(docs/|src/util/virnetdevtap\.c$$|tests/vir(cgroup|pci)mock\.c$$)
+exclude_file_name_regexp--sc_flags_usage = \
+
^(docs/|src/util/virnetdevtap\.c$$|tests/vir(cgroup|pci)mock\.c$$|tests/virusbtest\.c$$)
exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
^(src/rpc/gendispatch\.pl$$|tests/)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c374f14..3ce1c2c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -149,6 +149,7 @@ test_programs = virshtest sockettest \
virkmodtest \
vircapstest \
domainconftest \
+ virusbtest \
$(NULL)
if WITH_REMOTE
@@ -330,6 +331,7 @@ EXTRA_DIST += $(test_scripts)
test_libraries = libshunload.la \
libvirportallocatormock.la \
+ virusbmock.la \
virnetserverclientmock.la \
vircgroupmock.la \
virpcimock.la \
@@ -815,6 +817,16 @@ virpcimock_la_LIBADD = $(GNULIB_LIBS) \
virpcimock_la_LDFLAGS = -module -avoid-version \
-rpath /evil/libtool/hack/to/force/shared/lib/creation
+virusbtest_SOURCES = \
+ virusbtest.c testutils.h testutils.c
+virusbtest_LDADD = $(LDADDS)
+
+virusbmock_la_SOURCES = \
+ virusbtest.c
+virusbmock_la_CFLAGS = $(AM_CFLAGS) -DMOCK_HELPER=1
+virusbmock_la_LDFLAGS = -module -avoid-version \
+ -rpath /evil/libtool/hack/to/force/shared/lib/creation
+
if WITH_DBUS
virdbustest_SOURCES = \
virdbustest.c testutils.h testutils.c
diff --git a/tests/virusbtest.c b/tests/virusbtest.c
new file mode 100644
index 0000000..f9104bf
--- /dev/null
+++ b/tests/virusbtest.c
@@ -0,0 +1,268 @@
+/*
+ * Copyright (C) 2013-2014 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <
http://www.gnu.org/licenses/>.
+ *
+ * Author: Jan Tomko <jtomko(a)redhat.com>
+ */
+
+#include <config.h>
+#include <stdlib.h>
+
+#include "virfile.h"
+#include "virusb.h"
+#include "viralloc.h"
+
+#if HAVE_DLFCN_H
+# ifdef MOCK_HELPER
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <dirent.h>
+# include <dlfcn.h>
+# include <fcntl.h>
+
+# include "virstring.h"
+
+# define USB_SYSFS "/sys/bus/usb"
+# define FAKE_USB_SYSFS "virusbtestdata/sys_bus_usb"
+
+static int (*realopen)(const char *pathname, int flags, ...);
+static DIR *(*realopendir)(const char *name);
+
+static void init_syms(void)
+{
+ if (realopen)
+ return;
+
+ realopen = dlsym(RTLD_NEXT, "open");
+ realopendir = dlsym(RTLD_NEXT, "opendir");
+ if (!realopen || !realopendir) {
+ fprintf(stderr, "Error getting symbols");
+ abort();
+ }
+}
+
+static char *get_fake_path(const char *real_path)
+{
+ const char *p = NULL;
+ char *path = NULL;
+
+ if ((p = STRSKIP(real_path, USB_SYSFS)) &&
+ virAsprintfQuiet(&path, "%s/%s/%s", abs_srcdir, FAKE_USB_SYSFS, p)
< 0)
+ goto error;
+ else if (!p && VIR_STRDUP_QUIET(path, real_path) < 0)
+ goto error;
+
+ return path;
+
+error:
+ errno = ENOMEM;
+ return NULL;
+}
+
+DIR *opendir(const char *name)
+{
+ char *path;
+ DIR* ret;
+
+ init_syms();
+ path = get_fake_path(name);
+
+ ret = realopendir(path);
+ VIR_FREE(path);
+ return ret;
+}
+
+int open(const char *pathname, int flags, ...)
+{
+ char *path;
+ int ret;
+
+ init_syms();
+
+ path = get_fake_path(pathname);
+ if (!path)
+ return -1;
+ ret = realopen(path, flags);
+ VIR_FREE(path);
+ return ret;
+}
+
+# else /* ! MOCK_HELPER */
+
+# include "testutils.h"
+# include "virerror.h"
+
+# define VIR_FROM_THIS VIR_FROM_NONE
+
+typedef enum {
+ FIND_BY_ALL,
+ FIND_BY_VENDOR,
+ FIND_BY_BUS
+} testUSBFindFlags;
+
+struct findTestInfo {
+ const char *name;
+ unsigned int vendor;
+ unsigned int product;
+ unsigned int bus;
+ unsigned int devno;
+ const char *vroot;
+ bool mandatory;
+ int how;
+ bool expectFailure;
+};
+
+static int testDeviceFileActor(virUSBDevicePtr dev,
+ const char *path,
+ void *opaque ATTRIBUTE_UNUSED)
+{
+ char *str = NULL;
+ int ret = 0;
+
+ if (virAsprintf(&str, USB_DEVFS "%03d/%03d",
+ virUSBDeviceGetBus(dev),
+ virUSBDeviceGetDevno(dev)) < 0)
+ return -1;
+
+ if (STRNEQ(path, str)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "Device path '%s' does not match expected
'%s'",
+ path, str);
+ ret = -1;
+ }
+ VIR_FREE(str);
+ return ret;
+}
+
+static int testDeviceFind(const void *opaque)
+{
+ const struct findTestInfo *info = opaque;
+ int ret = -1;
+ virUSBDevicePtr dev = NULL;
+ virUSBDeviceListPtr devs = NULL;
+ int rv = 0;
+ size_t i, ndevs = 0;
+
+ switch (info->how) {
+ case FIND_BY_ALL:
+ rv = virUSBDeviceFind(info->vendor, info->product,
+ info->bus, info->devno,
+ info->vroot, info->mandatory, &dev);
+ break;
+ case FIND_BY_VENDOR:
+ rv = virUSBDeviceFindByVendor(info->vendor, info->product,
+ info->vroot, info->mandatory, &devs);
+ break;
+ case FIND_BY_BUS:
+ rv = virUSBDeviceFindByBus(info->bus, info->devno,
+ info->vroot, info->mandatory, &dev);
+ break;
+ }
+
+ if (info->expectFailure) {
+ if (rv == 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ "unexpected success");
+ goto cleanup;
+ }
+ } else if (rv < 0) {
+ goto cleanup;
+ }
+
+ if (dev && virUSBDeviceFileIterate(dev, testDeviceFileActor, NULL) < 0)
+ goto cleanup;
+
+ if (devs)
+ ndevs = virUSBDeviceListCount(devs);
+
+ for (i = 0; i < ndevs; i++) {
+ virUSBDevicePtr device = virUSBDeviceListGet(devs, i);
+ if (virUSBDeviceFileIterate(device, testDeviceFileActor, NULL) < 0)
+ goto cleanup;
+ }
+
+ ret = 0;
+
+cleanup:
+ virObjectUnref(devs);
+ virUSBDeviceFree(dev);
+ return ret;
+}
+
+
+static int
+mymain(void)
+{
+ int rv = 0;
+
+# define DO_TEST_FIND_FULL(name, vend, prod, bus, devno, vroot, mand, how, fail) \
+ do { \
+ struct findTestInfo data = { name, vend, prod, bus, \
+ devno, vroot, mand, how, fail \
+ }; \
+ if (virtTestRun("USBDeviceFind " name, testDeviceFind, &data) <
0) \
+ rv = -1; \
+ } while (0)
+
+# define DO_TEST_FIND(name, vend, prod, bus, devno) \
+ DO_TEST_FIND_FULL(name, vend, prod, bus, devno, NULL, true, \
+ FIND_BY_ALL, false)
+# define DO_TEST_FIND_FAIL(name, vend, prod, bus, devno) \
+ DO_TEST_FIND_FULL(name, vend, prod, bus, devno, NULL, true, \
+ FIND_BY_ALL, true)
+
+# define DO_TEST_FIND_BY_BUS(name, bus, devno) \
+ DO_TEST_FIND_FULL(name, 101, 202, bus, devno, NULL, true, \
+ FIND_BY_BUS, false)
+# define DO_TEST_FIND_BY_BUS_FAIL(name, bus, devno) \
+ DO_TEST_FIND_FULL(name, 101, 202, bus, devno, NULL, true, \
+ FIND_BY_BUS, true)
+
+# define DO_TEST_FIND_BY_VENDOR(name, vend, prod) \
+ DO_TEST_FIND_FULL(name, vend, prod, 123, 456, NULL, true, \
+ FIND_BY_VENDOR, false)
+# define DO_TEST_FIND_BY_VENDOR_FAIL(name, vend, prod) \
+ DO_TEST_FIND_FULL(name, vend, prod, 123, 456, NULL, true, \
+ FIND_BY_VENDOR, true)
+
+ DO_TEST_FIND("Nexus", 0x18d1, 0x4e22, 1, 20);
+ DO_TEST_FIND_FAIL("Nexus wrong devnum", 0x18d1, 0x4e22, 1, 25);
+ DO_TEST_FIND_FAIL("Bogus", 0xf00d, 0xbeef, 1024, 768);
+
+ DO_TEST_FIND_BY_BUS("integrated camera", 1, 5);
+ DO_TEST_FIND_BY_BUS_FAIL("wrong bus/devno combination", 2, 20);
+ DO_TEST_FIND_BY_BUS_FAIL("missing bus", 5, 20);
+ DO_TEST_FIND_BY_BUS_FAIL("missing devnum", 1, 158);
+
+ DO_TEST_FIND_BY_VENDOR("Nexus (multiple results)", 0x18d1, 0x4e22);
+ DO_TEST_FIND_BY_VENDOR_FAIL("Bogus vendor and product", 0xf00d, 0xbeef);
+ DO_TEST_FIND_BY_VENDOR_FAIL("Valid vendor", 0x1d6b, 0xbeef);
+
+ if (rv < 0)
+ return EXIT_FAILURE;
+ return EXIT_SUCCESS;
+}
+
+VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virusbmock.so")
+# endif
+
+#else /* ! HAVE_DLFCN_H */
+int
+main(void)
+{
+ return EXIT_AM_SKIP;
+}
+#endif
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/devnum
new file mode 100644
index 0000000..98d9bcb
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/devnum
@@ -0,0 +1 @@
+17
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idProduct
new file mode 100644
index 0000000..211990d
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idProduct
@@ -0,0 +1 @@
+301b
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idVendor
new file mode 100644
index 0000000..489f206
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/idVendor
@@ -0,0 +1 @@
+04b3
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/serial
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/serial
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/serial
@@ -0,0 +1 @@
+
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/devnum
new file mode 100644
index 0000000..3c03207
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/devnum
@@ -0,0 +1 @@
+18
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idProduct
new file mode 100644
index 0000000..6f023e6
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idProduct
@@ -0,0 +1 @@
+c069
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idVendor
new file mode 100644
index 0000000..cb40fac
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/idVendor
@@ -0,0 +1 @@
+046d
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/serial
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/serial
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/serial
@@ -0,0 +1 @@
+
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/devnum
new file mode 100644
index 0000000..b6a7d89
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/devnum
@@ -0,0 +1 @@
+16
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idProduct
new file mode 100644
index 0000000..49bee7b
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idProduct
@@ -0,0 +1 @@
+301a
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idVendor
new file mode 100644
index 0000000..489f206
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/idVendor
@@ -0,0 +1 @@
+04b3
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/serial
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/serial
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/serial
@@ -0,0 +1 @@
+
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/devnum
new file mode 100644
index 0000000..bb95160
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/devnum
@@ -0,0 +1 @@
+33
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/idProduct
new file mode 100644
index 0000000..f586e1a
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/idProduct
@@ -0,0 +1 @@
+4e22
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/idVendor
new file mode 100644
index 0000000..38784d5
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/idVendor
@@ -0,0 +1 @@
+18d1
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/serial
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/serial
new file mode 100644
index 0000000..386cee1
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/serial
@@ -0,0 +1 @@
+0118999881999119727 3
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/devnum
new file mode 100644
index 0000000..f04c001
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/devnum
@@ -0,0 +1 @@
+29
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/idProduct
new file mode 100644
index 0000000..f586e1a
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/idProduct
@@ -0,0 +1 @@
+4e22
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/idVendor
new file mode 100644
index 0000000..38784d5
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/idVendor
@@ -0,0 +1 @@
+18d1
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/serial
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/serial
new file mode 100644
index 0000000..551d4f1
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/serial
@@ -0,0 +1 @@
+0118999881999119726 3
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/devnum
new file mode 100644
index 0000000..209e3ef
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/devnum
@@ -0,0 +1 @@
+20
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/idProduct
new file mode 100644
index 0000000..f586e1a
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/idProduct
@@ -0,0 +1 @@
+4e22
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/idVendor
new file mode 100644
index 0000000..38784d5
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/idVendor
@@ -0,0 +1 @@
+18d1
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/serial
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/serial
new file mode 100644
index 0000000..5b4cae7
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/serial
@@ -0,0 +1 @@
+0118999881999119725 3
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/devnum
new file mode 100644
index 0000000..60d3b2f
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/devnum
@@ -0,0 +1 @@
+15
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/idProduct
new file mode 100644
index 0000000..49f6c75
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/idProduct
@@ -0,0 +1 @@
+100a
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/idVendor
new file mode 100644
index 0000000..67ad2a5
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/idVendor
@@ -0,0 +1 @@
+17ef
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/serial
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/serial
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.5/serial
@@ -0,0 +1 @@
+
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/devnum
new file mode 100644
index 0000000..7ed6ff8
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/devnum
@@ -0,0 +1 @@
+5
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/idProduct
new file mode 100644
index 0000000..2258c87
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/idProduct
@@ -0,0 +1 @@
+b221
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/idVendor
new file mode 100644
index 0000000..009ebe3
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/idVendor
@@ -0,0 +1 @@
+04f2
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/serial
b/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/serial
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1.6/serial
@@ -0,0 +1 @@
+
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/1-1/devnum
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1/devnum
@@ -0,0 +1 @@
+2
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/1-1/idProduct
new file mode 100644
index 0000000..a55ce18
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1/idProduct
@@ -0,0 +1 @@
+0024
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/1-1/idVendor
new file mode 100644
index 0000000..a7c026f
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1/idVendor
@@ -0,0 +1 @@
+8087
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/1-1/serial
b/tests/virusbtestdata/sys_bus_usb/devices/1-1/serial
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/1-1/serial
@@ -0,0 +1 @@
+
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/devnum
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/devnum
@@ -0,0 +1 @@
+4
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/idProduct
new file mode 100644
index 0000000..af68ed9
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/idProduct
@@ -0,0 +1 @@
+0011
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/idVendor
new file mode 100644
index 0000000..40a5eb0
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/idVendor
@@ -0,0 +1 @@
+046a
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/serial
b/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/serial
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/2-1.2/serial
@@ -0,0 +1 @@
+
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/2-1/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/2-1/devnum
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/2-1/devnum
@@ -0,0 +1 @@
+2
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/2-1/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/2-1/idProduct
new file mode 100644
index 0000000..a55ce18
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/2-1/idProduct
@@ -0,0 +1 @@
+0024
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/2-1/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/2-1/idVendor
new file mode 100644
index 0000000..a7c026f
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/2-1/idVendor
@@ -0,0 +1 @@
+8087
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/2-1/serial
b/tests/virusbtestdata/sys_bus_usb/devices/2-1/serial
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/2-1/serial
@@ -0,0 +1 @@
+
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb1/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/usb1/devnum
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb1/devnum
@@ -0,0 +1 @@
+1
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb1/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/usb1/idProduct
new file mode 100644
index 0000000..5fca1fd
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb1/idProduct
@@ -0,0 +1 @@
+0002
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb1/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/usb1/idVendor
new file mode 100644
index 0000000..d247637
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb1/idVendor
@@ -0,0 +1 @@
+1d6b
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb1/serial
b/tests/virusbtestdata/sys_bus_usb/devices/usb1/serial
new file mode 100644
index 0000000..7f434da
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb1/serial
@@ -0,0 +1 @@
+0000:00:1a.0
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb2/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/usb2/devnum
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb2/devnum
@@ -0,0 +1 @@
+1
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb2/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/usb2/idProduct
new file mode 100644
index 0000000..5fca1fd
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb2/idProduct
@@ -0,0 +1 @@
+0002
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb2/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/usb2/idVendor
new file mode 100644
index 0000000..d247637
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb2/idVendor
@@ -0,0 +1 @@
+1d6b
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb2/serial
b/tests/virusbtestdata/sys_bus_usb/devices/usb2/serial
new file mode 100644
index 0000000..3fed695
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb2/serial
@@ -0,0 +1 @@
+0000:00:1d.0
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb3/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/usb3/devnum
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb3/devnum
@@ -0,0 +1 @@
+1
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb3/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/usb3/idProduct
new file mode 100644
index 0000000..5fca1fd
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb3/idProduct
@@ -0,0 +1 @@
+0002
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb3/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/usb3/idVendor
new file mode 100644
index 0000000..d247637
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb3/idVendor
@@ -0,0 +1 @@
+1d6b
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb3/serial
b/tests/virusbtestdata/sys_bus_usb/devices/usb3/serial
new file mode 100644
index 0000000..0d45813
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb3/serial
@@ -0,0 +1 @@
+0000:0d:00.0
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb4/devnum
b/tests/virusbtestdata/sys_bus_usb/devices/usb4/devnum
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb4/devnum
@@ -0,0 +1 @@
+1
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb4/idProduct
b/tests/virusbtestdata/sys_bus_usb/devices/usb4/idProduct
new file mode 100644
index 0000000..1ce74b6
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb4/idProduct
@@ -0,0 +1 @@
+0003
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb4/idVendor
b/tests/virusbtestdata/sys_bus_usb/devices/usb4/idVendor
new file mode 100644
index 0000000..d247637
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb4/idVendor
@@ -0,0 +1 @@
+1d6b
diff --git a/tests/virusbtestdata/sys_bus_usb/devices/usb4/serial
b/tests/virusbtestdata/sys_bus_usb/devices/usb4/serial
new file mode 100644
index 0000000..0d45813
--- /dev/null
+++ b/tests/virusbtestdata/sys_bus_usb/devices/usb4/serial
@@ -0,0 +1 @@
+0000:0d:00.0
--
1.8.3.2