-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Move] Allow Bytecode Dependencies for Unit Testing #15252
Conversation
⏱️ 1h 12m total CI duration on this PR
|
43cb926
to
62d1fa2
Compare
|
||
[dependencies] | ||
Dep = { local = "../dep" } | ||
MoveStdlib = { local = "../../../../../../../aptos-move/framework/move-stdlib" } |
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.
Better not to make third_party
to depend on aptos-move
. Note that you don't know whether framework/move-stdlib
has been compiled at this point or not because there may or may not be an earlier build of framework/move_stdlib
or not. Can you create a smaller local test library to third_party
to use here?
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.
For a simple test like this that doesn't depend on any real Move logic, I think we can manage to not use the stdlib at all.
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.
LGTM except for some minor things
On a side note: presumably the reason why you added a .gitkeep
file is that the package/unit-test system would have trouble handling the package if the sources
directory does not exist. To me that's another thing we should fix, but let's do it in a separate PR.
println!("source_files: {:?}", source_files); | ||
println!("deps: {:?}", deps); |
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.
Do we want to display these to the users?
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.
done
#[test] | ||
fn one_bytecode_dep() { | ||
run_tests_for_pkg("tests/packages/one-bytecode-dep", true); | ||
run_tests_for_pkg("tests/packages/one-bytecode-dep", false); | ||
} |
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.
For now this is fine, but in the future we'll probably want to replace this with a test harness that automatically discovers all Move packages under a package directory and runs unit tests for them.
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.
Left a todo
|
||
[dependencies] | ||
Dep = { local = "../dep" } | ||
MoveStdlib = { local = "../../../../../../../aptos-move/framework/move-stdlib" } |
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.
For a simple test like this that doesn't depend on any real Move logic, I think we can manage to not use the stdlib at all.
@@ -187,7 +189,7 @@ impl UnitTestingConfig { | |||
let (units, warnings) = | |||
diagnostics::unwrap_or_report_diagnostics(&files, compilation_result); | |||
diagnostics::report_warnings(&files, warnings); | |||
test_plan.map(|tests| TestPlan::new(tests, files, units)) | |||
test_plan.map(|tests| TestPlan::new(tests, files, units, Default::default())) |
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.
Nit: might be clearer to explicitly use empty vector instead of Default::default()
here.
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.
done
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.
Assuming all previous comments are handled.
b07c641
to
1e3e7e8
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
Description
This PR allows Move unit tests to have bytecode dependencies by including bytecode modules in the
module_info
field ofTestPlan
.How Has This Been Tested?
third_party/move/tools/move-unit-test/tests/pkg_tests.rs
and manually tested withaptos move test
.Type of Change
Which Components or Systems Does This Change Impact?