configure,test-diff-pkg.cc: Handle symlinks presence in dist tarball

Since the commit below, there are tests that require symbolic links.

Unfortunately, the tar command used to construct tarballs copies the
target of a symbolic link (and thus doesn't keep the symlink) for the
purpose of greater portability, as some platforms don't support
symbolic links.

This patch uses a tar command that keeps the symlinks in place for the
tests introduced by the commit below to keep working.  On some
platforms however, symlinks are removed from the tarball no matter
what.  In those case, the test that needs symlinks is disabled.

Here is the commit in question:

    bad389f abipkgdiff: Avoid comparing binaries that are outside of the package

	* configure.ac: Use "tar -cf" instead of "tar -chf" to construct
	the tarball.  Detect if the presence of the symlink in the
	distribution and define the WITH_SYMLINKS_KEPT_IN_DIST
	preprocessor macro accordingly.
	* tests/test-diff-pkg.cc (in_out_specs): If symlinks are not
	present in the tarball then the test that requires symlinks is
	deactivated.  Also, fix the
	data/test-diff-pkg/symlink-dir-test1/dir1 test to make it point to
	the target of the symlinks directly, to avoid considering a binary
	twice, in cases where symlink targets are copied.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2023-09-20 11:25:17 +02:00
parent 831b59a83f
commit 457f5cb202
2 changed files with 25 additions and 4 deletions

View File

@ -62,6 +62,16 @@ AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])
dnl By default, the tar command used by 'make dist and make distcheck'
dnl is "tar --format=ustar -chf" where the "-h" option actually
dnl follows symbolic links. So it copies the targets of the symlinks
dnl that are present in the tarball. Unfortunately, there are
dnl tests that need to keep the symlinks intact in the tarball.
dnl
dnl So let's define a tar command without the -h option.
am__tar='tar --format=ustar -cf - "$$tardir"'
VERSION_MAJOR=version_major
VERSION_MINOR=version_minor
VERSION_REVISION=0
@ -518,6 +528,13 @@ fi
AM_CONDITIONAL(ENABLE_RPM, test x$ENABLE_RPM = xyes)
dnl There is a test that needs symlinks support in the distribution tarball. If symlinks are
dnl removed from the tarball, then the test should be disabled.
m4_define([symlink_file], [tests/data/test-diff-pkg/symlink-dir-test1/dir1/symlinks/foo.o])
if test -L "$srcdir"/symlink_file; then
AC_DEFINE([WITH_SYMLINKS_KEPT_IN_DIST], 1, [symbolic links are kept in the distribution tarball])
fi
dnl enable the debugging of self comparison when doing abidw --debug-abidiff <binary>
if test x$ENABLE_DEBUG_SELF_COMPARISON = xyes; then
AC_DEFINE([WITH_DEBUG_SELF_COMPARISON], 1, [compile support of debugging abidw --abidiff])

View File

@ -150,8 +150,8 @@ static InOutSpec in_out_specs[] =
"output/test-diff-pkg/dirpkg-3-report-2.txt"
},
{
"data/test-diff-pkg/symlink-dir-test1/dir1",
"data/test-diff-pkg/symlink-dir-test1/dir2",
"data/test-diff-pkg/symlink-dir-test1/dir1/targets",
"data/test-diff-pkg/symlink-dir-test1/dir2/targets",
"--no-default-suppression ",
"",
"",
@ -161,6 +161,7 @@ static InOutSpec in_out_specs[] =
"data/test-diff-pkg/symlink-dir-test1-report0.txt",
"output/test-diff-pkg/symlink-dir-test1-report0.txt"
},
#ifdef WITH_SYMLINKS_KEPT_IN_DIST
{
"data/test-diff-pkg/symlink-dir-test1/dir1/symlinks",
"data/test-diff-pkg/symlink-dir-test1/dir2/symlinks",
@ -173,6 +174,7 @@ static InOutSpec in_out_specs[] =
"data/test-diff-pkg/symlink-dir-test1-report1.txt",
"output/test-diff-pkg/symlink-dir-test1-report1.txt"
},
#endif
#if WITH_TAR
{
"data/test-diff-pkg/tarpkg-0-dir1.tar",
@ -877,8 +879,8 @@ static InOutSpec in_out_specs[] =
"output/test-diff-pkg-ctf/dirpkg-3-report-2.txt"
},
{
"data/test-diff-pkg-ctf/symlink-dir-test1/dir1",
"data/test-diff-pkg-ctf/symlink-dir-test1/dir2",
"data/test-diff-pkg-ctf/symlink-dir-test1/dir1/targets",
"data/test-diff-pkg-ctf/symlink-dir-test1/dir2/targets",
"--ctf --no-default-suppression ",
"",
"",
@ -888,6 +890,7 @@ static InOutSpec in_out_specs[] =
"data/test-diff-pkg-ctf/symlink-dir-test1-report0.txt",
"output/test-diff-pkg-ctf/symlink-dir-test1-report0.txt"
},
#ifdef WITH_SYMLINKS_KEPT_IN_DIST
{
"data/test-diff-pkg-ctf/symlink-dir-test1/dir1/symlinks",
"data/test-diff-pkg-ctf/symlink-dir-test1/dir2/symlinks",
@ -900,6 +903,7 @@ static InOutSpec in_out_specs[] =
"data/test-diff-pkg-ctf/symlink-dir-test1-report1.txt",
"output/test-diff-pkg-ctf/symlink-dir-test1-report1.txt"
},
#endif
#if WITH_TAR
{
"data/test-diff-pkg-ctf/tarpkg-0-dir1.tar",