]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Fix PCI test data filenames for Windows
authorMatthias Bolte <matthias.bolte@googlemail.com>
Wed, 22 Jan 2014 21:26:48 +0000 (22:26 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 25 Jan 2014 11:53:11 +0000 (12:53 +0100)
Windows doesn't allow : in filenames.

Commit 21685c955e546676a5b2a01f7b788d222e0ee0f5 added files with a : in
their names. This broke git operations on Windows as git is not able to
create those files on clone or pull.

Replace : with - in the offending filenames and adapt the test case.

tests/virpcimock.c
tests/virpcitestdata/0000-00-01.0.config [moved from tests/virpcitestdata/0000:00:01.0.config with 100% similarity]
tests/virpcitestdata/0000-00-02.0.config [moved from tests/virpcitestdata/0000:00:02.0.config with 100% similarity]
tests/virpcitestdata/0000-00-03.0.config [moved from tests/virpcitestdata/0000:00:03.0.config with 100% similarity]
tests/virpcitestdata/0001-00-00.0.config [moved from tests/virpcitestdata/0001:00:00.0.config with 100% similarity]
tests/virpcitestdata/0001-01-00.0.config [moved from tests/virpcitestdata/0001:01:00.0.config with 100% similarity]
tests/virpcitestdata/0001-01-00.1.config [moved from tests/virpcitestdata/0001:01:00.1.config with 100% similarity]
tests/virpcitestdata/0005-80-00.0.config [moved from tests/virpcitestdata/0005:80:00.0.config with 100% similarity]
tests/virpcitestdata/0005-90-01.0.config [moved from tests/virpcitestdata/0005:90:01.0.config with 100% similarity]
tests/virpcitestdata/0005-90-01.1.config [moved from tests/virpcitestdata/0005:90:01.1.config with 100% similarity]
tests/virpcitestdata/0005-90-01.2.config [moved from tests/virpcitestdata/0005:90:01.2.config with 100% similarity]

index 1efcd336a3f1decd80885b0c4d989088a142d347..b42e8bfb30994d93f50e4313f498a22894e8c053 100644 (file)
@@ -320,16 +320,33 @@ pci_device_new_from_stub(const struct pciDevice *data)
 {
     struct pciDevice *dev;
     char *devpath;
+    char *id;
+    char *c;
     char *configSrc;
     char tmp[32];
     struct stat sb;
 
+    if (VIR_STRDUP_QUIET(id, data->id) < 0)
+        ABORT_OOM();
+
+    /* Replace ':' with '-' to create the config filename from the
+     * device ID. The device ID cannot be used directly as filename
+     * because it contains ':' and Windows does not allow ':' in
+     * filenames. */
+    c = strchr(id, ':');
+
+    while (c) {
+        *c = '-';
+        c = strchr(c, ':');
+    }
+
     if (VIR_ALLOC_QUIET(dev) < 0 ||
         virAsprintfQuiet(&configSrc, "%s/virpcitestdata/%s.config",
-                         abs_srcdir, data->id) < 0 ||
+                         abs_srcdir, id) < 0 ||
         virAsprintfQuiet(&devpath, "%s/devices/%s", fakesysfsdir, data->id) < 0)
         ABORT_OOM();
 
+    VIR_FREE(id);
     memcpy(dev, data, sizeof(*dev));
 
     if (virFileMakePath(devpath) < 0)