From: Matthias Bolte Date: Wed, 22 Jan 2014 21:26:48 +0000 (+0100) Subject: tests: Fix PCI test data filenames for Windows X-Git-Tag: v1.2.2-rc1~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96f274a989aa75b77014ce2bfb9b1f4ea474a250;p=thirdparty%2Flibvirt.git tests: Fix PCI test data filenames for Windows 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. --- diff --git a/tests/virpcimock.c b/tests/virpcimock.c index 1efcd336a3..b42e8bfb30 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -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) diff --git a/tests/virpcitestdata/0000:00:01.0.config b/tests/virpcitestdata/0000-00-01.0.config similarity index 100% rename from tests/virpcitestdata/0000:00:01.0.config rename to tests/virpcitestdata/0000-00-01.0.config diff --git a/tests/virpcitestdata/0000:00:02.0.config b/tests/virpcitestdata/0000-00-02.0.config similarity index 100% rename from tests/virpcitestdata/0000:00:02.0.config rename to tests/virpcitestdata/0000-00-02.0.config diff --git a/tests/virpcitestdata/0000:00:03.0.config b/tests/virpcitestdata/0000-00-03.0.config similarity index 100% rename from tests/virpcitestdata/0000:00:03.0.config rename to tests/virpcitestdata/0000-00-03.0.config diff --git a/tests/virpcitestdata/0001:00:00.0.config b/tests/virpcitestdata/0001-00-00.0.config similarity index 100% rename from tests/virpcitestdata/0001:00:00.0.config rename to tests/virpcitestdata/0001-00-00.0.config diff --git a/tests/virpcitestdata/0001:01:00.0.config b/tests/virpcitestdata/0001-01-00.0.config similarity index 100% rename from tests/virpcitestdata/0001:01:00.0.config rename to tests/virpcitestdata/0001-01-00.0.config diff --git a/tests/virpcitestdata/0001:01:00.1.config b/tests/virpcitestdata/0001-01-00.1.config similarity index 100% rename from tests/virpcitestdata/0001:01:00.1.config rename to tests/virpcitestdata/0001-01-00.1.config diff --git a/tests/virpcitestdata/0005:80:00.0.config b/tests/virpcitestdata/0005-80-00.0.config similarity index 100% rename from tests/virpcitestdata/0005:80:00.0.config rename to tests/virpcitestdata/0005-80-00.0.config diff --git a/tests/virpcitestdata/0005:90:01.0.config b/tests/virpcitestdata/0005-90-01.0.config similarity index 100% rename from tests/virpcitestdata/0005:90:01.0.config rename to tests/virpcitestdata/0005-90-01.0.config diff --git a/tests/virpcitestdata/0005:90:01.1.config b/tests/virpcitestdata/0005-90-01.1.config similarity index 100% rename from tests/virpcitestdata/0005:90:01.1.config rename to tests/virpcitestdata/0005-90-01.1.config diff --git a/tests/virpcitestdata/0005:90:01.2.config b/tests/virpcitestdata/0005-90-01.2.config similarity index 100% rename from tests/virpcitestdata/0005:90:01.2.config rename to tests/virpcitestdata/0005-90-01.2.config