summaryrefslogtreecommitdiff
path: root/tests/scripts/features/override
blob: fff6c4e82733b1d82721b3a69e4fc71d3d213253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#                                                                    -*-perl-*-

$description = "Test the override directive on variable assignments.";

$details = "";

# TEST 0: Basic override

run_make_test('
X = start
override recur = $(X)
override simple := $(X)
X = end
all: ; @echo "$(recur) $(simple)"
',
              'recur=I simple=J', "end start\n");

# TEST 1: Override with append

run_make_test('
X += X1
override X += X2
override Y += Y1
Y += Y2
all: ; @echo "$(X) $(Y)"
',
              '', "X1 X2 Y1\n");

# TEST 2: Override with append to the command line

run_make_test(undef, 'X=C Y=C', "C X2 C Y1\n");

# Test override of define/endef

run_make_test('
override define foo
@echo First comes the definition.
@echo Then comes the override.
endef
all: ; $(foo)
',
              'foo=Hello', "First comes the definition.\nThen comes the override.\n");


1;