Skip to content

svm: modularize integration test runner#3183

Merged
2501babe merged 2 commits intoanza-xyz:masterfrom
2501babe:20241015_svminteg_imprv2
Oct 18, 2024
Merged

svm: modularize integration test runner#3183
2501babe merged 2 commits intoanza-xyz:masterfrom
2501babe:20241015_svminteg_imprv2

Conversation

@2501babe
Copy link
Copy Markdown
Member

@2501babe 2501babe commented Oct 15, 2024

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 split execute_test_entry into create and execute. 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 environment

note 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:

        let mut mock_bank_accounts = self.mock_bank.account_shared_data.write().unwrap();
        *mock_bank_accounts = final_accounts_actual;

otherwise the functions create and execute in SvmTestEnvironment are line-for-line identical with the previous execute_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 that svm_inspect_account now validates transaction execution status and all final account states implicitly, in addition to the explicit inspected accounts checks

@2501babe 2501babe force-pushed the 20241015_svminteg_imprv2 branch from dfdd145 to bba6cc5 Compare October 15, 2024 18:51
@2501babe 2501babe self-assigned this Oct 15, 2024
@2501babe 2501babe force-pushed the 20241015_svminteg_imprv2 branch from bba6cc5 to 3770b43 Compare October 17, 2024 21:06
@2501babe 2501babe marked this pull request as ready for review October 17, 2024 23:07
@2501babe 2501babe requested a review from brooksprumo October 17, 2024 23:08
@2501babe 2501babe force-pushed the 20241015_svminteg_imprv2 branch from 3770b43 to c8d7b5a Compare October 17, 2024 23:14
Copy link
Copy Markdown

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

:shipit:

The refactor/modularization looks correct to me. Thanks!

@2501babe 2501babe merged commit 98b7826 into anza-xyz:master Oct 18, 2024
@2501babe 2501babe deleted the 20241015_svminteg_imprv2 branch October 18, 2024 15:33
ray-kast pushed a commit to abklabs/agave that referenced this pull request Nov 27, 2024
* modularize test execution
* rewrite svm inspect test with new runner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants