Skip to content

Commit

Permalink
More CLI tests for output selection in Standard JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
cameel committed Sep 23, 2024
1 parent 1ba4349 commit 05d24cd
Show file tree
Hide file tree
Showing 14 changed files with 542 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"": {"content": "contract D {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"},
"*": {"content": "contract D {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"},
"C": {"content": "contract D {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"}
},
"settings": {
"outputSelection": {
"": {"D": ["userdoc"]}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"contracts": {
"": {
"D": {
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}
}
},
"sources": {
"": {
"id": 0
},
"*": {
"id": 1
},
"C": {
"id": 2
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"": {"content": "contract D {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"},
"*": {"content": "contract D {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"},
"C": {"content": "contract D {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"}
},
"settings": {
"outputSelection": {
"*": {"D": ["userdoc"]}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"contracts": {
"": {
"D": {
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}
},
"*": {
"D": {
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}
},
"C": {
"D": {
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
}
}
}
},
"sources": {
"": {
"id": 0
},
"*": {
"id": 1
},
"C": {
"id": 2
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"language": "Solidity",
"sources": {
"*": {"content": "contract A {}\ncontract B {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"},
"C": {"content": "contract A {}\ncontract B {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"},
"D": {"content": "contract A {}\ncontract B {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"}
},
"settings": {
"outputSelection": {
// Outputs from duplicate keys are not combined. Last value wins.
"*": {
"*": ["userdoc"], // Ignored
"*": ["devdoc"] // Ignored
},
"C": {
"*": ["storageLayout"], // Ignored
"*": ["transientStorageLayout"] // Ignored
},
"C": {
"A": ["evm.bytecode.linkReferences"], // Ignored
"A": ["evm.bytecode.object"]
},
"*": {
"A": ["evm.deployedBytecode.immutableReferences"], // Ignored
"A": ["abi"]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"contracts": {
"*": {
"A": {
"abi": []
}
},
"C": {
"A": {
"abi": [],
"evm": {
"bytecode": {
"object": "<BYTECODE REMOVED>"
}
}
}
},
"D": {
"A": {
"abi": []
}
}
},
"sources": {
"*": {
"id": 0
},
"C": {
"id": 1
},
"D": {
"id": 2
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"language": "Solidity",
"sources": {
"": {"content": "contract A {}\ncontract B {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"},
"*": {"content": "contract A {}\ncontract B {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"},
"C": {"content": "contract A {}\ncontract B {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"},
"D": {"content": "contract A {}\ncontract B {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"}
},
"settings": {
"outputSelection": {
// FIXME: Behavior of "" is inconsistent. Sometimes it matches everything, sometimes only empty name.
"": {
"": ["metadata"], // No matches
"*": ["transientStorageLayout"], // All sources, all contracts
"A": ["abi"] // source "", contract A
},
"*": {
"": ["evm.deployedBytecode.immutableReferences"], // No matches
"*": ["evm.bytecode.object"], // All sources, all contracts
"A": ["evm.bytecode.linkReferences"] // All sources, contract A
},
"C": {
"": ["userdoc"], // No matches
"*": ["devdoc"], // All contracts in source "C"
"A": ["storageLayout"] // source "C", contract A
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"contracts": {
"": {
"A": {
"abi": [],
"evm": {
"bytecode": {
"linkReferences": {},
"object": "<BYTECODE REMOVED>"
}
},
"transientStorageLayout": {
"storage": [],
"types": null
}
},
"B": {
"evm": {
"bytecode": {
"object": "<BYTECODE REMOVED>"
}
},
"transientStorageLayout": {
"storage": [],
"types": null
}
}
},
"*": {
"A": {
"evm": {
"bytecode": {
"linkReferences": {},
"object": "<BYTECODE REMOVED>"
}
}
},
"B": {
"evm": {
"bytecode": {
"object": "<BYTECODE REMOVED>"
}
}
}
},
"C": {
"A": {
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"bytecode": {
"linkReferences": {},
"object": "<BYTECODE REMOVED>"
}
},
"storageLayout": {
"storage": [],
"types": null
}
},
"B": {
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"evm": {
"bytecode": {
"object": "<BYTECODE REMOVED>"
}
}
}
},
"D": {
"A": {
"evm": {
"bytecode": {
"linkReferences": {},
"object": "<BYTECODE REMOVED>"
}
}
},
"B": {
"evm": {
"bytecode": {
"object": "<BYTECODE REMOVED>"
}
}
}
}
},
"sources": {
"": {
"id": 0
},
"*": {
"id": 1
},
"C": {
"id": 2
},
"D": {
"id": 3
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"language": "Solidity",
"sources": {
"C": {"content": "contract A {}\ncontract B {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"},
"D": {"content": "contract A {}\ncontract B {}\n//SPDX-License-Identifier: GPL-3.0\npragma solidity *;"}
},
"settings": {
"optimizer": {"enabled": true},
"debug": {"debugInfo": []},
"outputSelection": {
// This test uses outputs that require all stages of the pipeline to run, possibly via
// multiple paths, to make sure the later stages handle more complex output selection correctly.
// Currently there are only distinct paths (IR, optimized IR and bytecode generation).
"*": {
"*": ["evm.bytecode.object"],
"A": ["irOptimized"]
},
"C": {
"A": ["ir"]
}
}
}
}
Loading

0 comments on commit 05d24cd

Please sign in to comment.