-
Notifications
You must be signed in to change notification settings - Fork 2
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
Cleanup - test_interpreter_and_jit!()
macros
#13
Conversation
2a85b2b
to
3665510
Compare
@@ -3535,46 +3535,6 @@ fn test_invalid_call_imm() { | |||
); | |||
} | |||
|
|||
#[test] | |||
#[should_panic(expected = "Invalid syscall should have been detected in the verifier.")] | |||
fn test_invalid_exit_or_return() { |
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.
The idea of this test was to ensure correct behavior if execution reaches an invalid sys call not detected in the verifier.
If you think that will never happen, we can simply live without this test.
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.
Yes, I moved it to the verifier tests as these are execution only tests. And things which are supposed to fail verification have no defined execution behavior.
@@ -3501,40 +3501,6 @@ fn test_total_chaos() { | |||
} | |||
} | |||
|
|||
#[test] | |||
fn test_invalid_call_imm() { |
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.
This test was here to make sure one previous bug I introduced in the codebase doesn't exist anymore. The bug was dispatching syscalls with call imm
.
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 added test_call_imm_does_not_dispatch_syscalls()
test_utils/src/lib.rs
Outdated
if !$override_budget { | ||
const INSTRUCTION_METER_BUDGET: u64 = 1024; | ||
context_object.remaining = INSTRUCTION_METER_BUDGET; | ||
} |
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.
override_budget == true will NOT override the budget.
override_budget == false WILL override the budget.
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.
Ah yes, we should invert the flag and its use sites.
3665510
to
0fe538f
Compare
tests/verifier.rs
Outdated
@@ -374,10 +374,27 @@ fn test_verifier_err_unknown_opcode() { | |||
} | |||
|
|||
#[test] | |||
#[should_panic(expected = "InvalidFunction(1811268607)")] | |||
#[should_panic(expected = "UnknownOpCode(6, 0)")] |
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.
Are we testing the invalid exit? Shouldn't we be throwing an error for 0x95?
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.
test_verifier_err_invalid_return
appears to have the same issue.
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.
You are right, will rewrite these two tests.
tests/verifier.rs
Outdated
#[should_panic(expected = "InvalidFunction(3)")] | ||
fn test_verifier_unknown_sycall() { | ||
let prog = &[ | ||
0x85, 0x00, 0x00, 0x00, 0xfe, 0xc3, 0xf5, 0x6b, // call 0x6bf5c3fe | ||
0x85, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // call_imm 2 |
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.
0x85 is not a sys call in V3.
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.
True, also fixed.
0fe538f
to
fc1e828
Compare
tests/verifier.rs
Outdated
fn test_verifier_unknown_sycall() { | ||
let prog = &[ | ||
0x85, 0x00, 0x00, 0x00, 0xfe, 0xc3, 0xf5, 0x6b, // call 0x6bf5c3fe | ||
0x95, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // call_imm 2 |
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.
0x95, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // call_imm 2 | |
0x95, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // syscall 2 |
…terpreter_and_jit_elf and test_syscall_asm into test_utils crate.
… with and without override_budget.
fc1e828
to
f5e5e30
Compare
No description provided.