From e11a51bbf76bddd439cca30f5cdb4eedfb0920d8 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Thu, 11 Apr 2024 19:08:38 +0200 Subject: [PATCH] Initial smoke tests. --- .../strict_asm_debug_attributes_merge/args | 1 + .../input.yul | 29 ++++++++ .../strict_asm_debug_attributes_merge/output | 66 +++++++++++++++++++ .../strict_asm_debug_attributes_patch/args | 1 + .../input.yul | 29 ++++++++ .../strict_asm_debug_attributes_patch/output | 66 +++++++++++++++++++ .../strict_asm_debug_attributes_set/args | 1 + .../strict_asm_debug_attributes_set/input.yul | 29 ++++++++ .../strict_asm_debug_attributes_set/output | 66 +++++++++++++++++++ 9 files changed, 288 insertions(+) create mode 100644 test/cmdlineTests/strict_asm_debug_attributes_merge/args create mode 100644 test/cmdlineTests/strict_asm_debug_attributes_merge/input.yul create mode 100644 test/cmdlineTests/strict_asm_debug_attributes_merge/output create mode 100644 test/cmdlineTests/strict_asm_debug_attributes_patch/args create mode 100644 test/cmdlineTests/strict_asm_debug_attributes_patch/input.yul create mode 100644 test/cmdlineTests/strict_asm_debug_attributes_patch/output create mode 100644 test/cmdlineTests/strict_asm_debug_attributes_set/args create mode 100644 test/cmdlineTests/strict_asm_debug_attributes_set/input.yul create mode 100644 test/cmdlineTests/strict_asm_debug_attributes_set/output diff --git a/test/cmdlineTests/strict_asm_debug_attributes_merge/args b/test/cmdlineTests/strict_asm_debug_attributes_merge/args new file mode 100644 index 000000000000..f45d50838ceb --- /dev/null +++ b/test/cmdlineTests/strict_asm_debug_attributes_merge/args @@ -0,0 +1 @@ +--strict-assembly --ir-optimized --asm \ No newline at end of file diff --git a/test/cmdlineTests/strict_asm_debug_attributes_merge/input.yul b/test/cmdlineTests/strict_asm_debug_attributes_merge/input.yul new file mode 100644 index 000000000000..2c57d1f62114 --- /dev/null +++ b/test/cmdlineTests/strict_asm_debug_attributes_merge/input.yul @@ -0,0 +1,29 @@ +object "object" { + code { + { + /// @debug.merge {"scope": 1} + let a + /// @debug.merge {"assignment": 1} + a := z() + /// @debug.merge {"assignment": null} + let b + /// @debug.merge {"assignment": 2} + b := z_1() + /// @debug.merge {"assignment": null} + sstore(a, b) + /// @debug.merge {"scope": null} + } + function z() -> y + { + /// @debug.merge {"scope": 2} + y := calldataload(0) + /// @debug.merge {"scope": null} + } + function z_1() -> y + { + /// @debug.merge {"scope": 3} + y := calldataload(0x20) + /// @debug.merge {"scope": null} + } + } +} diff --git a/test/cmdlineTests/strict_asm_debug_attributes_merge/output b/test/cmdlineTests/strict_asm_debug_attributes_merge/output new file mode 100644 index 000000000000..7b2d7ac2e07f --- /dev/null +++ b/test/cmdlineTests/strict_asm_debug_attributes_merge/output @@ -0,0 +1,66 @@ + +======= strict_asm_debug_attributes_merge/input.yul (EVM) ======= + +Pretty printed source: +object "object" { + code { + { + /// @debug.set {"scope":1} + let a + /// @debug.set {"assignment":1,"scope":1} + a := z() + /// @debug.set {"scope":1} + let b + /// @debug.set {"assignment":2,"scope":1} + b := z_1() + /// @debug.set {"scope":1} + sstore(a, b) + } + function z() -> y + { + /// @debug.set {"scope":2} + y := calldataload(0) + } + function z_1() -> y + { + /// @debug.set {"scope":3} + y := calldataload(0x20) + } + } +} + + +Text representation: + /* "strict_asm_debug_attributes_merge/input.yul":163:166 */ + tag_3 // @debug.set {"assignment":1,"scope":1} + tag_1 // @debug.set {"assignment":1,"scope":1} + jump // in // @debug.set {"assignment":1,"scope":1} +tag_3: // @debug.set {"assignment":1,"scope":1} + /* "strict_asm_debug_attributes_merge/input.yul":299:304 */ + tag_4 // @debug.set {"assignment":2,"scope":1} + tag_2 // @debug.set {"assignment":2,"scope":1} + jump // in // @debug.set {"assignment":2,"scope":1} +tag_4: // @debug.set {"assignment":2,"scope":1} + /* "strict_asm_debug_attributes_merge/input.yul":367:379 */ + swap1 // @debug.set {"scope":1} + sstore // @debug.set {"scope":1} + /* "strict_asm_debug_attributes_merge/input.yul":27:777 */ + stop + /* "strict_asm_debug_attributes_merge/input.yul":443:600 */ +tag_1: + /* "strict_asm_debug_attributes_merge/input.yul":543:544 */ + 0x00 // @debug.set {"scope":2} + /* "strict_asm_debug_attributes_merge/input.yul":530:545 */ + calldataload // @debug.set {"scope":2} + /* "strict_asm_debug_attributes_merge/input.yul":443:600 */ + swap1 + jump // out + /* "strict_asm_debug_attributes_merge/input.yul":609:771 */ +tag_2: + /* "strict_asm_debug_attributes_merge/input.yul":711:715 */ + 0x20 // @debug.set {"scope":3} + /* "strict_asm_debug_attributes_merge/input.yul":698:716 */ + calldataload // @debug.set {"scope":3} + /* "strict_asm_debug_attributes_merge/input.yul":609:771 */ + swap1 + jump // out diff --git a/test/cmdlineTests/strict_asm_debug_attributes_patch/args b/test/cmdlineTests/strict_asm_debug_attributes_patch/args new file mode 100644 index 000000000000..f45d50838ceb --- /dev/null +++ b/test/cmdlineTests/strict_asm_debug_attributes_patch/args @@ -0,0 +1 @@ +--strict-assembly --ir-optimized --asm \ No newline at end of file diff --git a/test/cmdlineTests/strict_asm_debug_attributes_patch/input.yul b/test/cmdlineTests/strict_asm_debug_attributes_patch/input.yul new file mode 100644 index 000000000000..f96a8d502b34 --- /dev/null +++ b/test/cmdlineTests/strict_asm_debug_attributes_patch/input.yul @@ -0,0 +1,29 @@ +object "object" { + code { + { + /// @debug.patch {"op": "add", "path": "/scope", "value": 1} + let a + /// @debug.patch {"op": "add", "path": "/assignment", "value": 1} + a := z() + /// @debug.patch {"op": "remove", "path": "/assignment"} + let b + /// @debug.patch {"op": "add", "path": "/assignment", "value": 2} + b := z_1() + /// @debug.patch {"op": "remove", "path": "/assignment"} + sstore(a, b) + /// @debug.patch {"op": "remove", "path": "/scope"} + } + function z() -> y + { + /// @debug.patch {"op": "add", "path": "/scope", "value": 2} + y := calldataload(0) + /// @debug.patch {"op": "remove", "path": "/scope"} + } + function z_1() -> y + { + /// @debug.patch {"op": "add", "path": "/scope", "value": 3} + y := calldataload(0x20) + /// @debug.patch {"op": "remove", "path": "/scope"} + } + } +} diff --git a/test/cmdlineTests/strict_asm_debug_attributes_patch/output b/test/cmdlineTests/strict_asm_debug_attributes_patch/output new file mode 100644 index 000000000000..770294ac60a5 --- /dev/null +++ b/test/cmdlineTests/strict_asm_debug_attributes_patch/output @@ -0,0 +1,66 @@ + +======= strict_asm_debug_attributes_patch/input.yul (EVM) ======= + +Pretty printed source: +object "object" { + code { + { + /// @debug.set {"scope":1} + let a + /// @debug.set {"assignment":1,"scope":1} + a := z() + /// @debug.set {"scope":1} + let b + /// @debug.set {"assignment":2,"scope":1} + b := z_1() + /// @debug.set {"scope":1} + sstore(a, b) + } + function z() -> y + { + /// @debug.set {"scope":2} + y := calldataload(0) + } + function z_1() -> y + { + /// @debug.set {"scope":3} + y := calldataload(0x20) + } + } +} + + +Text representation: + /* "strict_asm_debug_attributes_patch/input.yul":227:230 */ + tag_3 // @debug.set {"assignment":1,"scope":1} + tag_1 // @debug.set {"assignment":1,"scope":1} + jump // in // @debug.set {"assignment":1,"scope":1} +tag_3: // @debug.set {"assignment":1,"scope":1} + /* "strict_asm_debug_attributes_patch/input.yul":415:420 */ + tag_4 // @debug.set {"assignment":2,"scope":1} + tag_2 // @debug.set {"assignment":2,"scope":1} + jump // in // @debug.set {"assignment":2,"scope":1} +tag_4: // @debug.set {"assignment":2,"scope":1} + /* "strict_asm_debug_attributes_patch/input.yul":503:515 */ + swap1 // @debug.set {"scope":1} + sstore // @debug.set {"scope":1} + /* "strict_asm_debug_attributes_patch/input.yul":27:1037 */ + stop + /* "strict_asm_debug_attributes_patch/input.yul":599:808 */ +tag_1: + /* "strict_asm_debug_attributes_patch/input.yul":731:732 */ + 0x00 // @debug.set {"scope":2} + /* "strict_asm_debug_attributes_patch/input.yul":718:733 */ + calldataload // @debug.set {"scope":2} + /* "strict_asm_debug_attributes_patch/input.yul":599:808 */ + swap1 + jump // out + /* "strict_asm_debug_attributes_patch/input.yul":817:1031 */ +tag_2: + /* "strict_asm_debug_attributes_patch/input.yul":951:955 */ + 0x20 // @debug.set {"scope":3} + /* "strict_asm_debug_attributes_patch/input.yul":938:956 */ + calldataload // @debug.set {"scope":3} + /* "strict_asm_debug_attributes_patch/input.yul":817:1031 */ + swap1 + jump // out diff --git a/test/cmdlineTests/strict_asm_debug_attributes_set/args b/test/cmdlineTests/strict_asm_debug_attributes_set/args new file mode 100644 index 000000000000..f45d50838ceb --- /dev/null +++ b/test/cmdlineTests/strict_asm_debug_attributes_set/args @@ -0,0 +1 @@ +--strict-assembly --ir-optimized --asm \ No newline at end of file diff --git a/test/cmdlineTests/strict_asm_debug_attributes_set/input.yul b/test/cmdlineTests/strict_asm_debug_attributes_set/input.yul new file mode 100644 index 000000000000..08733a757ace --- /dev/null +++ b/test/cmdlineTests/strict_asm_debug_attributes_set/input.yul @@ -0,0 +1,29 @@ +object "object" { + code { + { + /// @debug.set {"scope": 1} + let a + /// @debug.set {"scope": 1, "assignment": 1} + a := z() + /// @debug.set {"scope": 1} + let b + /// @debug.set {"scope": 1, "assignment": 2} + b := z_1() + /// @debug.set {"scope": 1} + sstore(a, b) + /// @debug.set {} + } + function z() -> y + { + /// @debug.set {"scope": 2} + y := calldataload(0) + /// @debug.set {} + } + function z_1() -> y + { + /// @debug.set {"scope": 3} + y := calldataload(0x20) + /// @debug.set {} + } + } +} diff --git a/test/cmdlineTests/strict_asm_debug_attributes_set/output b/test/cmdlineTests/strict_asm_debug_attributes_set/output new file mode 100644 index 000000000000..988efa73543f --- /dev/null +++ b/test/cmdlineTests/strict_asm_debug_attributes_set/output @@ -0,0 +1,66 @@ + +======= strict_asm_debug_attributes_set/input.yul (EVM) ======= + +Pretty printed source: +object "object" { + code { + { + /// @debug.set {"scope":1} + let a + /// @debug.set {"assignment":1,"scope":1} + a := z() + /// @debug.set {"scope":1} + let b + /// @debug.set {"assignment":2,"scope":1} + b := z_1() + /// @debug.set {"scope":1} + sstore(a, b) + } + function z() -> y + { + /// @debug.set {"scope":2} + y := calldataload(0) + } + function z_1() -> y + { + /// @debug.set {"scope":3} + y := calldataload(0x20) + } + } +} + + +Text representation: + /* "strict_asm_debug_attributes_set/input.yul":171:174 */ + tag_3 // @debug.set {"assignment":1,"scope":1} + tag_1 // @debug.set {"assignment":1,"scope":1} + jump // in // @debug.set {"assignment":1,"scope":1} +tag_3: // @debug.set {"assignment":1,"scope":1} + /* "strict_asm_debug_attributes_set/input.yul":307:312 */ + tag_4 // @debug.set {"assignment":2,"scope":1} + tag_2 // @debug.set {"assignment":2,"scope":1} + jump // in // @debug.set {"assignment":2,"scope":1} +tag_4: // @debug.set {"assignment":2,"scope":1} + /* "strict_asm_debug_attributes_set/input.yul":365:377 */ + swap1 // @debug.set {"scope":1} + sstore // @debug.set {"scope":1} + /* "strict_asm_debug_attributes_set/input.yul":27:726 */ + stop + /* "strict_asm_debug_attributes_set/input.yul":426:566 */ +tag_1: + /* "strict_asm_debug_attributes_set/input.yul":524:525 */ + 0x00 // @debug.set {"scope":2} + /* "strict_asm_debug_attributes_set/input.yul":511:526 */ + calldataload // @debug.set {"scope":2} + /* "strict_asm_debug_attributes_set/input.yul":426:566 */ + swap1 + jump // out + /* "strict_asm_debug_attributes_set/input.yul":575:720 */ +tag_2: + /* "strict_asm_debug_attributes_set/input.yul":675:679 */ + 0x20 // @debug.set {"scope":3} + /* "strict_asm_debug_attributes_set/input.yul":662:680 */ + calldataload // @debug.set {"scope":3} + /* "strict_asm_debug_attributes_set/input.yul":575:720 */ + swap1 + jump // out