From 9a08cbfcc1ef900a04580f35afe2a4592d7d6030 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 02:45:20 +0200 Subject: Adding upstream version 1.19.8. Signed-off-by: Daniel Baumann --- scripts/t/Dpkg_Build_Types.t | 89 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 scripts/t/Dpkg_Build_Types.t (limited to 'scripts/t/Dpkg_Build_Types.t') diff --git a/scripts/t/Dpkg_Build_Types.t b/scripts/t/Dpkg_Build_Types.t new file mode 100644 index 0000000..03c7055 --- /dev/null +++ b/scripts/t/Dpkg_Build_Types.t @@ -0,0 +1,89 @@ +#!/usr/bin/perl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +use strict; +use warnings; + +use Test::More tests => 39; + +BEGIN { + use_ok('Dpkg::Build::Types'); +} + +ok(build_is(BUILD_DEFAULT | BUILD_FULL), 'build is default full'); +is(get_build_options_from_type(), 'full', 'build is full'); + +set_build_type(BUILD_DEFAULT | BUILD_BINARY, '--default-binary'); +is(get_build_options_from_type(), 'binary', 'build is binary'); +ok(build_is(BUILD_DEFAULT | BUILD_BINARY), 'build is default binary'); + +set_build_type(BUILD_SOURCE | BUILD_ARCH_INDEP, '--build=source,all'); +is(get_build_options_from_type(), 'source,all', 'build is source,all'); + +set_build_type_from_options('any,all', '--build=any,all', nocheck => 1); +is(get_build_options_from_type(), 'binary', 'build is binary from any,all'); +ok(build_is(BUILD_BINARY), 'build is any,all'); + +set_build_type_from_options('binary', '--build=binary', nocheck => 1); +is(get_build_options_from_type(), 'binary', 'build is binary'); +ok(build_is(BUILD_BINARY), 'build is binary'); + +set_build_type_from_options('source,all', '--build=source,all', nocheck => 1); +ok(build_is(BUILD_SOURCE | BUILD_ARCH_INDEP), 'build source,all is source,all'); +ok(!build_is(BUILD_SOURCE | BUILD_ARCH_DEP), 'build source,all is not source,any'); +ok(build_has_any(BUILD_SOURCE), 'build source,all has_any source'); +ok(build_has_any(BUILD_ARCH_INDEP), 'build source,all has_any any'); +ok(build_has_none(BUILD_DEFAULT), 'build source,all has_none default'); +ok(build_has_none(BUILD_ARCH_DEP), 'build source,all has_none any'); +ok(!build_has_all(BUILD_BINARY), 'build source,all not has_all binary'); +ok(!build_has_all(BUILD_SOURCE | BUILD_ARCH_DEP), + 'build source,all not has_all source,any'); +ok(!build_has_all(BUILD_FULL), 'build source,all has_all full'); + +set_build_type_from_targets('build-arch,build-indep', + '--targets=build-arch,build-indep', nocheck => 1); +is(get_build_options_from_type(), 'binary', + 'build is binary from build-arch,build-indep'); +ok(build_is(BUILD_BINARY), 'build is binary from build-arch,build-indep'); + +set_build_type_from_targets('binary', '--targets=binary', nocheck => 1); +is(get_build_options_from_type(), 'binary', 'build is binary from binary'); +ok(build_is(BUILD_BINARY), 'build is binary from binary'); + +set_build_type_from_targets('clean,binary-indep', + '--targets=clean,binary-indep', nocheck => 1); +ok(build_is(BUILD_SOURCE | BUILD_ARCH_INDEP), 'build source,all is source,all'); +ok(!build_is(BUILD_SOURCE | BUILD_ARCH_DEP), 'build source,all is not source,any'); +ok(build_has_any(BUILD_SOURCE), 'build source,all has_any source'); +ok(build_has_any(BUILD_ARCH_INDEP), 'build source,all has_any any'); +ok(build_has_none(BUILD_DEFAULT), 'build source,all has_none default'); +ok(build_has_none(BUILD_ARCH_DEP), 'build source,all has_none any'); +ok(!build_has_all(BUILD_BINARY), 'build source,all not has_all binary'); +ok(!build_has_all(BUILD_SOURCE | BUILD_ARCH_DEP), + 'build source,all not has_all source,any'); +ok(!build_has_all(BUILD_FULL), 'build source,all has_all full'); + +set_build_type(BUILD_BINARY, '--build=binary', nocheck => 1); +ok(build_is(BUILD_BINARY), 'build binary is binary'); +ok(build_has_any(BUILD_ARCH_DEP), 'build binary has_any any'); +ok(build_has_any(BUILD_ARCH_INDEP), 'build binary has_any all'); +ok(build_has_all(BUILD_BINARY), 'build binary has_all binary'); +ok(build_has_none(BUILD_SOURCE), 'build binary has_none source'); + +set_build_type(BUILD_FULL, '--build=full', nocheck => 1); +ok(build_has_any(BUILD_SOURCE), 'build full has_any source'); +ok(build_has_all(BUILD_BINARY), 'build full has_all binary'); + +1; -- cgit v1.2.3