Skip to content
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

cannon: Add MTCannon-specific differential tests #11605

Merged
merged 30 commits into from
Aug 29, 2024

Conversation

mbaxter
Copy link
Contributor

@mbaxter mbaxter commented Aug 26, 2024

Description

Add tests to cover new functionality in MTCannon: test new syscalls and thread traversal.

Other changes include:

  • Some fixes:
    • Fix FutexWait - don't set thread.FutexAddr when the syscall fails
    • Remove duplicate sycall constants
  • Update clone fuzz test for MTCannon
  • Add ExpectedMTState utility for validating full state of MTCannon
  • Reorganize some test utils:
    • Move randomization logic into single- and multithreaded testutil packages
    • Break up some testutils across multiple files
  • Organize syscall constants more consistently across on- and off-chain implementations

Metadata

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 30 lines in your changes missing coverage. Please review.

Project coverage is 84.83%. Comparing base (e9bc4ef) to head (c154483).
Report is 22 commits behind head on develop.

Files with missing lines Patch % Lines
cannon/mipsevm/multithreaded/testutil/mutators.go 67.44% 14 Missing ⚠️
cannon/mipsevm/testutil/rand.go 64.51% 9 Missing and 2 partials ⚠️
cannon/mipsevm/multithreaded/testutil/state.go 75.00% 2 Missing and 1 partial ⚠️
cannon/mipsevm/multithreaded/mips.go 75.00% 1 Missing ⚠️
cannon/mipsevm/multithreaded/testutil/thread.go 99.15% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #11605      +/-   ##
===========================================
+ Coverage    80.81%   84.83%   +4.02%     
===========================================
  Files           32       36       +4     
  Lines         2466     2777     +311     
===========================================
+ Hits          1993     2356     +363     
+ Misses         396      352      -44     
+ Partials        77       69       -8     
Flag Coverage Δ
cannon-go-tests 84.83% <92.30%> (+4.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cannon/mipsevm/exec/mips_syscalls.go 93.66% <ø> (ø)
cannon/mipsevm/multithreaded/state.go 93.12% <100.00%> (ø)
...non/mipsevm/multithreaded/testutil/expectations.go 100.00% <100.00%> (ø)
cannon/mipsevm/singlethreaded/testutil/state.go 65.00% <100.00%> (-19.62%) ⬇️
cannon/mipsevm/testutil/mips.go 85.82% <100.00%> (+3.64%) ⬆️
cannon/mipsevm/testutil/state.go 73.25% <100.00%> (+1.12%) ⬆️
cannon/mipsevm/multithreaded/mips.go 96.21% <75.00%> (+24.74%) ⬆️
cannon/mipsevm/multithreaded/testutil/thread.go 99.15% <99.15%> (ø)
cannon/mipsevm/multithreaded/testutil/state.go 75.00% <75.00%> (-10.72%) ⬇️
cannon/mipsevm/testutil/rand.go 64.51% <64.51%> (ø)
... and 1 more

... and 3 files with indirect coverage changes

@mbaxter mbaxter requested a review from Inphi August 27, 2024 20:10
@mbaxter mbaxter marked this pull request as ready for review August 27, 2024 20:10
@mbaxter mbaxter requested review from a team as code owners August 27, 2024 20:10
Copy link
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and thorough!

@mbaxter mbaxter added this pull request to the merge queue Aug 29, 2024
Merged via the queue into ethereum-optimism:develop with commit e53a86a Aug 29, 2024
58 checks passed
@mbaxter mbaxter deleted the cp-977/add-mt-tests branch August 29, 2024 14:53
samlaf pushed a commit to samlaf/optimism that referenced this pull request Nov 10, 2024
…1605)

* cannon: Implement multithreaded clone fuzz test

* cannon: Add more clone evm tests

* cannon: Add evm test for GetTID syscall

* cannon: Add evm test for SysExit

* cannon: Add evm test for popping exited threads from the stack

* cannon: Fix futex wait handling, add evm test

* cannon: Add evm test for handling waiting thread

* cannon: Add test utils for defining / validating MTState expectations

* cannon: Add tests for futex wake, wake traversal

* cannon: Add test for SysYield

* cannon: Add SysOpen test, todos

* cannon: Add test for SchedQuantum preemption, fix inconsistency

* cannon: Add tests for noop, unsupported syscalls

* cannon: Remove duplicate constants

* cannon: Add tests for unsupported futex ops

* cannon: Group traversal tests, fix TestEVM_WakeupTraversalStep

* cannon: Add tests for nanosleep

* cannon: Add additional testcase for wakeup traversal

* cannon: Tweak futex wake tests

* cannon: Update mt fuzz test to use new test utils

* cannon: Rename contructor method for consistency

* cannon: Add some simple tests for ExpectedMTState util

* cannon: Add another validation test

* cannon: Move syscall lists to tests where they're used

* cannon: Add comment

* cannon: Extract some evm test helpers

* cannon: Cleanup - use require.Equalf for formatting

* cannon: Rename test util to AssertEVMReverts

* cannon: Add GetThreadStacks helper

* cannon: Add a few more traversal tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants