From a0d22422b03f3a19f3a0326c6f4becd73802953c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 4 Nov 2020 19:25:51 +0100 Subject: [PATCH] Command-line tests for linking in Solidity mode --- test/cmdlineTests/linking_solidity/args | 1 + test/cmdlineTests/linking_solidity/input.sol | 12 ++++++ test/cmdlineTests/linking_solidity/output | 12 ++++++ .../args | 1 + .../input.sol | 20 +++++++++ .../output | 24 +++++++++++ .../linking_standard_solidity/input.json | 33 +++++++++++++++ .../linking_standard_solidity/output.json | 1 + .../input.json | 33 +++++++++++++++ .../output.json | 1 + .../input.json | 41 +++++++++++++++++++ .../output.json | 1 + 12 files changed, 180 insertions(+) create mode 100644 test/cmdlineTests/linking_solidity/args create mode 100644 test/cmdlineTests/linking_solidity/input.sol create mode 100644 test/cmdlineTests/linking_solidity/output create mode 100644 test/cmdlineTests/linking_solidity_unresolved_references/args create mode 100644 test/cmdlineTests/linking_solidity_unresolved_references/input.sol create mode 100644 test/cmdlineTests/linking_solidity_unresolved_references/output create mode 100644 test/cmdlineTests/linking_standard_solidity/input.json create mode 100644 test/cmdlineTests/linking_standard_solidity/output.json create mode 100644 test/cmdlineTests/linking_standard_solidity_quote_in_file_name/input.json create mode 100644 test/cmdlineTests/linking_standard_solidity_quote_in_file_name/output.json create mode 100644 test/cmdlineTests/linking_standard_solidity_unresolved_references/input.json create mode 100644 test/cmdlineTests/linking_standard_solidity_unresolved_references/output.json diff --git a/test/cmdlineTests/linking_solidity/args b/test/cmdlineTests/linking_solidity/args new file mode 100644 index 000000000..0b04ebd47 --- /dev/null +++ b/test/cmdlineTests/linking_solidity/args @@ -0,0 +1 @@ +--bin --bin-runtime --libraries linking_solidity/input.sol:L:0x1234567890123456789012345678901234567890 diff --git a/test/cmdlineTests/linking_solidity/input.sol b/test/cmdlineTests/linking_solidity/input.sol new file mode 100644 index 000000000..eb06631bb --- /dev/null +++ b/test/cmdlineTests/linking_solidity/input.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; + +library L { + function f() external {} +} + +contract C { + function foo() public { + L.f(); + } +} diff --git a/test/cmdlineTests/linking_solidity/output b/test/cmdlineTests/linking_solidity/output new file mode 100644 index 000000000..307b131b5 --- /dev/null +++ b/test/cmdlineTests/linking_solidity/output @@ -0,0 +1,12 @@ + +======= linking_solidity/input.sol:C ======= +Binary: + +Binary of the runtime part: + + +======= linking_solidity/input.sol:L ======= +Binary: + +Binary of the runtime part: + diff --git a/test/cmdlineTests/linking_solidity_unresolved_references/args b/test/cmdlineTests/linking_solidity_unresolved_references/args new file mode 100644 index 000000000..a08ce1cb4 --- /dev/null +++ b/test/cmdlineTests/linking_solidity_unresolved_references/args @@ -0,0 +1 @@ +--bin --bin-runtime --libraries linking_solidity_unresolved_references/input.sol:L1:0x1234567890123456789012345678901234567890 diff --git a/test/cmdlineTests/linking_solidity_unresolved_references/input.sol b/test/cmdlineTests/linking_solidity_unresolved_references/input.sol new file mode 100644 index 000000000..2a5f67305 --- /dev/null +++ b/test/cmdlineTests/linking_solidity_unresolved_references/input.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; + +library L1 { + function f() external {} +} + +library L2 { + function f() external {} +} + +contract C { + function foo() public { + L1.f(); + L2.f(); + L1.f(); + L2.f(); + L1.f(); + } +} diff --git a/test/cmdlineTests/linking_solidity_unresolved_references/output b/test/cmdlineTests/linking_solidity_unresolved_references/output new file mode 100644 index 000000000..f42191f51 --- /dev/null +++ b/test/cmdlineTests/linking_solidity_unresolved_references/output @@ -0,0 +1,24 @@ + +======= linking_solidity_unresolved_references/input.sol:C ======= +Binary: +__$8ef13d1c56d5343bf69cf9444272079aa5$____$8ef13d1c56d5343bf69cf9444272079aa5$__ + +// $8ef13d1c56d5343bf69cf9444272079aa5$ -> linking_solidity_unresolved_references/input.sol:L2 +// $8ef13d1c56d5343bf69cf9444272079aa5$ -> linking_solidity_unresolved_references/input.sol:L2 +Binary of the runtime part: +__$8ef13d1c56d5343bf69cf9444272079aa5$____$8ef13d1c56d5343bf69cf9444272079aa5$__ + +// $8ef13d1c56d5343bf69cf9444272079aa5$ -> linking_solidity_unresolved_references/input.sol:L2 +// $8ef13d1c56d5343bf69cf9444272079aa5$ -> linking_solidity_unresolved_references/input.sol:L2 + +======= linking_solidity_unresolved_references/input.sol:L1 ======= +Binary: + +Binary of the runtime part: + + +======= linking_solidity_unresolved_references/input.sol:L2 ======= +Binary: + +Binary of the runtime part: + diff --git a/test/cmdlineTests/linking_standard_solidity/input.json b/test/cmdlineTests/linking_standard_solidity/input.json new file mode 100644 index 000000000..b70481304 --- /dev/null +++ b/test/cmdlineTests/linking_standard_solidity/input.json @@ -0,0 +1,33 @@ +{ + "language": "Solidity", + "sources": { + "A": { + "content": " + // SPDX-License-Identifier: GPL-3.0 + pragma solidity >=0.0; + + library L { + function f() external {} + } + + contract C { + function foo() public { + L.f(); + } + } + " + } + }, + "settings": { + "libraries": { + "contract/test.sol": { + "L": "0x1234567890123456789012345678901234567890" + } + }, + "outputSelection": { + "*": { + "C": ["evm.bytecode.object", "evm.bytecode.linkReferences"] + } + } + } +} diff --git a/test/cmdlineTests/linking_standard_solidity/output.json b/test/cmdlineTests/linking_standard_solidity/output.json new file mode 100644 index 000000000..1cfa37405 --- /dev/null +++ b/test/cmdlineTests/linking_standard_solidity/output.json @@ -0,0 +1 @@ +{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""}}}}},"sources":{"A":{"id":0}}} diff --git a/test/cmdlineTests/linking_standard_solidity_quote_in_file_name/input.json b/test/cmdlineTests/linking_standard_solidity_quote_in_file_name/input.json new file mode 100644 index 000000000..fc54cdabc --- /dev/null +++ b/test/cmdlineTests/linking_standard_solidity_quote_in_file_name/input.json @@ -0,0 +1,33 @@ +{ + "language": "Solidity", + "sources": { + "A": { + "content": " + // SPDX-License-Identifier: GPL-3.0 + pragma solidity >=0.0; + + library L { + function f() external {} + } + + contract C { + function foo() public { + L.f(); + } + } + " + } + }, + "settings": { + "libraries": { + "contract/test\"test.sol": { + "L": "0x1234567890123456789012345678901234567890" + } + }, + "outputSelection": { + "*": { + "C": ["evm.bytecode.object", "evm.bytecode.linkReferences"] + } + } + } +} diff --git a/test/cmdlineTests/linking_standard_solidity_quote_in_file_name/output.json b/test/cmdlineTests/linking_standard_solidity_quote_in_file_name/output.json new file mode 100644 index 000000000..1cfa37405 --- /dev/null +++ b/test/cmdlineTests/linking_standard_solidity_quote_in_file_name/output.json @@ -0,0 +1 @@ +{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""}}}}},"sources":{"A":{"id":0}}} diff --git a/test/cmdlineTests/linking_standard_solidity_unresolved_references/input.json b/test/cmdlineTests/linking_standard_solidity_unresolved_references/input.json new file mode 100644 index 000000000..597e7f96e --- /dev/null +++ b/test/cmdlineTests/linking_standard_solidity_unresolved_references/input.json @@ -0,0 +1,41 @@ +{ + "language": "Solidity", + "sources": { + "A": { + "content": " + // SPDX-License-Identifier: GPL-3.0 + pragma solidity >=0.0; + + library L1 { + function f() external {} + } + + library L2 { + function f() external {} + } + + contract C { + function foo() public { + L1.f(); + L2.f(); + L1.f(); + L2.f(); + L1.f(); + } + } + " + } + }, + "settings": { + "libraries": { + "contract/test.sol": { + "L1": "0x1234567890123456789012345678901234567890" + } + }, + "outputSelection": { + "*": { + "C": ["evm.bytecode.object", "evm.bytecode.linkReferences"] + } + } + } +} diff --git a/test/cmdlineTests/linking_standard_solidity_unresolved_references/output.json b/test/cmdlineTests/linking_standard_solidity_unresolved_references/output.json new file mode 100644 index 000000000..620ca820e --- /dev/null +++ b/test/cmdlineTests/linking_standard_solidity_unresolved_references/output.json @@ -0,0 +1 @@ +{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{"A":{"L2":[{"length":20,"start":184},{"length":20,"start":368}]}},"object":"__$622b2f540b6a16ff5db7bea656ad8fcf4f$____$622b2f540b6a16ff5db7bea656ad8fcf4f$__","opcodes":"","sourceMap":""}}}}},"sources":{"A":{"id":0}}}