VirtualBox

source: kBuild/trunk/src/kmk/tests/scripts/variables/private@ 2634

Last change on this file since 2634 was 2591, checked in by bird, 13 years ago

kmk: Merged in changes from GNU make 3.82. Previous GNU make base version was gnumake-2008-10-28-CVS.

File size: 1.5 KB
Line 
1# -*-perl-*-
2
3$description = "Test 'private' variables.";
4
5$details = "";
6
7# 1: Simple verification that private variables are not inherited
8&run_make_test('
9a:
10F = g
11a: F = a
12b: private F = b
13
14a b c: ; @echo $@: F=$(F)
15a: b
16b: c
17',
18 '', "c: F=a\nb: F=b\na: F=a\n");
19
20# 2: Again, but this time we start with "b" so "a"'s variable is not in scope
21&run_make_test(undef, 'b', "c: F=g\nb: F=b\n");
22
23# 3: Verification with pattern-specific variables
24&run_make_test('
25t.a:
26
27F1 = g
28F2 = g
29%.a: private F1 = a
30%.a: F2 = a
31
32t.a t.b: ; @echo $@: F1=$(F1) / F2=$(F2)
33t.a: t.b
34',
35 '', "t.b: F1=g / F2=a\nt.a: F1=a / F2=a\n");
36
37# 4: Test private global variables
38&run_make_test('
39a:
40private F = g
41G := $(F)
42a:
43b: F = b
44
45a b: ; @echo $@: F=$(F) / G=$(G)
46a: b
47',
48 '', "b: F=b / G=g\na: F= / G=g\n");
49
50# 5: Multiple conditions on the same variable. Test export.
51delete $ENV{'_X'};
52&run_make_test('
53_X = x
54a: export override private _X = a
55a: ; @echo _X=$(_X) / _X=$$_X
56',
57 '', "_X=a / _X=a");
58
59# 6: Test override.
60&run_make_test(undef, '_X=c', "_X=a / _X=a\n");
61
62# 7: Ensure keywords still work as targets
63&run_make_test('
64a: export override private foo bar
65foo bar export override private: ; @echo $@
66',
67 '', "export\noverride\nprivate\nfoo\nbar\n");
68
69# 8: Ensure keywords still work as variables
70&run_make_test('
71private = g
72a: private = a
73a: b
74a b: ; @echo $@=$(private)
75',
76 '', "b=a\na=a\n");
77
781;
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette