svm: modularize integration test runner #3183
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
the way the integration test runner is structured, the bank and batch processor are constructed, execute a test entry, run checks as defined by the entry, and then nothing is returned. this makes it difficult to do more bespoke things, like test inspected accounts or look into the final program cache, which we may not want to support in
SvmTestEntry
Summary of Changes
introduce
SvmTestEnvironment
and splitexecute_test_entry
intocreate
andexecute
. update mock bank state after a batch finishes executing. this allows more complex tests to test things on the test environment after execution, and even to run multiple batches with the same environmentnote that, despite the large diff, no code actually changed with the test runner (the first commit) other than the addition of this at the end of
execute
:otherwise the functions
create
andexecute
inSvmTestEnvironment
are line-for-line identical with the previousexecute_test_entry
the second commit rewrites the
svm_inspect_account
test to use this new pattern and should be reviewed more closely, although no functionality has changed other than using the actual system program instead of the bpf transfer program, which added nothing to the test. the new pattern means thatsvm_inspect_account
now validates transaction execution status and all final account states implicitly, in addition to the explicit inspected accounts checks