summaryrefslogtreecommitdiffstats
path: root/scripts/t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:09 +0000
commit3c05da1bdef2a6e2142b4fcac974e7e3fc0db93c (patch)
tree9532e637f47d6ff7246ccbabb62d4e2b4b5908df /scripts/t
parentAdding debian version 1.22.6. (diff)
downloaddpkg-3c05da1bdef2a6e2142b4fcac974e7e3fc0db93c.tar.xz
dpkg-3c05da1bdef2a6e2142b4fcac974e7e3fc0db93c.zip
Merging upstream version 1.22.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/t')
-rw-r--r--scripts/t/Dpkg_BuildFlags_Ubuntu.t2
-rw-r--r--scripts/t/Dpkg_Deps.t93
-rw-r--r--scripts/t/Dpkg_Shlibs.t7
-rw-r--r--scripts/t/Dpkg_Shlibs_Cppfilt.t8
-rw-r--r--scripts/t/Dpkg_Substvars.t28
-rw-r--r--scripts/t/Dpkg_Substvars/substvars-req1
-rw-r--r--scripts/t/dpkg_buildpackage.t3
-rw-r--r--scripts/t/dpkg_buildpackage/test-source_0_source.hook2
-rw-r--r--scripts/t/mk.t2
-rw-r--r--scripts/t/mk/architecture.mk60
-rw-r--r--scripts/t/mk/buildapi.mk13
-rw-r--r--scripts/t/mk/buildflags.mk53
-rw-r--r--scripts/t/mk/buildopts.mk11
-rw-r--r--scripts/t/mk/buildtools.mk64
-rw-r--r--scripts/t/mk/pkg-info.mk31
-rw-r--r--scripts/t/mk/vendor-v0.mk1
-rw-r--r--scripts/t/mk/vendor-v1.mk1
-rw-r--r--scripts/t/mk/vendor.mk17
18 files changed, 279 insertions, 118 deletions
diff --git a/scripts/t/Dpkg_BuildFlags_Ubuntu.t b/scripts/t/Dpkg_BuildFlags_Ubuntu.t
index 822fbf6..0f2efba 100644
--- a/scripts/t/Dpkg_BuildFlags_Ubuntu.t
+++ b/scripts/t/Dpkg_BuildFlags_Ubuntu.t
@@ -53,6 +53,8 @@ sub test_no_ltoflag
my $bf;
+undef $ENV{DEB_BUILD_MAINT_OPTIONS};
+
# Force loading the Dpkg::Vendor::Ubuntu module.
$ENV{DEB_VENDOR} = 'Ubuntu';
diff --git a/scripts/t/Dpkg_Deps.t b/scripts/t/Dpkg_Deps.t
index b6a10d6..15c73da 100644
--- a/scripts/t/Dpkg_Deps.t
+++ b/scripts/t/Dpkg_Deps.t
@@ -163,19 +163,88 @@ $dep_restrict = deps_parse($field_restrict);
$dep_restrict->reduce_profiles([]);
is($dep_restrict->output(), 'dep1, dep3, dep5', 'Unknown restrictions post-reduce');
+# We store these hashes as a list so that we can easily reference them later.
+my @realpkgs = (
+ {
+ package => 'mypackage',
+ version => '1.3.4-1',
+ architecture => get_host_arch(),
+ multiarch => 'no',
+ }, {
+ package => 'mypackage2',
+ version => '1.3.4-1',
+ architecture => 'somearch',
+ multiarch => 'no',
+ }, {
+ package => 'pkg-ma-foreign',
+ version => '1.3.4-1',
+ architecture => 'somearch',
+ multiarch => 'foreign',
+ }, {
+ package => 'pkg-ma-foreign2',
+ version => '1.3.4-1',
+ architecture => get_host_arch(),
+ multiarch => 'foreign',
+ }, {
+ package => 'pkg-ma-allowed',
+ version => '1.3.4-1',
+ architecture => 'somearch',
+ multiarch => 'allowed',
+ }, {
+ package => 'pkg-ma-allowed2',
+ version => '1.3.4-1',
+ architecture => 'somearch',
+ multiarch => 'allowed',
+ }, {
+ package => 'pkg-ma-allowed3',
+ version => '1.3.4-1',
+ architecture => get_host_arch(),
+ multiarch => 'allowed',
+ }, {
+ package => 'pkg-indep-normal',
+ version => '1.3.4-1',
+ architecture => 'all',
+ multiarch => 'no',
+ }, {
+ package => 'pkg-indep-foreign',
+ version => '1.3.4-1',
+ architecture => 'all',
+ multiarch => 'foreign',
+ }
+);
+
+my @virtpkgs = (
+ {
+ virtual => 'myvirtual',
+ relation => undef,
+ version => undef,
+ provided_by => 'mypackage',
+ }, {
+ virtual => 'myvirtual2',
+ relation => REL_EQ,
+ version => '1.0-1',
+ provided_by => 'mypackage',
+ }, {
+ virtual => 'myvirtual3',
+ relation => REL_GE,
+ version => '2.0-1',
+ provided_by => 'mypackage',
+ }
+);
+
my $facts = Dpkg::Deps::KnownFacts->new();
-$facts->add_installed_package('mypackage', '1.3.4-1', get_host_arch(), 'no');
-$facts->add_installed_package('mypackage2', '1.3.4-1', 'somearch', 'no');
-$facts->add_installed_package('pkg-ma-foreign', '1.3.4-1', 'somearch', 'foreign');
-$facts->add_installed_package('pkg-ma-foreign2', '1.3.4-1', get_host_arch(), 'foreign');
-$facts->add_installed_package('pkg-ma-allowed', '1.3.4-1', 'somearch', 'allowed');
-$facts->add_installed_package('pkg-ma-allowed2', '1.3.4-1', 'somearch', 'allowed');
-$facts->add_installed_package('pkg-ma-allowed3', '1.3.4-1', get_host_arch(), 'allowed');
-$facts->add_installed_package('pkg-indep-normal', '1.3.4-1', 'all', 'no');
-$facts->add_installed_package('pkg-indep-foreign', '1.3.4-1', 'all', 'foreign');
-$facts->add_provided_package('myvirtual', undef, undef, 'mypackage');
-$facts->add_provided_package('myvirtual2', REL_EQ, '1.0-1', 'mypackage');
-$facts->add_provided_package('myvirtual3', REL_GE, '2.0-1', 'mypackage');
+foreach my $pkg (@realpkgs) {
+ $facts->add_installed_package(
+ $pkg->{package}, $pkg->{version},
+ $pkg->{architecture}, $pkg->{multiarch},
+ );
+}
+foreach my $virt (@virtpkgs) {
+ $facts->add_provided_package(
+ $virt->{virtual}, $virt->{relation}, $virt->{version},
+ $virt->{provided_by},
+ );
+}
my $field_duplicate = 'libc6 (>= 2.3), libc6 (>= 2.6-1), mypackage (>=
1.3), myvirtual | something, python (>= 2.5), mypackage2, pkg-ma-foreign,
diff --git a/scripts/t/Dpkg_Shlibs.t b/scripts/t/Dpkg_Shlibs.t
index 7cc325c..774f409 100644
--- a/scripts/t/Dpkg_Shlibs.t
+++ b/scripts/t/Dpkg_Shlibs.t
@@ -19,10 +19,15 @@ use warnings;
use Test::More;
use Test::Dpkg qw(:needs :paths);
+use Config;
use Cwd;
use IPC::Cmd qw(can_run);
-plan tests => 150;
+if (defined $Config{bin_ELF} && $Config{bin_ELF} eq 'define') {
+ plan tests => 150;
+} else {
+ plan skip_all => 'only ELF is currently supported';
+}
$ENV{DEB_BUILD_ARCH} = 'amd64';
$ENV{DEB_HOST_ARCH} = 'amd64';
diff --git a/scripts/t/Dpkg_Shlibs_Cppfilt.t b/scripts/t/Dpkg_Shlibs_Cppfilt.t
index 6a76977..f5bd22e 100644
--- a/scripts/t/Dpkg_Shlibs_Cppfilt.t
+++ b/scripts/t/Dpkg_Shlibs_Cppfilt.t
@@ -19,9 +19,15 @@ use warnings;
use Test::More;
use Test::Dpkg qw(:needs);
+use Config;
+
test_needs_command('c++filt');
-plan tests => 124;
+if (defined $Config{bin_ELF} && $Config{bin_ELF} eq 'define') {
+ plan tests => 124;
+} else {
+ plan skip_all => 'only ELF is currently supported';
+}
use_ok('Dpkg::Shlibs::Cppfilt');
diff --git a/scripts/t/Dpkg_Substvars.t b/scripts/t/Dpkg_Substvars.t
index 61ac027..b1c5b1b 100644
--- a/scripts/t/Dpkg_Substvars.t
+++ b/scripts/t/Dpkg_Substvars.t
@@ -16,7 +16,7 @@
use strict;
use warnings;
-use Test::More tests => 56;
+use Test::More tests => 60;
use Test::Dpkg qw(:paths);
use Dpkg ();
@@ -247,6 +247,32 @@ is($output, '', 'disabled unused variables warnings');
$s->delete('var_used');
+# Required variables
+my $sr;
+
+$expected = <<'VARS';
+required-var!=Required value
+VARS
+$sr = Dpkg::Substvars->new("$datadir/substvars-req");
+is($sr->output(), $expected, 'Required variable preserved');
+
+is($sr->substvars('This is a string with missing the required variable'),
+ 'This is a string with missing the required variable',
+ 'substvars required substitution missing');
+
+eval {
+ $sr->warn_about_unused();
+ 1;
+};
+$output = $@ // q{};
+is($output,
+ 'Dpkg_Substvars.t: error: required substitution variable ${required-var} not used' . "\n",
+ 'substvars required substitution not used');
+
+is($sr->substvars('This is a string with a required variable ${required-var}'),
+ 'This is a string with a required variable Required value',
+ 'substvars required substitution present');
+
# Variable filters
my $sf;
diff --git a/scripts/t/Dpkg_Substvars/substvars-req b/scripts/t/Dpkg_Substvars/substvars-req
new file mode 100644
index 0000000..442a27f
--- /dev/null
+++ b/scripts/t/Dpkg_Substvars/substvars-req
@@ -0,0 +1 @@
+required-var!=Required value
diff --git a/scripts/t/dpkg_buildpackage.t b/scripts/t/dpkg_buildpackage.t
index bfcd23f..3f8c73c 100644
--- a/scripts/t/dpkg_buildpackage.t
+++ b/scripts/t/dpkg_buildpackage.t
@@ -89,6 +89,9 @@ DA := debian/${binary-name-any}
# fakeroot confuses ASAN link order check.
export ASAN_OPTIONS = verify_asan_link_order=0
+# Do not fail due to leaks, as the code is still using lots of
+# static variables and error variables.
+export LSAN_OPTIONS = exitcode=0
clean:
rm -f debian/files
diff --git a/scripts/t/dpkg_buildpackage/test-source_0_source.hook b/scripts/t/dpkg_buildpackage/test-source_0_source.hook
index eb7387a..dde9b7d 100644
--- a/scripts/t/dpkg_buildpackage/test-source_0_source.hook
+++ b/scripts/t/dpkg_buildpackage/test-source_0_source.hook
@@ -3,7 +3,7 @@ hook: n=init a=1 p=test-source v=0 s=0 u=0
hook: n=preclean a=1 p=test-source v=0 s=0 u=0
hook: source-opts=
hook: n=source a=1 p=test-source v=0 s=0 u=0
-hook: build-target=
+hook: build-target=build
hook: n=build a=0 p=test-source v=0 s=0 u=0
hook: buildinfo-opts=--build=source --admindir=<ROOT>/dpkgdb -O../test-source_0_source.buildinfo
hook: n=buildinfo a=1 p=test-source v=0 s=0 u=0
diff --git a/scripts/t/mk.t b/scripts/t/mk.t
index a31eef7..f0db4d0 100644
--- a/scripts/t/mk.t
+++ b/scripts/t/mk.t
@@ -41,8 +41,8 @@ delete $ENV{MAKEFLAGS};
delete $ENV{$_} foreach grep { m/^DEB_/ } keys %ENV;
# Set architecture variables to not require dpkg nor gcc.
+$ENV{CC} = 'gcc';
$ENV{PATH} = "$srcdir/t/mock-bin:$ENV{PATH}";
-
$ENV{DEB_BUILD_PATH} = rel2abs($datadir);
sub test_makefile {
diff --git a/scripts/t/mk/architecture.mk b/scripts/t/mk/architecture.mk
index 2ac0222..295b804 100644
--- a/scripts/t/mk/architecture.mk
+++ b/scripts/t/mk/architecture.mk
@@ -1,36 +1,28 @@
+DEB_BUILD_ARCH := overridden
+TEST_DEB_BUILD_ARCH := overridden
+
include $(srcdir)/mk/architecture.mk
-test:
- test "$(DEB_BUILD_ARCH)" = "$(TEST_DEB_BUILD_ARCH)"
- test "$(DEB_BUILD_ARCH_ABI)" = "$(TEST_DEB_BUILD_ARCH_ABI)"
- test "$(DEB_BUILD_ARCH_BITS)" = "$(TEST_DEB_BUILD_ARCH_BITS)"
- test "$(DEB_BUILD_ARCH_CPU)" = "$(TEST_DEB_BUILD_ARCH_CPU)"
- test "$(DEB_BUILD_ARCH_ENDIAN)" = "$(TEST_DEB_BUILD_ARCH_ENDIAN)"
- test "$(DEB_BUILD_ARCH_LIBC)" = "$(TEST_DEB_BUILD_ARCH_LIBC)"
- test "$(DEB_BUILD_ARCH_OS)" = "$(TEST_DEB_BUILD_ARCH_OS)"
- test "$(DEB_BUILD_GNU_CPU)" = "$(TEST_DEB_BUILD_GNU_CPU)"
- test "$(DEB_BUILD_GNU_SYSTEM)" = "$(TEST_DEB_BUILD_GNU_SYSTEM)"
- test "$(DEB_BUILD_GNU_TYPE)" = "$(TEST_DEB_BUILD_GNU_TYPE)"
- test "$(DEB_BUILD_MULTIARCH)" = "$(TEST_DEB_BUILD_MULTIARCH)"
- test "$(DEB_HOST_ARCH)" = "$(TEST_DEB_HOST_ARCH)"
- test "$(DEB_HOST_ARCH_ABI)" = "$(TEST_DEB_HOST_ARCH_ABI)"
- test "$(DEB_HOST_ARCH_BITS)" = "$(TEST_DEB_HOST_ARCH_BITS)"
- test "$(DEB_HOST_ARCH_CPU)" = "$(TEST_DEB_HOST_ARCH_CPU)"
- test "$(DEB_HOST_ARCH_ENDIAN)" = "$(TEST_DEB_HOST_ARCH_ENDIAN)"
- test "$(DEB_HOST_ARCH_LIBC)" = "$(TEST_DEB_HOST_ARCH_LIBC)"
- test "$(DEB_HOST_ARCH_OS)" = "$(TEST_DEB_HOST_ARCH_OS)"
- test "$(DEB_HOST_GNU_CPU)" = "$(TEST_DEB_HOST_GNU_CPU)"
- test "$(DEB_HOST_GNU_SYSTEM)" = "$(TEST_DEB_HOST_GNU_SYSTEM)"
- test "$(DEB_HOST_GNU_TYPE)" = "$(TEST_DEB_HOST_GNU_TYPE)"
- test "$(DEB_HOST_MULTIARCH)" = "$(TEST_DEB_HOST_MULTIARCH)"
- test "$(DEB_TARGET_ARCH)" = "$(TEST_DEB_TARGET_ARCH)"
- test "$(DEB_TARGET_ARCH_ABI)" = "$(TEST_DEB_TARGET_ARCH_ABI)"
- test "$(DEB_TARGET_ARCH_BITS)" = "$(TEST_DEB_TARGET_ARCH_BITS)"
- test "$(DEB_TARGET_ARCH_CPU)" = "$(TEST_DEB_TARGET_ARCH_CPU)"
- test "$(DEB_TARGET_ARCH_ENDIAN)" = "$(TEST_DEB_TARGET_ARCH_ENDIAN)"
- test "$(DEB_TARGET_ARCH_LIBC)" = "$(TEST_DEB_TARGET_ARCH_LIBC)"
- test "$(DEB_TARGET_ARCH_OS)" = "$(TEST_DEB_TARGET_ARCH_OS)"
- test "$(DEB_TARGET_GNU_CPU)" = "$(TEST_DEB_TARGET_GNU_CPU)"
- test "$(DEB_TARGET_GNU_SYSTEM)" = "$(TEST_DEB_TARGET_GNU_SYSTEM)"
- test "$(DEB_TARGET_GNU_TYPE)" = "$(TEST_DEB_TARGET_GNU_TYPE)"
- test "$(DEB_TARGET_MULTIARCH)" = "$(TEST_DEB_TARGET_MULTIARCH)"
+vars := \
+ ARCH \
+ ARCH_ABI \
+ ARCH_BITS \
+ ARCH_CPU \
+ ARCH_ENDIAN \
+ ARCH_LIBC \
+ ARCH_OS \
+ GNU_CPU \
+ GNU_SYSTEM \
+ GNU_TYPE \
+ MULTIARCH \
+ # EOL
+loop_targets := $(foreach machine,BUILD HOST TARGET,\
+ $(foreach var,$(vars),DEB_$(machine)_$(var)))
+
+test: $(loop_targets)
+
+$(loop_targets):
+ : # Test the $@ Make variable.
+ test '$($@)' = '$(TEST_$@)'
+ : # Test the $@ exported variable.
+ test "$${$@}" = '$(TEST_$@)'
diff --git a/scripts/t/mk/buildapi.mk b/scripts/t/mk/buildapi.mk
index 96269bc..6ac92f9 100644
--- a/scripts/t/mk/buildapi.mk
+++ b/scripts/t/mk/buildapi.mk
@@ -1,4 +1,13 @@
include $(srcdir)/mk/buildapi.mk
-test:
- test "$(DPKG_BUILD_API)" = "0"
+TEST_DPKG_BUILD_API = 0
+
+test_vars := \
+ DPKG_BUILD_API \
+ # EOL
+
+test: $(test_vars)
+
+$(test_vars):
+ : # Test $@ Make variable.
+ test '$($@)' = '$(TEST_$@)'
diff --git a/scripts/t/mk/buildflags.mk b/scripts/t/mk/buildflags.mk
index 94d85a7..74ccac0 100644
--- a/scripts/t/mk/buildflags.mk
+++ b/scripts/t/mk/buildflags.mk
@@ -1,26 +1,37 @@
DEB_CPPFLAGS_MAINT_APPEND = -DTEST_MK=test-host
+TEST_CPPFLAGS += -DTEST_MK=test-host
+
DEB_CPPFLAGS_FOR_BUILD_MAINT_APPEND = -DTEST_MK=test-build
+TEST_CPPFLAGS_FOR_BUILD += -DTEST_MK=test-build
+
+DEB_CXXFLAGS_MAINT_SET := set-host
+TEST_CXXFLAGS := set-host
+
+DEB_CXXFLAGS_FOR_BUILD_MAINT_SET := set-build
+TEST_CXXFLAGS_FOR_BUILD := set-build
+
+DPKG_EXPORT_BUILDFLAGS := 1
include $(srcdir)/mk/buildflags.mk
-test:
- test "$(ASFLAGS)" = "$(TEST_ASFLAGS)"
- test "$(ASFLAGS_FOR_BUILD)" = "$(TEST_ASFLAGS_FOR_BUILD)"
- test "$(CFLAGS)" = "$(TEST_CFLAGS)"
- test "$(CFLAGS_FOR_BUILD)" = "$(TEST_CFLAGS_FOR_BUILD)"
- test "$(CPPFLAGS)" = "$(TEST_CPPFLAGS) -DTEST_MK=test-host"
- test "$(CPPFLAGS_FOR_BUILD)" = "$(TEST_CPPFLAGS_FOR_BUILD)-DTEST_MK=test-build"
- test "$(CXXFLAGS)" = "$(TEST_CXXFLAGS)"
- test "$(CXXFLAGS_FOR_BUILD)" = "$(TEST_CXXFLAGS_FOR_BUILD)"
- test "$(DFLAGS)" = "$(TEST_DFLAGS)"
- test "$(DFLAGS_FOR_BUILD)" = "$(TEST_DFLAGS_FOR_BUILD)"
- test "$(FCFLAGS)" = "$(TEST_FCFLAGS)"
- test "$(FCFLAGS_FOR_BUILD)" = "$(TEST_FCFLAGS_FOR_BUILD)"
- test "$(FFLAGS)" = "$(TEST_FFLAGS)"
- test "$(FFLAGS_FOR_BUILD)" = "$(TEST_FFLAGS_FOR_BUILD)"
- test "$(LDFLAGS)" = "$(TEST_LDFLAGS)"
- test "$(LDFLAGS_FOR_BUILD)" = "$(TEST_LDFLAGS_FOR_BUILD)"
- test "$(OBJCFLAGS)" = "$(TEST_OBJCFLAGS)"
- test "$(OBJCFLAGS_FOR_BUILD)" = "$(TEST_OBJCFLAGS_FOR_BUILD)"
- test "$(OBJCXXFLAGS)" = "$(TEST_OBJCXXFLAGS)"
- test "$(OBJCXXFLAGS_FOR_BUILD)" = "$(TEST_OBJCXXFLAGS_FOR_BUILD)"
+vars := \
+ ASFLAGS \
+ CFLAGS \
+ CPPFLAGS \
+ CXXFLAGS \
+ DFLAGS \
+ FCFLAGS \
+ FFLAGS \
+ LDFLAGS \
+ OBJCFLAGS \
+ OBJCXXFLAGS \
+ # EOL
+loop_targets := $(vars) $(vars:=_FOR_BUILD)
+
+test: $(loop_targets)
+
+$(loop_targets):
+ : # Test the $@ Make variable.
+ test '$($@)' = '$(TEST_$@)'
+ : # Test the $@ exported variable.
+ test "$${$@}" = '$(TEST_$@)'
diff --git a/scripts/t/mk/buildopts.mk b/scripts/t/mk/buildopts.mk
index 46d0efa..a7cf2a3 100644
--- a/scripts/t/mk/buildopts.mk
+++ b/scripts/t/mk/buildopts.mk
@@ -1,4 +1,11 @@
include $(srcdir)/mk/buildopts.mk
-test:
- test "$(DEB_BUILD_OPTION_PARALLEL)" = "$(TEST_DEB_BUILD_OPTION_PARALLEL)"
+test_vars := \
+ DEB_BUILD_OPTION_PARALLEL \
+ # EOL
+
+test: $(test_vars)
+
+$(test_vars):
+ : # Test the $@ Make variable.
+ test '$($@)' = '$(TEST_$@)'
diff --git a/scripts/t/mk/buildtools.mk b/scripts/t/mk/buildtools.mk
index 6c27c5c..745e03b 100644
--- a/scripts/t/mk/buildtools.mk
+++ b/scripts/t/mk/buildtools.mk
@@ -1,33 +1,35 @@
+AR := overridden
+TEST_AR := overridden
+TEST_AR_FOR_BUILD := overridden
+
+DPKG_EXPORT_BUILDTOOLS := 1
+
include $(srcdir)/mk/buildtools.mk
-test:
- test "$(AS)" = "$(TEST_AS)"
- test "$(AS_FOR_BUILD)" = "$(TEST_AS_FOR_BUILD)"
- test "$(CC)" = "$(TEST_CC)"
- test "$(CC_FOR_BUILD)" = "$(TEST_CC_FOR_BUILD)"
- test "$(CXX)" = "$(TEST_CXX)"
- test "$(CXX_FOR_BUILD)" = "$(TEST_CXX_FOR_BUILD)"
- test "$(OBJC)" = "$(TEST_OBJC)"
- test "$(OBJC_FOR_BUILD)" = "$(TEST_OBJC_FOR_BUILD)"
- test "$(OBJCXX)" = "$(TEST_OBJCXX)"
- test "$(OBJCXX_FOR_BUILD)" = "$(TEST_OBJCXX_FOR_BUILD)"
- test "$(F77)" = "$(TEST_F77)"
- test "$(F77_FOR_BUILD)" = "$(TEST_F77_FOR_BUILD)"
- test "$(FC)" = "$(TEST_FC)"
- test "$(FC_FOR_BUILD)" = "$(TEST_FC_FOR_BUILD)"
- test "$(LD)" = "$(TEST_LD)"
- test "$(LD_FOR_BUILD)" = "$(TEST_LD_FOR_BUILD)"
- test "$(STRIP)" = "$(TEST_STRIP)"
- test "$(STRIP_FOR_BUILD)" = "$(TEST_STRIP_FOR_BUILD)"
- test "$(OBJCOPY)" = "$(TEST_OBJCOPY)"
- test "$(OBJCOPY_FOR_BUILD)" = "$(TEST_OBJCOPY_FOR_BUILD)"
- test "$(OBJDUMP)" = "$(TEST_OBJDUMP)"
- test "$(OBJDUMP_FOR_BUILD)" = "$(TEST_OBJDUMP_FOR_BUILD)"
- test "$(NM)" = "$(TEST_NM)"
- test "$(NM_FOR_BUILD)" = "$(TEST_NM_FOR_BUILD)"
- test "$(AR)" = "$(TEST_AR)"
- test "$(AR_FOR_BUILD)" = "$(TEST_AR_FOR_BUILD)"
- test "$(RANLIB)" = "$(TEST_RANLIB)"
- test "$(RANLIB_FOR_BUILD)" = "$(TEST_RANLIB_FOR_BUILD)"
- test "$(PKG_CONFIG)" = "$(TEST_PKG_CONFIG)"
- test "$(PKG_CONFIG_FOR_BUILD)" = "$(TEST_PKG_CONFIG_FOR_BUILD)"
+tools := \
+ AR \
+ AS \
+ CC \
+ CPP \
+ CXX \
+ F77 \
+ FC \
+ LD \
+ NM \
+ OBJC \
+ OBJCOPY \
+ OBJCXX \
+ OBJDUMP \
+ PKG_CONFIG \
+ RANLIB \
+ STRIP \
+ # EOL
+loop_targets := $(tools) $(tools:=_FOR_BUILD)
+
+test: $(loop_targets)
+
+$(loop_targets):
+ : # Test the $@ Make variable.
+ test '$($@)' = '$(TEST_$@)'
+ : # Test the $@ exported variable.
+ test "$${$@}" = '$(TEST_$@)'
diff --git a/scripts/t/mk/pkg-info.mk b/scripts/t/mk/pkg-info.mk
index c0e3287..6eb3786 100644
--- a/scripts/t/mk/pkg-info.mk
+++ b/scripts/t/mk/pkg-info.mk
@@ -1,11 +1,26 @@
include $(srcdir)/mk/pkg-info.mk
-test:
- test "$(DEB_SOURCE)" = "source"
- test "$(DEB_VERSION)" = "1:2:3.4-5-6"
- test "$(DEB_VERSION_EPOCH_UPSTREAM)" = "1:2:3.4-5"
- test "$(DEB_VERSION_UPSTREAM_REVISION)" = "2:3.4-5-6"
- test "$(DEB_VERSION_UPSTREAM)" = "2:3.4-5"
- test "$(DEB_DISTRIBUTION)" = "suite"
- test '$(SOURCE_DATE_EPOCH)' = '$(TEST_SOURCE_DATE_EPOCH)'
+TEST_DEB_SOURCE = source
+TEST_DEB_VERSION = 1:2:3.4-5-6
+TEST_DEB_VERSION_EPOCH_UPSTREAM = 1:2:3.4-5
+TEST_DEB_VERSION_UPSTREAM_REVISION = 2:3.4-5-6
+TEST_DEB_VERSION_UPSTREAM = 2:3.4-5
+TEST_DEB_DISTRIBUTION = suite
+
+test_vars := \
+ DEB_SOURCE \
+ DEB_VERSION \
+ DEB_VERSION_EPOCH_UPSTREAM \
+ DEB_VERSION_UPSTREAM_REVISION \
+ DEB_VERSION_UPSTREAM \
+ DEB_DISTRIBUTION \
+ SOURCE_DATE_EPOCH \
+ # EOL
+
+test: $(test_vars)
+ : # Test the SOURCE_DATE_EPOCH exported variable.
test "$${SOURCE_DATE_EPOCH}" = '$(TEST_SOURCE_DATE_EPOCH)'
+
+$(test_vars):
+ : # Test the $@ Make variable.
+ test '$($@)' = '$(TEST_$@)'
diff --git a/scripts/t/mk/vendor-v0.mk b/scripts/t/mk/vendor-v0.mk
index 602a8c6..fbd0ba1 100644
--- a/scripts/t/mk/vendor-v0.mk
+++ b/scripts/t/mk/vendor-v0.mk
@@ -3,4 +3,5 @@ dpkg_vendor_derives_from = $(dpkg_vendor_derives_from_v0)
include $(srcdir)/mk/vendor.mk
test:
+ : # Test the dpkg_vendor_derives_from v0 macro.
test "$(shell $(call dpkg_vendor_derives_from,debian))" = "yes"
diff --git a/scripts/t/mk/vendor-v1.mk b/scripts/t/mk/vendor-v1.mk
index 11c1314..d468570 100644
--- a/scripts/t/mk/vendor-v1.mk
+++ b/scripts/t/mk/vendor-v1.mk
@@ -3,4 +3,5 @@ include $(srcdir)/mk/vendor.mk
dpkg_vendor_derives_from = $(dpkg_vendor_derives_from_v1)
test:
+ : # Test the dpkg_vendor_derives_from v1 macro.
test "$(call dpkg_vendor_derives_from,debian)" = "yes"
diff --git a/scripts/t/mk/vendor.mk b/scripts/t/mk/vendor.mk
index 4e0d9ff..9d89f0f 100644
--- a/scripts/t/mk/vendor.mk
+++ b/scripts/t/mk/vendor.mk
@@ -1,6 +1,17 @@
include $(srcdir)/mk/vendor.mk
-test:
- test "$(DEB_VENDOR)" = "Debian"
- test "$(DEB_PARENT_VENDOR)" = ""
+TEST_DEB_VENDOR = Debian
+TEST_DEB_PARENT_VENDOR =
+
+test_vars := \
+ DEB_VENDOR \
+ DEB_PARENT_VENDOR \
+ # EOL
+
+test: $(test_vars)
+ : # Test the dpkg_vendor_derives_from macro.
test "$(shell $(call dpkg_vendor_derives_from,debian))" = "yes"
+
+$(test_vars):
+ : # Test $@ Make variable.
+ test '$($@)' = '$(TEST_$@)'