diff options
| author | Volker Weißmann <volker.weissmann@gmx.de> | 2025-03-24 18:23:56 +0100 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-05-29 09:20:27 -0700 |
| commit | cab5c8e2b73fc6084ead0f6bf61a649e0c4be1f5 (patch) | |
| tree | e093fcdab64ebe07b05a422e774486f2cc404462 /test cases/rewrite/1 basic | |
| parent | f042e82e6a5c18f7863cd14bf717d3d021f0c0d7 (diff) | |
| download | meson-cab5c8e2b73fc6084ead0f6bf61a649e0c4be1f5.tar.gz | |
rewriter: Rewrite how we add/remove source files
Change the semantics of IntrospectionBuildTarget.source_nodes
and IntrospectionBuildTarget.extra_files .
The rewriter and the static introspection tool used to be very broken,
now it is *less* broken, hence we add some tests in this commit.
Fixes #11763
Diffstat (limited to 'test cases/rewrite/1 basic')
| -rw-r--r-- | test cases/rewrite/1 basic/addSrc.json | 38 | ||||
| -rw-r--r-- | test cases/rewrite/1 basic/addTgt.json | 2 | ||||
| -rw-r--r-- | test cases/rewrite/1 basic/expected_dag.txt | 160 | ||||
| -rw-r--r-- | test cases/rewrite/1 basic/info.json | 20 | ||||
| -rw-r--r-- | test cases/rewrite/1 basic/meson.build | 16 | ||||
| -rw-r--r-- | test cases/rewrite/1 basic/rmSrc.json | 40 | ||||
| -rw-r--r-- | test cases/rewrite/1 basic/rmTgt.json | 5 |
7 files changed, 215 insertions, 66 deletions
diff --git a/test cases/rewrite/1 basic/addSrc.json b/test cases/rewrite/1 basic/addSrc.json index b8bc43916..52603f60b 100644 --- a/test cases/rewrite/1 basic/addSrc.json +++ b/test cases/rewrite/1 basic/addSrc.json @@ -43,6 +43,24 @@ }, { "type": "target", + "target": "trivialprog10", + "operation": "src_add", + "sources": ["fileA.cpp", "fileB.cpp", "a1.cpp"] + }, + { + "type": "target", + "target": "trivialprog11", + "operation": "src_add", + "sources": ["fileA.cpp", "a1.cpp"] + }, + { + "type": "target", + "target": "trivialprog12", + "operation": "src_add", + "sources": ["fileA.cpp", "fileB.cpp", "a1.cpp"] + }, + { + "type": "target", "target": "trivialprog0", "operation": "info" }, @@ -90,5 +108,25 @@ "type": "target", "target": "trivialprog9", "operation": "info" + }, + { + "type": "target", + "target": "trivialprog10", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog11", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog12", + "operation": "info" + }, + { + "type": "target", + "target": "rightName", + "operation": "info" } ] diff --git a/test cases/rewrite/1 basic/addTgt.json b/test cases/rewrite/1 basic/addTgt.json index 2f4e7e256..02d600a82 100644 --- a/test cases/rewrite/1 basic/addTgt.json +++ b/test cases/rewrite/1 basic/addTgt.json @@ -1,7 +1,7 @@ [ { "type": "target", - "target": "trivialprog10", + "target": "trivialprog13", "operation": "target_add", "sources": ["new1.cpp", "new2.cpp"], "target_type": "shared_library" diff --git a/test cases/rewrite/1 basic/expected_dag.txt b/test cases/rewrite/1 basic/expected_dag.txt index abc04fc31..c5025b4ad 100644 --- a/test cases/rewrite/1 basic/expected_dag.txt +++ b/test cases/rewrite/1 basic/expected_dag.txt @@ -15,69 +15,115 @@ Data flowing to ArrayNode(6:7): IdNode(6:8) Data flowing to IdNode(6:8): IdNode(5:7) +Data flowing to ArithmeticNode(7:7): + ArrayNode(7:7) + ArrayNode(8:8) +Data flowing to ArrayNode(7:7): + StringNode(7:8) + StringNode(7:20) +Data flowing to ArrayNode(8:8): + StringNode(8:9) +Data flowing to ArrayNode(9:7): + StringNode(9:8) + StringNode(9:20) Data flowing to FunctionNode(10:7): - StringNode(10:18) - ArithmeticNode(10:34) -Data flowing to ArithmeticNode(10:34): - IdNode(10:34) - IdNode(10:41) -Data flowing to IdNode(10:34): + IdNode(10:13) +Data flowing to IdNode(10:13): + ArrayNode(9:7) +Data flowing to ArrayNode(11:7): + StringNode(11:8) + StringNode(11:20) +Data flowing to IdNode(12:7): + ArrayNode(11:7) +Data flowing to ArrayNode(13:7): + StringNode(13:8) + StringNode(13:21) +Data flowing to FunctionNode(15:13): + StringNode(14:7) + StringNode(15:26) +Data flowing to FunctionNode(20:7): + StringNode(20:18) + ArithmeticNode(20:34) +Data flowing to ArithmeticNode(20:34): + IdNode(20:34) + IdNode(20:41) +Data flowing to IdNode(20:34): ArrayNode(3:7) -Data flowing to IdNode(10:41): +Data flowing to IdNode(20:41): FunctionNode(4:7) -Data flowing to FunctionNode(11:7): - StringNode(11:18) - IdNode(11:34) -Data flowing to IdNode(11:34): +Data flowing to FunctionNode(21:7): + StringNode(21:18) + IdNode(21:34) +Data flowing to IdNode(21:34): ArrayNode(3:7) -Data flowing to FunctionNode(12:7): - StringNode(12:18) - ArrayNode(12:34) -Data flowing to ArrayNode(12:34): - IdNode(12:35) -Data flowing to IdNode(12:35): +Data flowing to FunctionNode(22:7): + StringNode(22:18) + ArrayNode(22:34) +Data flowing to ArrayNode(22:34): + IdNode(22:35) +Data flowing to IdNode(22:35): FunctionNode(4:7) -Data flowing to FunctionNode(13:7): - StringNode(13:18) - ArrayNode(13:34) -Data flowing to ArrayNode(13:34): - StringNode(13:35) - StringNode(13:47) -Data flowing to FunctionNode(14:7): - StringNode(14:18) - ArrayNode(14:34) -Data flowing to ArrayNode(14:34): - StringNode(14:35) - ArrayNode(14:47) -Data flowing to ArrayNode(14:47): - StringNode(14:48) -Data flowing to FunctionNode(15:7): - StringNode(15:18) - ArrayNode(15:34) -Data flowing to ArrayNode(15:34): - IdNode(15:35) - StringNode(15:41) -Data flowing to IdNode(15:35): +Data flowing to FunctionNode(23:7): + StringNode(23:18) + ArrayNode(23:34) +Data flowing to ArrayNode(23:34): + StringNode(23:35) + StringNode(23:47) +Data flowing to FunctionNode(24:7): + StringNode(24:18) + ArrayNode(24:34) +Data flowing to ArrayNode(24:34): + StringNode(24:35) + ArrayNode(24:47) +Data flowing to ArrayNode(24:47): + StringNode(24:48) +Data flowing to FunctionNode(25:7): + StringNode(25:18) + ArrayNode(25:34) +Data flowing to ArrayNode(25:34): + IdNode(25:35) + StringNode(25:41) +Data flowing to IdNode(25:35): FunctionNode(4:7) -Data flowing to FunctionNode(16:7): - StringNode(16:18) - StringNode(16:34) - StringNode(16:46) -Data flowing to FunctionNode(17:7): - StringNode(17:18) - StringNode(17:34) - IdNode(17:47) - StringNode(17:53) -Data flowing to IdNode(17:47): +Data flowing to FunctionNode(26:7): + StringNode(26:18) + StringNode(26:34) + StringNode(26:46) +Data flowing to FunctionNode(27:7): + StringNode(27:18) + StringNode(27:34) + FunctionNode(27:47) + StringNode(27:69) +Data flowing to FunctionNode(27:47): ArrayNode(3:7) -Data flowing to FunctionNode(18:7): - StringNode(18:18) - IdNode(18:34) -Data flowing to IdNode(18:34): + StringNode(27:60) +Data flowing to FunctionNode(28:7): + StringNode(28:18) + IdNode(28:34) +Data flowing to IdNode(28:34): IdNode(5:7) -Data flowing to FunctionNode(19:0): - StringNode(19:11) - IdNode(19:27) -Data flowing to IdNode(19:27): +Data flowing to FunctionNode(29:0): + StringNode(29:11) + IdNode(29:27) +Data flowing to IdNode(29:27): ArrayNode(6:7) - +Data flowing to FunctionNode(30:0): + StringNode(30:11) + IdNode(30:28) +Data flowing to IdNode(30:28): + ArithmeticNode(7:7) +Data flowing to FunctionNode(31:0): + StringNode(31:11) + IdNode(31:28) +Data flowing to IdNode(31:28): + FunctionNode(10:7) +Data flowing to FunctionNode(32:0): + StringNode(32:11) + IdNode(32:28) +Data flowing to IdNode(32:28): + IdNode(12:7) +Data flowing to FunctionNode(33:0): + IdNode(33:11) + StringNode(33:23) +Data flowing to IdNode(33:11): + FunctionNode(15:13) diff --git a/test cases/rewrite/1 basic/info.json b/test cases/rewrite/1 basic/info.json index 0f1a3bd8c..9977f5a87 100644 --- a/test cases/rewrite/1 basic/info.json +++ b/test cases/rewrite/1 basic/info.json @@ -53,5 +53,25 @@ "type": "target", "target": "trivialprog10", "operation": "info" + }, + { + "type": "target", + "target": "trivialprog11", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog12", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog13", + "operation": "info" + }, + { + "type": "target", + "target": "rightName", + "operation": "info" } ] diff --git a/test cases/rewrite/1 basic/meson.build b/test cases/rewrite/1 basic/meson.build index 0f87c4520..5fe952769 100644 --- a/test cases/rewrite/1 basic/meson.build +++ b/test cases/rewrite/1 basic/meson.build @@ -4,6 +4,16 @@ src1 = ['main.cpp', 'fileA.cpp'] src2 = files(['fileB.cpp', 'fileC.cpp']) src3 = src1 src4 = [src3] +src5 = ['main.cpp', 'fileA.cpp'] +src5 += ['fileB.cpp'] +src6 = ['main.cpp', 'fileA.cpp'] +src6 = files(src6) +src7 = ['main.cpp', 'fileA.cpp'] +src8 = src7 +src7 = ['fileB.cpp', 'fileC.cpp'] +name = 'rightName' +trickyName = get_variable('name') +name = 'wrongName' # Magic comment @@ -14,6 +24,10 @@ exe3 = executable('trivialprog3', ['main.cpp', 'fileA.cpp']) exe4 = executable('trivialprog4', ['main.cpp', ['fileA.cpp']]) exe5 = executable('trivialprog5', [src2, 'main.cpp']) exe6 = executable('trivialprog6', 'main.cpp', 'fileA.cpp') -exe7 = executable('trivialprog7', 'fileB.cpp', src1, 'fileC.cpp') +exe7 = executable('trivialprog7', 'fileB.cpp', get_variable('src1'), 'fileC.cpp') exe8 = executable('trivialprog8', src3) executable('trivialprog9', src4) +executable('trivialprog10', src5) +executable('trivialprog11', src6) +executable('trivialprog12', src8) +executable(trickyName, 'main.cpp') diff --git a/test cases/rewrite/1 basic/rmSrc.json b/test cases/rewrite/1 basic/rmSrc.json index 2e7447c68..de56bbe1b 100644 --- a/test cases/rewrite/1 basic/rmSrc.json +++ b/test cases/rewrite/1 basic/rmSrc.json @@ -1,12 +1,6 @@ [ { "type": "target", - "target": "trivialprog1", - "operation": "src_rm", - "sources": ["fileA.cpp"] - }, - { - "type": "target", "target": "trivialprog3", "operation": "src_rm", "sources": ["fileA.cpp"] @@ -21,7 +15,7 @@ "type": "target", "target": "trivialprog5", "operation": "src_rm", - "sources": ["fileB.cpp"] + "sources": ["main.cpp"] }, { "type": "target", @@ -37,6 +31,18 @@ }, { "type": "target", + "target": "trivialprog10", + "operation": "src_rm", + "sources": ["fileA.cpp", "fileB.cpp"] + }, + { + "type": "target", + "target": "trivialprog11", + "operation": "src_rm", + "sources": ["fileA.cpp"] + }, + { + "type": "target", "target": "trivialprog0", "operation": "info" }, @@ -84,5 +90,25 @@ "type": "target", "target": "trivialprog9", "operation": "info" + }, + { + "type": "target", + "target": "trivialprog10", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog11", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog12", + "operation": "info" + }, + { + "type": "target", + "target": "rightName", + "operation": "info" } ] diff --git a/test cases/rewrite/1 basic/rmTgt.json b/test cases/rewrite/1 basic/rmTgt.json index dbaf02535..bc6dc302e 100644 --- a/test cases/rewrite/1 basic/rmTgt.json +++ b/test cases/rewrite/1 basic/rmTgt.json @@ -13,5 +13,10 @@ "type": "target", "target": "trivialprog9", "operation": "target_rm" + }, + { + "type": "target", + "target": "rightName", + "operation": "target_rm" } ] |
