summaryrefslogtreecommitdiff
path: root/scripts/t
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2017-12-10 12:07:42 +0100
committerGuillem Jover <guillem@debian.org>2018-01-16 11:24:54 +0100
commit2f5816d8be40b449d2473b22f9e0c33b32f3bd78 (patch)
treeaadb98654b08bd03c92869aaaa6cd143af308369 /scripts/t
parent797ed78bd87c77b6fa9c3867d0fefa90bb21014c (diff)
downloaddpkg-2f5816d8be40b449d2473b22f9e0c33b32f3bd78.tar.gz
scripts: Reject negated values in Architecture field
Add new positive options argument to arch validators, as the Architecture field should not accept negated architectures. We preserve the current functions default behavior and add a new option to control whether to reject negated architectures. Fixes: commit d355b340f3a6cde7fc1cb5649d82fbebd3b97ea1 Stable-Candidate: 1.18.x
Diffstat (limited to 'scripts/t')
-rw-r--r--scripts/t/Dpkg_Arch.t9
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/t/Dpkg_Arch.t b/scripts/t/Dpkg_Arch.t
index 525817085..0ef9d1899 100644
--- a/scripts/t/Dpkg_Arch.t
+++ b/scripts/t/Dpkg_Arch.t
@@ -16,7 +16,7 @@
use strict;
use warnings;
-use Test::More tests => 16367;
+use Test::More tests => 16369;
use_ok('Dpkg::Arch', qw(debarch_to_debtuple debarch_to_multiarch
debarch_eq debarch_is debarch_is_wildcard
@@ -148,9 +148,16 @@ my @arch_ref;
@arch_new = debarch_list_parse('amd64 !arm64 linux-i386 !kfreebsd-any');
is_deeply(\@arch_new, \@arch_ref, 'parse valid arch list');
+@arch_ref = qw(amd64 arm64 linux-i386 kfreebsd-any);
+@arch_new = debarch_list_parse('amd64 arm64 linux-i386 kfreebsd-any', positive => 1);
+is_deeply(\@arch_new, \@arch_ref, 'parse valid positive arch list');
+
eval { @arch_new = debarch_list_parse('!amd64!arm64') };
ok($@, 'parse concatenated arches failed');
+eval { @arch_new = debarch_list_parse('amd64 !arm64 !mips', positive => 1) };
+ok($@, 'parse disallowed negated arches failed');
+
is(debarch_to_abiattrs(undef), undef, 'undef ABI attrs');
is_deeply([ debarch_to_abiattrs('amd64') ], [ qw(64 little) ], 'amd64 ABI attrs');