[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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
>      };
>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]