diff --git a/crates/aptos/src/move_tool/coverage.rs b/crates/aptos/src/move_tool/coverage.rs index 9fc99d3876eaf0..86ffdf5bc9c321 100644 --- a/crates/aptos/src/move_tool/coverage.rs +++ b/crates/aptos/src/move_tool/coverage.rs @@ -1,7 +1,10 @@ // Copyright © Aptos Foundation // SPDX-License-Identifier: Apache-2.0 -use crate::common::types::{CliCommand, CliError, CliResult, CliTypedResult, MovePackageDir}; +use crate::{ + common::types::{CliCommand, CliError, CliResult, CliTypedResult, MovePackageDir}, + move_tool::{experiments_from_opt_level, fix_bytecode_version}, +}; use aptos_framework::extended_checks; use async_trait::async_trait; use clap::{Parser, Subcommand}; @@ -162,14 +165,23 @@ fn compile_coverage( dev_mode: move_options.dev, additional_named_addresses: move_options.named_addresses(), test_mode: false, + full_model_generation: move_options.check_test_code, install_dir: move_options.output_dir.clone(), + skip_fetch_latest_git_deps: move_options.skip_fetch_latest_git_deps, compiler_config: CompilerConfig { known_attributes: extended_checks::get_all_attribute_names().clone(), skip_attribute_checks: false, - ..Default::default() + bytecode_version: fix_bytecode_version( + move_options.bytecode_version, + move_options.language_version, + ), + compiler_version: move_options.compiler_version, + language_version: move_options.language_version, + experiments: experiments_from_opt_level(&move_options.optimize), }, ..Default::default() }; + let path = move_options.get_package_path()?; let coverage_map = CoverageMap::from_binary_file(path.join(".coverage_map.mvcov")).map_err(|err| { diff --git a/crates/aptos/src/move_tool/mod.rs b/crates/aptos/src/move_tool/mod.rs index 648b8a33016304..61cc6e82b535e0 100644 --- a/crates/aptos/src/move_tool/mod.rs +++ b/crates/aptos/src/move_tool/mod.rs @@ -506,7 +506,7 @@ pub struct TestPackage { pub dump_state: bool, } -fn fix_bytecode_version( +pub(crate) fn fix_bytecode_version( bytecode_version_in: Option, language_version: Option, ) -> Option { @@ -814,7 +814,7 @@ impl FromStr for IncludedArtifacts { } } -fn experiments_from_opt_level(optlevel: &Option) -> Vec { +pub(crate) fn experiments_from_opt_level(optlevel: &Option) -> Vec { match optlevel { None | Some(OptimizationLevel::Default) => { vec![format!("{}=on", Experiment::OPTIMIZE.to_string())]