VirtualBox

source: kBuild/vendor/gnumake/current/tests/scripts/features/shell_assignment@ 3208

最後變更 在這個檔案從3208是 3138,由 bird 提交於 7 年 前

Imported make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6) from https://git.savannah.gnu.org/git/make.git.

  • 屬性 svn:eol-style 設為 native
檔案大小: 1.8 KB
 
1# -*-perl-*-
2
3$description = "Test BSD-style shell assignments (VAR != VAL) for variables.";
4
5$details = "";
6
7# TEST 0: Basic shell assignment (!=).
8
9run_make_test('
10.POSIX:
11
12demo1!=printf \' 1 2 3\n4\n\n5 \n \n 6\n\n\n\n\'
13demo2 != printf \'7 8\n \'
14demo3 != printf \'$$(demo2)\'
15demo4 != printf \' 2 3 \n\'
16demo5 != printf \' 2 3 \n\n\'
17all: ; @echo "<$(demo1)> <$(demo2)> <$(demo3)> <$(demo4)> <${demo5}>"
18',
19 '', "< 1 2 3 4 5 6 > <7 8 > <7 8 > < 2 3 > < 2 3 >\n");
20
21# TEST 1: Handle '#' the same way as BSD make
22
23run_make_test('
24foo1!=echo bar#baz
25hash != printf \'\043\'
26foo2!= echo "bar$(hash)baz"
27
28all: ; @echo "<$(foo1)> <$(hash)> <$(foo2)>"
29',
30 '', "<bar> <#> <bar#baz>\n");
31
32# TEST 2: shell assignment variables (from !=) should be recursive.
33# Note that variables are re-evaluated later, so the shell can output
34# a value like $(XYZZY) as part of !=. The $(XYZZY) will be EVALUATED
35# when the value containing it is evaluated. On the negative side, this
36# means if you don't want this, you need to escape dollar signs as $$.
37# On the positive side, it means that shell programs can output macros
38# that are then evaluated as they are traditionally evaluated.. and that
39# you can use traditional macro evaluation semantics to implement !=.
40
41run_make_test('
42XYZZY = fiddle-dee-dee
43dollar = $$
44VAR3 != printf \'%s\' \'$(dollar)(XYZZY)\'
45
46all: ; @echo "<$(VAR3)>"
47',
48 '', "<fiddle-dee-dee>\n");
49
50
51# TEST 3: Overrides invoke shell anyway; they just don't store the result
52# in a way that is visible.
53
54run_make_test('
55
56override != echo abc > ,abc ; cat ,abc
57
58all: ; @echo "<$(override)>" ; cat ,abc
59',
60 'override=xyz', "<xyz>\nabc\n");
61
62unlink(',abc');
63
64
651;
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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