[libvirt] [PATCH] tests: reduce length of nodeinfodata test names

Commit ddd6bef4 fixed an issue where 'make dist' failed to create a tarball because we have files with relative names longer than 100 bytes by the time you include a 'libvirt-0.9.13' prefix, by switching to the ustart format. Unfortunately, even with ustar format, the use of 'tar -ch' with symbolic links that resolve to a file name too long also fails (omitting the -h works, but automake automatically passes -h); such symlinks were added in commit 6dcf98c, which resulted in 'make dist' breaking again. The solution is to rename the offending symlinks to something shorter, by shortening the entire nodeinfodata naming scheme. * tests/nodeinfotest.c (mymain): Shorten test names. (linuxTestNodeInfo): Accommodate new names. * tests/nodeinfodata/*: Rename files accordingly. --- This LOOKS huge, but is really just a couple of 'git mv' commands and a change to nodeinfotest.c. Scroll to the bottom for the real change; I've shortened boring parts of this mail to get past the 100k mail cap enforced by the list. ...fs-test-1-ppc.cpuinfo => linux-ppc-test1.cpuinfo} | 0 ...1-cpu-ppc-output.txt => linux-ppc-test1.expected} | 0 .../cpu/cpu0/online | 0 ... ...5-cpu-x86-output.txt => linux-x86-test5.expected} | 0 ...fs-test-6-x86.cpuinfo => linux-x86-test6.cpuinfo} | 0 ...6-cpu-x86-output.txt => linux-x86-test6.expected} | 0 tests/nodeinfotest.c | 18 +++++++++--------- 447 files changed, 9 insertions(+), 9 deletions(-) rename tests/nodeinfodata/{linux-nodeinfo-sysfs-test-1-ppc.cpuinfo => linux-ppc-test1.cpuinfo} (100%) ... rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-5-cpu-x86-output.txt rename to tests/nodeinfodata/linux-x86-test5.expected diff --git a/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-x86.cpuinfo b/tests/nodeinfodata/linux-x86-test6.cpuinfo similarity index 100% rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-x86.cpuinfo rename to tests/nodeinfodata/linux-x86-test6.cpuinfo diff --git a/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-cpu-x86-output.txt b/tests/nodeinfodata/linux-x86-test6.expected similarity index 100% rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-cpu-x86-output.txt rename to tests/nodeinfodata/linux-x86-test6.expected diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c index 851acd0..c44cc8a 100644 --- a/tests/nodeinfotest.c +++ b/tests/nodeinfotest.c @@ -100,9 +100,9 @@ linuxTestNodeInfo(const void *data) if (virAsprintf(&sysfs_dir, "%s/nodeinfodata/linux-%s", abs_srcdir, test) < 0 || virAsprintf(&cpuinfo, "%s/nodeinfodata/linux-%s-%s.cpuinfo", - abs_srcdir, test, arch) < 0 || - virAsprintf(&output, "%s/nodeinfodata/linux-%s-cpu-%s-output.txt", - abs_srcdir, test, arch) < 0) { + abs_srcdir, arch, test) < 0 || + virAsprintf(&output, "%s/nodeinfodata/linux-%s-%s.expected", + abs_srcdir, arch, test) < 0) { goto cleanup; } @@ -123,14 +123,14 @@ mymain(void) int ret = 0; int i; const char *nodeData[] = { - "nodeinfo-sysfs-test-1", + "test1", # if !(defined(__powerpc__) || \ defined(__powerpc64__)) - "nodeinfo-sysfs-test-2", - "nodeinfo-sysfs-test-3", - "nodeinfo-sysfs-test-4", - "nodeinfo-sysfs-test-5", - "nodeinfo-sysfs-test-6", + "test2", + "test3", + "test4", + "test5", + "test6", # endif }; -- 1.7.10.4

On Fri, Jul 20, 2012 at 01:34:36PM -0600, Eric Blake wrote:
Commit ddd6bef4 fixed an issue where 'make dist' failed to create a tarball because we have files with relative names longer than 100 bytes by the time you include a 'libvirt-0.9.13' prefix, by switching to the ustart format. Unfortunately, even with ustar format, the use of 'tar -ch' with symbolic links that resolve to a file name too long also fails (omitting the -h works, but automake automatically passes -h); such symlinks were added in commit 6dcf98c, which resulted in 'make dist' breaking again. The solution is to rename the offending symlinks to something shorter, by shortening the entire nodeinfodata naming scheme.
* tests/nodeinfotest.c (mymain): Shorten test names. (linuxTestNodeInfo): Accommodate new names. * tests/nodeinfodata/*: Rename files accordingly. ---
This LOOKS huge, but is really just a couple of 'git mv' commands and a change to nodeinfotest.c. Scroll to the bottom for the real change; I've shortened boring parts of this mail to get past the 100k mail cap enforced by the list.
...fs-test-1-ppc.cpuinfo => linux-ppc-test1.cpuinfo} | 0 ...1-cpu-ppc-output.txt => linux-ppc-test1.expected} | 0 .../cpu/cpu0/online | 0 ... ...5-cpu-x86-output.txt => linux-x86-test5.expected} | 0 ...fs-test-6-x86.cpuinfo => linux-x86-test6.cpuinfo} | 0 ...6-cpu-x86-output.txt => linux-x86-test6.expected} | 0 tests/nodeinfotest.c | 18 +++++++++--------- 447 files changed, 9 insertions(+), 9 deletions(-) rename tests/nodeinfodata/{linux-nodeinfo-sysfs-test-1-ppc.cpuinfo => linux-ppc-test1.cpuinfo} (100%) ... rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-5-cpu-x86-output.txt rename to tests/nodeinfodata/linux-x86-test5.expected diff --git a/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-x86.cpuinfo b/tests/nodeinfodata/linux-x86-test6.cpuinfo similarity index 100% rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-x86.cpuinfo rename to tests/nodeinfodata/linux-x86-test6.cpuinfo diff --git a/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-cpu-x86-output.txt b/tests/nodeinfodata/linux-x86-test6.expected similarity index 100% rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-cpu-x86-output.txt rename to tests/nodeinfodata/linux-x86-test6.expected diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c index 851acd0..c44cc8a 100644 --- a/tests/nodeinfotest.c +++ b/tests/nodeinfotest.c @@ -100,9 +100,9 @@ linuxTestNodeInfo(const void *data) if (virAsprintf(&sysfs_dir, "%s/nodeinfodata/linux-%s", abs_srcdir, test) < 0 || virAsprintf(&cpuinfo, "%s/nodeinfodata/linux-%s-%s.cpuinfo", - abs_srcdir, test, arch) < 0 || - virAsprintf(&output, "%s/nodeinfodata/linux-%s-cpu-%s-output.txt", - abs_srcdir, test, arch) < 0) { + abs_srcdir, arch, test) < 0 || + virAsprintf(&output, "%s/nodeinfodata/linux-%s-%s.expected", + abs_srcdir, arch, test) < 0) { goto cleanup; }
@@ -123,14 +123,14 @@ mymain(void) int ret = 0; int i; const char *nodeData[] = { - "nodeinfo-sysfs-test-1", + "test1", # if !(defined(__powerpc__) || \ defined(__powerpc64__)) - "nodeinfo-sysfs-test-2", - "nodeinfo-sysfs-test-3", - "nodeinfo-sysfs-test-4", - "nodeinfo-sysfs-test-5", - "nodeinfo-sysfs-test-6", + "test2", + "test3", + "test4", + "test5", + "test6", # endif };
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 07/20/2012 03:34 PM, Eric Blake wrote:
Commit ddd6bef4 fixed an issue where 'make dist' failed to create a tarball because we have files with relative names longer than 100 bytes by the time you include a 'libvirt-0.9.13' prefix, by switching to the ustart format. Unfortunately, even with ustar format, the use of 'tar -ch' with symbolic links that resolve to a file name too long also fails (omitting the -h works, but automake automatically passes -h); such symlinks were added in commit 6dcf98c, which resulted in 'make dist' breaking again. The solution is to rename the offending symlinks to something shorter, by shortening the entire nodeinfodata naming scheme.
As the first person (I think) who encountered this problem, I can verify that Eric has shortened the paths enough for the build to be successful. (Thanks!) In case anyone was curious, it turns out that, while ustar format lengthens the "name" field of the header from 100 bytes to 255 bytes, it doesn't do anything for the "link_name" field, which remains at the traditional tar's 100 bytes. When you tell tar "-h" to follow symlinks and dump the file they point to rather than just recording the link, the way that tar does this is to resolve the link, then do a lookup in the list of files that have already been dumped into the tarfile; if a match is found, the full name (as recorded the first time it was dumped) of the originally dumped file is written to the "link_name" field rather than storing another entire copy of the file into the tarfile. So, "name" contains the full name of the symlink, and "link_name" contains the full name of the original file. The result is that the full path of the file pointed to by the symlink cannot be > 100 characters. (Even in the case that the original symlink was a very short relative link, that could resolve to a very long pathname. This explains why there was no failure when "-h" wasn't specified - in that case "link_name" of the failures cases was a "very short relative link", so it was successful.)
* tests/nodeinfotest.c (mymain): Shorten test names. (linuxTestNodeInfo): Accommodate new names. * tests/nodeinfodata/*: Rename files accordingly. ---
This LOOKS huge, but is really just a couple of 'git mv' commands and a change to nodeinfotest.c. Scroll to the bottom for the real change; I've shortened boring parts of this mail to get past the 100k mail cap enforced by the list.
...fs-test-1-ppc.cpuinfo => linux-ppc-test1.cpuinfo} | 0 ...1-cpu-ppc-output.txt => linux-ppc-test1.expected} | 0 .../cpu/cpu0/online | 0 ... ...5-cpu-x86-output.txt => linux-x86-test5.expected} | 0 ...fs-test-6-x86.cpuinfo => linux-x86-test6.cpuinfo} | 0 ...6-cpu-x86-output.txt => linux-x86-test6.expected} | 0 tests/nodeinfotest.c | 18 +++++++++--------- 447 files changed, 9 insertions(+), 9 deletions(-) rename tests/nodeinfodata/{linux-nodeinfo-sysfs-test-1-ppc.cpuinfo => linux-ppc-test1.cpuinfo} (100%) ... rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-5-cpu-x86-output.txt rename to tests/nodeinfodata/linux-x86-test5.expected diff --git a/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-x86.cpuinfo b/tests/nodeinfodata/linux-x86-test6.cpuinfo similarity index 100% rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-x86.cpuinfo rename to tests/nodeinfodata/linux-x86-test6.cpuinfo diff --git a/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-cpu-x86-output.txt b/tests/nodeinfodata/linux-x86-test6.expected similarity index 100% rename from tests/nodeinfodata/linux-nodeinfo-sysfs-test-6-cpu-x86-output.txt rename to tests/nodeinfodata/linux-x86-test6.expected diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c index 851acd0..c44cc8a 100644 --- a/tests/nodeinfotest.c +++ b/tests/nodeinfotest.c @@ -100,9 +100,9 @@ linuxTestNodeInfo(const void *data) if (virAsprintf(&sysfs_dir, "%s/nodeinfodata/linux-%s", abs_srcdir, test) < 0 || virAsprintf(&cpuinfo, "%s/nodeinfodata/linux-%s-%s.cpuinfo", - abs_srcdir, test, arch) < 0 || - virAsprintf(&output, "%s/nodeinfodata/linux-%s-cpu-%s-output.txt", - abs_srcdir, test, arch) < 0) { + abs_srcdir, arch, test) < 0 || + virAsprintf(&output, "%s/nodeinfodata/linux-%s-%s.expected", + abs_srcdir, arch, test) < 0) { goto cleanup; }
@@ -123,14 +123,14 @@ mymain(void) int ret = 0; int i; const char *nodeData[] = { - "nodeinfo-sysfs-test-1", + "test1", # if !(defined(__powerpc__) || \ defined(__powerpc64__)) - "nodeinfo-sysfs-test-2", - "nodeinfo-sysfs-test-3", - "nodeinfo-sysfs-test-4", - "nodeinfo-sysfs-test-5", - "nodeinfo-sysfs-test-6", + "test2", + "test3", + "test4", + "test5", + "test6", # endif };

Eric Blake wrote: ...
This [change-set] LOOKS huge, but is really just a couple of 'git mv' commands and a change to nodeinfotest.c. Scroll to the bottom for the real change; I've shortened boring parts of this mail to get past the 100k mail cap enforced by the list.
If you set git diff's "renames" option, (i.e., globally): git config --global diff.renames true then "git diff", format-patch, etc. output is much more readable, i.e., it excludes the "remove-entire-file" then "add-same-contents" diff output. Instead it just prints something like this: diff --git a/old b/new similarity index 100% rename from old rename to new

On 07/21/2012 09:08 AM, Jim Meyering wrote:
Eric Blake wrote: ...
This [change-set] LOOKS huge, but is really just a couple of 'git mv' commands and a change to nodeinfotest.c. Scroll to the bottom for the real change; I've shortened boring parts of this mail to get past the 100k mail cap enforced by the list.
If you set git diff's "renames" option, (i.e., globally):
git config --global diff.renames true
I've already done that (2 years ago).
then "git diff", format-patch, etc. output is much more readable, i.e., it excludes the "remove-entire-file" then "add-same-contents" diff output. Instead it just prints something like this:
diff --git a/old b/new similarity index 100% rename from old rename to new
Nope. Even WITH diff.renames turned on, my patch was more than 100k, because doing a single 'git mv' of a directory with hundreds of children resulted in hundreds of these 4-line rename notations, which added up fast. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (4)
-
Daniel P. Berrange
-
Eric Blake
-
Jim Meyering
-
Laine Stump