Skip to content

Commit

Permalink
Initial smoke tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
aarlt committed May 8, 2024
1 parent 43b06c8 commit e11a51b
Show file tree
Hide file tree
Showing 9 changed files with 288 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/cmdlineTests/strict_asm_debug_attributes_merge/args
@@ -0,0 +1 @@
--strict-assembly --ir-optimized --asm
29 changes: 29 additions & 0 deletions 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}
}
}
}
66 changes: 66 additions & 0 deletions 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
1 change: 1 addition & 0 deletions test/cmdlineTests/strict_asm_debug_attributes_patch/args
@@ -0,0 +1 @@
--strict-assembly --ir-optimized --asm
29 changes: 29 additions & 0 deletions 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"}
}
}
}
66 changes: 66 additions & 0 deletions 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
1 change: 1 addition & 0 deletions test/cmdlineTests/strict_asm_debug_attributes_set/args
@@ -0,0 +1 @@
--strict-assembly --ir-optimized --asm
29 changes: 29 additions & 0 deletions 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 {}
}
}
}
66 changes: 66 additions & 0 deletions 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

0 comments on commit e11a51b

Please sign in to comment.