aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

Fix #12958: tests being run from library code when aptos-move/move-examples are run with `MOVE_COMPILER_V2=true cargo test`.

Open brmataptos opened this issue 9 months ago • 2 comments

Description

Fixes #12958.

Change compiler-v2 sources and dependencies from Vec<String> filenames to Vec<PackagePaths> full package descriptors. This attaches a package name to input files, allowing a filter to limit unit tests to the current package. Since these are bigger structures, we pass & instead of object.

There is some messiness due to PackagePaths really being a generic type with default instantiation using move_symbol_pool::Symbol which isn't common in the move-model code.

Also, it turns out that disassembler uses script module names whose name mangling has changed, so there is a change to move-cli/src/base/disassemble.rs, along with a more verbose error (listing the available functions) in the case of a failure to find the requested module, which was useful debugging and was left in.

Since related code was touched in EVM-related code in third_party/move/tools/move-unit-test/src/test_runner.rs I fixed it to compile but there is still an issue with the named_address_map which I haven't debugged. (See Issue #13119.)

Key Areas to Review

This can be refactored later, so keep that in mind. It's still a bit messy, but if you can understand what's going on (after reading the description above) it may be easier to wait until we separate compilers to do some of the remaining cleanup.

Type of Change

  • [ ] New feature
  • [x] Bug fix
  • [ ] Breaking change
  • [ ] Performance improvement
  • [ ] Refactoring
  • [ ] Dependency update
  • [ ] Documentation update
  • [x] Tests

Which Components or Systems Does This Change Impact?

  • [ ] Validator Node
  • [ ] Full Node (API, Indexer, etc.)
  • [x] Move/Aptos Virtual Machine
  • [ ] Aptos Framework
  • [ ] Aptos CLI/SDK
  • [ ] Developer Infrastructure
  • [ ] Other (specify)

How Has This Been Tested?

Cargo test run with various options (MOVE_COMPILER_V2=true and not).

Checklist

  • [x] I have read and followed the CONTRIBUTING doc
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I identified and added all stakeholders and component owners affected by this change as reviewers
  • [x] I tested both happy and unhappy path of the functionality
  • [ ] I have made corresponding changes to the documentation

brmataptos avatar Apr 29 '24 23:04 brmataptos

⏱️ 4h 36m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-move-unit-coverage 1h 32m 🟩🟩🟩🟩
rust-targeted-unit-tests 1h 11m 🟥🟥🟩🟩
rust-move-tests 50m 🟩🟩🟩🟩🟩
rust-lints 22m 🟥🟥🟥🟥🟩
run-tests-main-branch 21m 🟩🟩🟩🟩🟩
general-lints 9m 🟩🟩🟩🟩🟩
check-dynamic-deps 6m 🟩🟩🟩🟩🟩
semgrep/ci 2m 🟩🟩🟩🟩🟩
file_change_determinator 53s 🟩🟩🟩🟩🟩
file_change_determinator 52s 🟩🟩🟩🟩🟩
permission-check 15s 🟩🟩🟩🟩🟩
permission-check 14s 🟩🟩🟩🟩🟩
permission-check 14s 🟩🟩🟩🟩🟩
permission-check 10s 🟩🟩🟩🟩🟩

🚨 1 job on the last run was significantly faster/slower than expected

Job Duration vs 7d avg Delta
rust-targeted-unit-tests 23m 16m +40%

settingsfeedbackdocs ⋅ learn more about trunk.io

trunk-io[bot] avatar Apr 29 '24 23:04 trunk-io[bot]

Codecov Report

Attention: Patch coverage is 64.39394% with 94 lines in your changes are missing coverage. Please review.

Project coverage is 57.5%. Comparing base (270917f) to head (5600ccc).

:exclamation: Current head 5600ccc differs from pull request most recent head ec83051

Please upload reports for the commit ec83051 to get more accurate results.

Files Patch % Lines
..._party/move/tools/move-cli/src/base/disassemble.rs 6.2% 30 Missing :warning:
...s/move-package/src/compilation/compiled_package.rs 36.9% 29 Missing :warning:
...ools/move-package/src/compilation/model_builder.rs 18.1% 9 Missing :warning:
...rd_party/move/move-compiler-v2/src/plan_builder.rs 0.0% 8 Missing :warning:
third_party/move/move-model/src/model.rs 30.0% 7 Missing :warning:
third_party/move/evm/move-to-yul/src/lib.rs 0.0% 6 Missing :warning:
third_party/move/move-compiler-v2/src/lib.rs 37.5% 5 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #13125       +/-   ##
===========================================
+ Coverage    33.1%    57.5%    +24.3%     
===========================================
  Files        1753      832      -921     
  Lines      337763   198003   -139760     
===========================================
+ Hits       111995   113923     +1928     
+ Misses     225768    84080   -141688     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 30 '24 00:04 codecov[bot]