summaryrefslogtreecommitdiffstats
path: root/scripts/t/Dpkg_BuildFlags.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:40:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:40:28 +0000
commit774e54c8927088c60617dc9345f55eaabb23256a (patch)
tree7d82ddb667eaec624064c430b57818c78184e3c7 /scripts/t/Dpkg_BuildFlags.t
parentAdding upstream version 1.22.4. (diff)
downloaddpkg-774e54c8927088c60617dc9345f55eaabb23256a.tar.xz
dpkg-774e54c8927088c60617dc9345f55eaabb23256a.zip
Adding upstream version 1.22.5.upstream/1.22.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/t/Dpkg_BuildFlags.t')
-rw-r--r--scripts/t/Dpkg_BuildFlags.t117
1 files changed, 116 insertions, 1 deletions
diff --git a/scripts/t/Dpkg_BuildFlags.t b/scripts/t/Dpkg_BuildFlags.t
index 530871c..515ed15 100644
--- a/scripts/t/Dpkg_BuildFlags.t
+++ b/scripts/t/Dpkg_BuildFlags.t
@@ -16,7 +16,7 @@
use strict;
use warnings;
-use Test::More tests => 40;
+use Test::More tests => 100;
BEGIN {
$ENV{DEB_BUILD_ARCH} = 'amd64';
@@ -171,4 +171,119 @@ $ENV{DEB_BUILD_MAINT_OPTIONS} = 'future=+lfs abi=-lfs';
$bf = Dpkg::BuildFlags->new();
test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+# Test time64 abi features, for a 64-bit system, a 32-bit system with time64
+# and a 32-bit system with time32.
+
+# 32-bit system with time32, time64 not enabled by default.
+$ENV{DEB_BUILD_ARCH} = 'i386';
+$ENV{DEB_HOST_ARCH} = 'i386';
+
+undef $ENV{DEB_BUILD_MAINT_OPTIONS};
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
+$bf = Dpkg::BuildFlags->new();
+test_has_flag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_flag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=-time64';
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+# 32-bit system with time32 and no time64.
+$ENV{DEB_BUILD_ARCH} = 'hurd-i386';
+$ENV{DEB_HOST_ARCH} = 'hurd-i386';
+
+undef $ENV{DEB_BUILD_MAINT_OPTIONS};
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=-time64';
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+# 32-bit system with time32, time64 enabled by default.
+$ENV{DEB_BUILD_ARCH} = 'armhf';
+$ENV{DEB_HOST_ARCH} = 'armhf';
+
+undef $ENV{DEB_BUILD_MAINT_OPTIONS};
+$bf = Dpkg::BuildFlags->new();
+test_has_flag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_flag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
+$bf = Dpkg::BuildFlags->new();
+test_has_flag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_flag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=-time64';
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_flag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_flag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+# 64-bit system with built-in time64.
+$ENV{DEB_BUILD_ARCH} = 'amd64';
+$ENV{DEB_HOST_ARCH} = 'amd64';
+
+undef $ENV{DEB_BUILD_MAINT_OPTIONS};
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=-time64';
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
+test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
+test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
# TODO: Add more test cases.