1 | # $Id: select 2413 2010-09-11 17:43:04Z bird $ -*-perl-*-
|
---|
2 | ## @file
|
---|
3 | # $(select when1-cond, when1-body[,whenN-cond, whenN-body])
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2008-2010 knut st. osmundsen <[email protected]>
|
---|
8 | #
|
---|
9 | # This file is part of kBuild.
|
---|
10 | #
|
---|
11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version 3 of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kBuild is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kBuild. If not, see <http://www.gnu.org/licenses/>
|
---|
23 | #
|
---|
24 | #
|
---|
25 |
|
---|
26 | $description = "Tests the $(select ) conditional function";
|
---|
27 |
|
---|
28 | $details = "A few simple tests, nothing spectacular.";
|
---|
29 |
|
---|
30 | if ($is_kmk) {
|
---|
31 |
|
---|
32 | # TEST #0 - check that the feature is present.
|
---|
33 | # --------------------------------------------
|
---|
34 | run_make_test('
|
---|
35 | ifneq ($(select 0,failed,1,success),success)
|
---|
36 | $(error sub-test 0 failed)
|
---|
37 | endif
|
---|
38 |
|
---|
39 | .PHONY: all
|
---|
40 | all: ; @:
|
---|
41 | ',
|
---|
42 | '',
|
---|
43 | '');
|
---|
44 |
|
---|
45 | # TEST #1 - the real test.
|
---|
46 | # ------------------------
|
---|
47 | run_make_test('
|
---|
48 |
|
---|
49 | ifneq ($(select 0,failed,1-1,failed2,otherwise,success),success)
|
---|
50 | $(error sub-test 0 failed)
|
---|
51 | endif
|
---|
52 | ifneq ($(select 0,failed,1-1,failed2,otherwise:,success),success)
|
---|
53 | $(error sub-test 1 failed)
|
---|
54 | endif
|
---|
55 | ifneq ($(select 0,failed,1-1,failed2, otherwise:,success),success)
|
---|
56 | $(error sub-test 2 failed)
|
---|
57 | endif
|
---|
58 | ifneq ($(select 0,failed,1-1,failed2, otherwise: ,success),success)
|
---|
59 | $(error sub-test 3 failed)
|
---|
60 | endif
|
---|
61 | ifneq ($(select 0,failed,1-1,failed2, otherwise : ,success),success)
|
---|
62 | $(error sub-test 4 failed)
|
---|
63 | endif
|
---|
64 | ifneq ($(select 0,failed,1-1,failed2, default: ,success),success)
|
---|
65 | $(error sub-test 5 failed)
|
---|
66 | endif
|
---|
67 | ifneq ($(select 0,failed,1-1,failed2,default,success),success)
|
---|
68 | $(error sub-test 6 failed)
|
---|
69 | endif
|
---|
70 |
|
---|
71 | ifneq ($(select 0,failed),)
|
---|
72 | $(error sub-test 10 failed)
|
---|
73 | endif
|
---|
74 | ifneq ($(select 1,works),works)
|
---|
75 | $(error sub-test 11 failed)
|
---|
76 | endif
|
---|
77 | ifneq ($(select 0,failed,1,success,1,failed3,otherwise,failed4),success)
|
---|
78 | $(error sub-test 12 failed)
|
---|
79 | endif
|
---|
80 |
|
---|
81 |
|
---|
82 | .PHONY: all
|
---|
83 | all: ; @:
|
---|
84 | ',
|
---|
85 | '',
|
---|
86 | '');
|
---|
87 | }
|
---|
88 |
|
---|
89 |
|
---|
90 |
|
---|
91 | # Indicate that we're done.
|
---|
92 | 1;
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 |
|
---|