-
Notifications
You must be signed in to change notification settings - Fork 4
refactor(tests): distinguish -fail from -unsupported, auto-detect show specs #1015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
4d2b75a
784d826
c940597
63bead9
91fa4f3
98c68be
580ebe3
5d69415
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,6 +182,9 @@ def cargo_get_smir_json( | |
| cwd = cwd or Path.cwd() | ||
| smir_json_result = cwd / rs_file.with_suffix('.smir.json').name | ||
| run_process_2(command, cwd=cwd) | ||
| resolved_smir_json_result = cwd / rs_file.resolve().with_suffix('.smir.json').name | ||
| if not smir_json_result.is_file() and resolved_smir_json_result.is_file(): | ||
| resolved_smir_json_result.rename(smir_json_result) | ||
|
Comment on lines
183
to
+187
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't understand the point of this until I queried claude. It might be nice to mention that this is addressing symlinks. |
||
| json_smir = json.loads(smir_json_result.read_text()) | ||
| _LOGGER.info(f'Loaded: {smir_json_result}') | ||
| if save_smir: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,20 +31,26 @@ def _normalize_symbol_hashes(text: str) -> str: | |
| return text | ||
|
|
||
|
|
||
| def _normalize_show_output(text: str) -> str: | ||
| text = _normalize_symbol_hashes(text) | ||
| text = re.sub(r'(?m)^(\s*(?:[│┃┊]\s*)?span: )\d+$', r'\1<span>', text) | ||
| text = re.sub(r'(?m)^\s*>> message: .*\n?', '', text) | ||
| return text.rstrip('\r\n') | ||
|
Comment on lines
+34
to
+38
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason we want to remove the decoded message? If we have a different match with a fail that errors with a message and a span, would it not be helpful to have that information? Is having the information creating a problem? I am always deeply suspicious of claude using regex covering things up. At the very least this should be adequately documented to explain what it is doing. |
||
|
|
||
|
|
||
| def assert_or_update_show_output( | ||
| actual_text: str, expected_file: Path, *, update: bool, path_replacements: dict[str, str] | None = None | ||
| ) -> None: | ||
| if path_replacements: | ||
| for old, new in path_replacements.items(): | ||
| actual_text = actual_text.replace(old, new) | ||
| # Normalize rustc symbol hash suffixes that can drift across builds/environments. | ||
| actual_text = _normalize_symbol_hashes(actual_text) | ||
| actual_text = _normalize_show_output(actual_text) | ||
| if update: | ||
| expected_file.write_text(actual_text) | ||
| else: | ||
| assert expected_file.is_file() | ||
| expected_text = expected_file.read_text() | ||
| expected_text = _normalize_symbol_hashes(expected_text) | ||
| expected_text = _normalize_show_output(expected_text) | ||
| if actual_text != expected_text: | ||
| diff = '\n'.join( | ||
| unified_diff( | ||
|
|
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
|
|
||
| ┌─ 1 (root, init) | ||
| │ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC | ||
| │ span: 0 | ||
| │ | ||
| │ (10 steps) | ||
| ├─ 3 | ||
| │ #decodeConstant ( constantKindAllocated ( allocation ( ... bytes: b"\x00\x00\x00 | ||
| │ function: main | ||
| │ span: 118 | ||
| │ | ||
| │ (1 step) | ||
| └─ 4 (leaf, terminal) | ||
| thunk ( #decodeConstant ( constantKindAllocated ( allocation ( ... bytes: b"\x00 | ||
| function: main | ||
| span: 118 | ||
|
|
||
|
|
||
| ┌─ 2 (root, leaf, target, terminal) | ||
| │ #EndProgram ~> .K | ||
|
|
||
|
|
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
|
|
||
| ┌─ 1 (root, init) | ||
| │ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC | ||
| │ span: 0 | ||
| │ | ||
| │ (1450 steps) | ||
| └─ 3 (stuck, leaf) | ||
| #setUpCalleeData ( monoItemFn ( ... name: symbol ( "_ZN4core9panicking5panic17h<hash> | ||
| span: 32 | ||
|
|
||
|
|
||
| ┌─ 2 (root, leaf, target, terminal) | ||
| │ #EndProgram ~> .K | ||
|
|
||
|
|
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,13 @@ | ||
|
|
||
| ┌─ 1 (root, init) | ||
| │ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC | ||
| │ span: 0 | ||
| │ span: <span> | ||
| │ | ||
| │ (35 steps) | ||
| └─ 3 (stuck, leaf) | ||
| #traverseProjection ( toAlloc ( allocId ( 0 ) ) , StringVal ( "123" ) , .Project | ||
| span: 48 | ||
| span: <span> | ||
|
|
||
|
|
||
| ┌─ 2 (root, leaf, target, terminal) | ||
| │ #EndProgram ~> .K | ||
|
|
||
|
|
||
| │ #EndProgram ~> .K |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
|
|
||
| ┌─ 1 (root, init) | ||
| │ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC | ||
| │ span: src/rust/library/std/src/rt.rs:194 | ||
| │ | ||
| │ (61 steps) | ||
| ├─ 3 (split) | ||
| │ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 2 ) ) | ||
| │ function: eats_struct_args | ||
| ┃ | ||
| ┃ (branch) | ||
| ┣━━┓ subst: .Subst | ||
| ┃ ┃ constraint: | ||
| ┃ ┃ notBool ARG_INT2:Int ==Int ARG_INT5:Int | ||
| ┃ │ | ||
| ┃ ├─ 4 | ||
| ┃ │ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 2 ) ) | ||
| ┃ │ function: eats_struct_args | ||
| ┃ │ | ||
| ┃ │ (96 steps) | ||
| ┃ ├─ 6 (split) | ||
| ┃ │ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 5 ) ) | ||
| ┃ │ function: eats_struct_args | ||
| ┃ ┃ | ||
| ┃ ┃ (branch) | ||
| ┃ ┣━━┓ subst: .Subst | ||
| ┃ ┃ ┃ constraint: | ||
| ┃ ┃ ┃ ARG_UINT3:Int ==Int ARG_UINT6:Int | ||
| ┃ ┃ │ | ||
| ┃ ┃ ├─ 8 | ||
| ┃ ┃ │ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 5 ) ) | ||
| ┃ ┃ │ function: eats_struct_args | ||
| ┃ ┃ │ | ||
| ┃ ┃ │ (6 steps) | ||
| ┃ ┃ └─ 10 (stuck, leaf) | ||
| ┃ ┃ #setUpCalleeData ( monoItemFn ( ... name: symbol ( "_ZN4core9panicking5panic17h<hash> | ||
| ┃ ┃ span: no-location:0 | ||
| ┃ ┃ | ||
| ┃ ┗━━┓ subst: .Subst | ||
| ┃ ┃ constraint: | ||
| ┃ ┃ notBool ARG_UINT3:Int ==Int ARG_UINT6:Int | ||
| ┃ │ | ||
| ┃ ├─ 9 | ||
| ┃ │ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 5 ) ) | ||
| ┃ │ function: eats_struct_args | ||
| ┃ │ | ||
| ┃ │ (6 steps) | ||
| ┃ ├─ 11 (terminal) | ||
| ┃ │ #EndProgram ~> .K | ||
| ┃ │ function: eats_struct_args | ||
| ┃ │ | ||
| ┃ ┊ constraint: true | ||
| ┃ ┊ subst: ... | ||
| ┃ └─ 2 (leaf, target, terminal) | ||
| ┃ #EndProgram ~> .K | ||
| ┃ | ||
| ┗━━┓ subst: .Subst | ||
| ┃ constraint: | ||
| ┃ ARG_INT2:Int ==Int ARG_INT5:Int | ||
| │ | ||
| ├─ 5 | ||
| │ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 2 ) ) | ||
| │ function: eats_struct_args | ||
| │ | ||
| │ (66 steps) | ||
| ├─ 7 (terminal) | ||
| │ #EndProgram ~> .K | ||
| │ function: eats_struct_args | ||
| │ | ||
| ┊ constraint: true | ||
| ┊ subst: ... | ||
| └─ 2 (leaf, target, terminal) | ||
| #EndProgram ~> .K | ||
|
|
||
|
|
||
|
|
||
|
|
||
| STATISTICS | ||
| ----------- | ||
| Total nodes: 10 | ||
|
|
||
| Node roles (exclusive): | ||
| target : 1 ids: 2 | ||
| terminal: 2 ids: 7, 11 | ||
| failing : 1 ids: 10 | ||
| split : 2 ids: 3, 6 | ||
| normal : 4 ids: 4, 5, 8, 9 | ||
| (root nodes omitted from totals: 1) | ||
|
|
||
| Leaf paths from init: | ||
| total leaves (non-root): 2 | ||
| reachable leaves : 2 | ||
| total steps : 290 | ||
|
|
||
| leaf 2 (path 1/2): steps 127, path 1 -> 3 -> 5 -> 7 -> 2 | ||
| leaf 2 (path 2/2): steps 163, path 1 -> 3 -> 4 -> 6 -> 9 -> 11 -> 2 | ||
| leaf 10: steps 163, path 1 -> 3 -> 4 -> 6 -> 8 -> 10 | ||
|
|
||
| LEAF <k> CELLS | ||
| --------------- | ||
| Node 2: | ||
| #EndProgram ~> .K | ||
|
|
||
| Node 10: | ||
| #setUpCalleeData ( monoItemFn ( ... name: symbol ( "_ZN4core9panicking5panic17h<hash>E" ) , id: defId ( 27 ) , body: noBody ) , operandConstant ( constOperand ( ... span: span ( 32 ) , userTy: noUserTypeAnnotationIndex , const: mirConst ( ... kind: constantKindAllocated ( allocation ( ... bytes: b"\x00\x00\x00\x00\x00\x00\x00\x008\x00\x00\x00\x00\x00\x00\x00" , provenance: provenanceMap ( ... ptrs: provenanceMapEntry ( ... offset: 0 , allocId: allocId ( 0 ) ) .ProvenanceMapEntries ) , align: align ( 8 ) , mutability: mutabilityMut ) ) , ty: ty ( 28 ) , id: mirConstId ( 12 ) ) ) ) .Operands , span ( 65 ) ) ~> .K | ||
| >> function: core::panicking::panic::h<hash> | ||
| >> call span: <REPO>/kmir/src/tests/integration/data/prove-rs/symbolic-structs-fail.rs:29:5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a redundant change since #1069 improved performance, although I haven't seen a repeat on runner 10:
Not necessarily requesting a change just noting that it should be less than 60 consistently now.