1#!/usr/bin/perl 2# 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 2 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <https://www.gnu.org/licenses/>. 15 16use strict; 17use warnings; 18 19use Test::More tests => 39; 20 21BEGIN { 22 use_ok('Dpkg::Build::Types'); 23} 24 25ok(build_is(BUILD_DEFAULT | BUILD_FULL), 'build is default full'); 26is(get_build_options_from_type(), 'full', 'build is full'); 27 28set_build_type(BUILD_DEFAULT | BUILD_BINARY, '--default-binary'); 29is(get_build_options_from_type(), 'binary', 'build is binary'); 30ok(build_is(BUILD_DEFAULT | BUILD_BINARY), 'build is default binary'); 31 32set_build_type(BUILD_SOURCE | BUILD_ARCH_INDEP, '--build=source,all'); 33is(get_build_options_from_type(), 'source,all', 'build is source,all'); 34 35set_build_type_from_options('any,all', '--build=any,all', nocheck => 1); 36is(get_build_options_from_type(), 'binary', 'build is binary from any,all'); 37ok(build_is(BUILD_BINARY), 'build is any,all'); 38 39set_build_type_from_options('binary', '--build=binary', nocheck => 1); 40is(get_build_options_from_type(), 'binary', 'build is binary'); 41ok(build_is(BUILD_BINARY), 'build is binary'); 42 43set_build_type_from_options('source,all', '--build=source,all', nocheck => 1); 44ok(build_is(BUILD_SOURCE | BUILD_ARCH_INDEP), 'build source,all is source,all'); 45ok(!build_is(BUILD_SOURCE | BUILD_ARCH_DEP), 'build source,all is not source,any'); 46ok(build_has_any(BUILD_SOURCE), 'build source,all has_any source'); 47ok(build_has_any(BUILD_ARCH_INDEP), 'build source,all has_any any'); 48ok(build_has_none(BUILD_DEFAULT), 'build source,all has_none default'); 49ok(build_has_none(BUILD_ARCH_DEP), 'build source,all has_none any'); 50ok(!build_has_all(BUILD_BINARY), 'build source,all not has_all binary'); 51ok(!build_has_all(BUILD_SOURCE | BUILD_ARCH_DEP), 52 'build source,all not has_all source,any'); 53ok(!build_has_all(BUILD_FULL), 'build source,all has_all full'); 54 55set_build_type_from_targets('build-arch,build-indep', 56 '--targets=build-arch,build-indep', nocheck => 1); 57is(get_build_options_from_type(), 'binary', 58 'build is binary from build-arch,build-indep'); 59ok(build_is(BUILD_BINARY), 'build is binary from build-arch,build-indep'); 60 61set_build_type_from_targets('binary', '--targets=binary', nocheck => 1); 62is(get_build_options_from_type(), 'binary', 'build is binary from binary'); 63ok(build_is(BUILD_BINARY), 'build is binary from binary'); 64 65set_build_type_from_targets('clean,binary-indep', 66 '--targets=clean,binary-indep', nocheck => 1); 67ok(build_is(BUILD_SOURCE | BUILD_ARCH_INDEP), 'build source,all is source,all'); 68ok(!build_is(BUILD_SOURCE | BUILD_ARCH_DEP), 'build source,all is not source,any'); 69ok(build_has_any(BUILD_SOURCE), 'build source,all has_any source'); 70ok(build_has_any(BUILD_ARCH_INDEP), 'build source,all has_any any'); 71ok(build_has_none(BUILD_DEFAULT), 'build source,all has_none default'); 72ok(build_has_none(BUILD_ARCH_DEP), 'build source,all has_none any'); 73ok(!build_has_all(BUILD_BINARY), 'build source,all not has_all binary'); 74ok(!build_has_all(BUILD_SOURCE | BUILD_ARCH_DEP), 75 'build source,all not has_all source,any'); 76ok(!build_has_all(BUILD_FULL), 'build source,all has_all full'); 77 78set_build_type(BUILD_BINARY, '--build=binary', nocheck => 1); 79ok(build_is(BUILD_BINARY), 'build binary is binary'); 80ok(build_has_any(BUILD_ARCH_DEP), 'build binary has_any any'); 81ok(build_has_any(BUILD_ARCH_INDEP), 'build binary has_any all'); 82ok(build_has_all(BUILD_BINARY), 'build binary has_all binary'); 83ok(build_has_none(BUILD_SOURCE), 'build binary has_none source'); 84 85set_build_type(BUILD_FULL, '--build=full', nocheck => 1); 86ok(build_has_any(BUILD_SOURCE), 'build full has_any source'); 87ok(build_has_all(BUILD_BINARY), 'build full has_all binary'); 88 891; 90