Commit | Line | Data |
---|---|---|
1479465f GJ |
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 | ||
16 | use strict; | |
17 | use warnings; | |
18 | ||
19 | use Test::More tests => 26; | |
20 | ||
21 | BEGIN { | |
22 | use_ok('Dpkg::Build::Types'); | |
23 | } | |
24 | ||
25 | ok(build_is(BUILD_DEFAULT | BUILD_FULL), 'build is default full'); | |
26 | is(get_build_options_from_type(), 'full', 'build is full'); | |
27 | ||
28 | set_build_type(BUILD_DEFAULT | BUILD_BINARY, '--default-binary'); | |
29 | is(get_build_options_from_type(), 'binary', 'build is binary'); | |
30 | ok(build_is(BUILD_DEFAULT | BUILD_BINARY), 'build is default binary'); | |
31 | ||
32 | set_build_type(BUILD_SOURCE | BUILD_ARCH_INDEP, '--build=source,all'); | |
33 | is(get_build_options_from_type(), 'source,all', 'build is source,all'); | |
34 | ||
35 | set_build_type_from_options('any,all', '--build=any,all', nocheck => 1); | |
36 | is(get_build_options_from_type(), 'binary', 'build is binary from any,all'); | |
37 | ok(build_is(BUILD_BINARY), 'build is any,all'); | |
38 | ||
39 | set_build_type_from_options('binary', '--build=binary', nocheck => 1); | |
40 | is(get_build_options_from_type(), 'binary', 'build is binary'); | |
41 | ok(build_is(BUILD_BINARY), 'build is binary'); | |
42 | ||
43 | set_build_type_from_options('source,all', '--build=source,all', nocheck => 1); | |
44 | ok(build_is(BUILD_SOURCE | BUILD_ARCH_INDEP), 'build source,all is source,all'); | |
45 | ok(!build_is(BUILD_SOURCE | BUILD_ARCH_DEP), 'build source,all is not source,any'); | |
46 | ok(build_has_any(BUILD_SOURCE), 'build source,all has_any source'); | |
47 | ok(build_has_any(BUILD_ARCH_INDEP), 'build source,all has_any any'); | |
48 | ok(build_has_none(BUILD_DEFAULT), 'build source,all has_none default'); | |
49 | ok(build_has_none(BUILD_ARCH_DEP), 'build source,all has_none any'); | |
50 | ok(!build_has_all(BUILD_BINARY), 'build source,all not has_all binary'); | |
51 | ok(!build_has_all(BUILD_SOURCE | BUILD_ARCH_DEP), | |
52 | 'build source,all not has_all source,any'); | |
53 | ok(!build_has_all(BUILD_FULL), 'build source,all has_all full'); | |
54 | ||
55 | set_build_type(BUILD_BINARY, '--build=binary', nocheck => 1); | |
56 | ok(build_is(BUILD_BINARY), 'build binary is binary'); | |
57 | ok(build_has_any(BUILD_ARCH_DEP), 'build binary has_any any'); | |
58 | ok(build_has_any(BUILD_ARCH_INDEP), 'build binary has_any all'); | |
59 | ok(build_has_all(BUILD_BINARY), 'build binary has_all binary'); | |
60 | ok(build_has_none(BUILD_SOURCE), 'build binary has_none source'); | |
61 | ||
62 | set_build_type(BUILD_FULL, '--build=full', nocheck => 1); | |
63 | ok(build_has_any(BUILD_SOURCE), 'build full has_any source'); | |
64 | ok(build_has_all(BUILD_BINARY), 'build full has_all binary'); | |
65 | ||
66 | 1; |