From 89ff734ccb0cba71a7ae887ca60a4b48db72fc13 Mon Sep 17 00:00:00 2001 From: Wolfgang Grieskamp Date: Mon, 2 Oct 2023 09:56:17 -0700 Subject: [PATCH] [move unit tests] Run extended checker as part of unit tests (#10309) * [move unit tests] Run extended checker as part of unit tests Closes #9251 This runs the extended checker as part of Aptos unit tests (either our own Rust integrated tests or from the CLI). It uses the same technique as we already used for native extensions specific to Aptos: a hook is defined where additional, move-model based validations can be run. This is hook is then connected to the extended checker when running Aptos tests. The implementation also optimizes the construction of the move model: if that one is already needed by abi generation (which is the default), it is not constructed a 2nd time for the extended checker -- both for the existing build step and the new test step. This should avoid one full additional compilation (source -> bytecode -> model run). * Extended checks until now excluded test code, leading to wrong usage of entry functions and attributes marked as test-only. Because fixing this is a breaking change, this commit adds the behavior to check test code via a new CLI option `--check-test-code`. This flag should eventually become default behavior. Also fixes some reviewer comments. --- Cargo.lock | 1 + aptos-move/framework/Cargo.toml | 1 + aptos-move/framework/src/aptos.rs | 1 + aptos-move/framework/src/built_package.rs | 24 +++---- aptos-move/framework/src/extended_checks.rs | 9 +++ aptos-move/framework/tests/move_unit_test.rs | 1 + .../move-examples/tests/move_unit_tests.rs | 1 + crates/aptos/src/common/types.rs | 7 ++ crates/aptos/src/governance/mod.rs | 1 + .../src/move_tool/aptos_debug_natives.rs | 2 + crates/aptos/src/move_tool/mod.rs | 40 ++++------- crates/aptos/src/move_tool/show.rs | 1 + crates/aptos/src/test/mod.rs | 1 + .../move/move-compiler/src/shared/mod.rs | 13 ++++ third_party/move/move-model/src/ast.rs | 12 ++++ third_party/move/move-model/src/model.rs | 68 ++++++++++++++++++- third_party/move/move-model/src/well_known.rs | 15 +++- .../move-prover/move-docgen/src/docgen.rs | 11 ++- third_party/move/tools/move-cli/Cargo.toml | 1 + .../move/tools/move-cli/src/base/mod.rs | 1 + .../move/tools/move-cli/src/base/test.rs | 24 ++++++- .../move-cli/src/base/test_validation.rs | 53 +++++++++++++++ .../src/compilation/build_plan.rs | 10 +-- .../src/compilation/compiled_package.rs | 31 +++++++-- .../move/tools/move-package/src/lib.rs | 14 +++- .../compilation/basic_no_deps/Move.exp | 2 + .../basic_no_deps_address_assigned/Move.exp | 2 + .../Move.exp | 2 + .../basic_no_deps_test_mode/Move.exp | 2 + .../Move.exp | 2 + .../diamond_problem_no_conflict/Move.exp | 2 + .../compilation/multiple_deps_rename/Move.exp | 2 + .../multiple_deps_rename_one/Move.exp | 2 + .../test_sources/compilation/one_dep/Move.exp | 2 + .../one_dep_assigned_address/Move.exp | 2 + .../compilation/one_dep_renamed/Move.exp | 2 + .../compilation/one_dep_with_scripts/Move.exp | 2 + .../compilation/test_symlinks/Move.exp | 2 + .../invalid_identifier_package_name/Move.exp | 2 + .../parsing/minimal_manifest/Move.exp | 2 + .../resolution/basic_no_deps/Move.exp | 2 + .../basic_no_deps_address_assigned/Move.exp | 2 + .../Move.exp | 2 + .../resolution/dep_good_digest/Move.exp | 2 + .../Move.exp | 2 + .../diamond_problem_no_conflict/Move.exp | 2 + .../resolution/multiple_deps_rename/Move.exp | 2 + .../test_sources/resolution/one_dep/Move.exp | 2 + .../one_dep_assigned_address/Move.exp | 2 + .../one_dep_multiple_of_same_name/Move.exp | 2 + .../one_dep_reassigned_address/Move.exp | 2 + .../Move.exp | 2 + 52 files changed, 336 insertions(+), 61 deletions(-) create mode 100644 third_party/move/tools/move-cli/src/base/test_validation.rs diff --git a/Cargo.lock b/Cargo.lock index 8fa6368e44a904..f9262582e21d2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9068,6 +9068,7 @@ dependencies = [ "move-docgen", "move-errmapgen", "move-ir-types", + "move-model", "move-package", "move-prover", "move-resource-viewer", diff --git a/aptos-move/framework/Cargo.toml b/aptos-move/framework/Cargo.toml index f4abe6f0d7f1c9..6f3cf5b8e48bd4 100644 --- a/aptos-move/framework/Cargo.toml +++ b/aptos-move/framework/Cargo.toml @@ -53,6 +53,7 @@ log = { workspace = true } lru = { workspace = true } merlin = { workspace = true } move-binary-format = { workspace = true } +move-cli = { workspace = true } move-command-line-common = { workspace = true } move-compiler = { workspace = true } move-core-types = { workspace = true } diff --git a/aptos-move/framework/src/aptos.rs b/aptos-move/framework/src/aptos.rs index 48712df6263b2a..a78b0e7bbda4f0 100644 --- a/aptos-move/framework/src/aptos.rs +++ b/aptos-move/framework/src/aptos.rs @@ -121,6 +121,7 @@ impl ReleaseTarget { bytecode_version: None, compiler_version: None, skip_attribute_checks: false, + check_test_code: false, known_attributes: extended_checks::get_all_attribute_names().clone(), }, packages: packages.iter().map(|(path, _)| path.to_owned()).collect(), diff --git a/aptos-move/framework/src/built_package.rs b/aptos-move/framework/src/built_package.rs index c0d703aab2e961..e34704bfd62b75 100644 --- a/aptos-move/framework/src/built_package.rs +++ b/aptos-move/framework/src/built_package.rs @@ -72,6 +72,8 @@ pub struct BuildOptions { pub compiler_version: Option, #[clap(long)] pub skip_attribute_checks: bool, + #[clap(long)] + pub check_test_code: bool, #[clap(skip)] pub known_attributes: BTreeSet, } @@ -96,6 +98,7 @@ impl Default for BuildOptions { bytecode_version: None, compiler_version: None, skip_attribute_checks: false, + check_test_code: false, known_attributes: extended_checks::get_all_attribute_names().clone(), } } @@ -125,6 +128,8 @@ pub fn build_model( architecture: None, generate_abis: false, generate_docs: false, + generate_move_model: false, + full_model_generation: false, install_dir: None, test_mode: false, force_recompilation: false, @@ -158,6 +163,8 @@ impl BuiltPackage { architecture: None, generate_abis: options.with_abis, generate_docs: false, + generate_move_model: true, + full_model_generation: options.check_test_code, install_dir: options.install_dir.clone(), test_mode: false, force_recompilation: false, @@ -172,20 +179,11 @@ impl BuiltPackage { }; eprintln!("Compiling, may take a little while to download git dependencies..."); - let mut package = build_config.compile_package_no_exit(&package_path, &mut stderr())?; + let (mut package, model_opt) = + build_config.compile_package_no_exit(&package_path, &mut stderr())?; - // Build the Move model for extra processing and run extended checks as well derive - // runtime metadata - let model = &build_model( - options.dev, - package_path.as_path(), - options.named_addresses.clone(), - None, - bytecode_version, - compiler_version, - skip_attribute_checks, - options.known_attributes.clone(), - )?; + // Run extended checks as well derive runtime metadata + let model = &model_opt.expect("move model"); let runtime_metadata = extended_checks::run_extended_checks(model); if model.diag_count(Severity::Warning) > 0 { let mut error_writer = StandardStream::stderr(ColorChoice::Auto); diff --git a/aptos-move/framework/src/extended_checks.rs b/aptos-move/framework/src/extended_checks.rs index 7478f117db8d79..94029238d5d3e6 100644 --- a/aptos-move/framework/src/extended_checks.rs +++ b/aptos-move/framework/src/extended_checks.rs @@ -3,6 +3,7 @@ use crate::{KnownAttribute, RuntimeModuleMetadataV1}; use move_binary_format::file_format::{Ability, AbilitySet, Visibility}; +use move_cli::base::test_validation; use move_compiler::shared::known_attributes; use move_core_types::{ account_address::AccountAddress, @@ -77,6 +78,14 @@ pub fn run_extended_checks(env: &GlobalEnv) -> BTreeMap { env: &'a GlobalEnv, diff --git a/aptos-move/framework/tests/move_unit_test.rs b/aptos-move/framework/tests/move_unit_test.rs index 9d578f29d6638f..c7fea3fbd27adf 100644 --- a/aptos-move/framework/tests/move_unit_test.rs +++ b/aptos-move/framework/tests/move_unit_test.rs @@ -41,6 +41,7 @@ fn run_tests_for_pkg(path_to_pkg: impl Into) { pub fn aptos_test_natives() -> NativeFunctionTable { // By side effect, configure for unit tests natives::configure_for_unit_test(); + extended_checks::configure_extended_checks_for_unit_test(); // move_stdlib has the testing feature enabled to include debug native functions natives::aptos_natives( LATEST_GAS_FEATURE_VERSION, diff --git a/aptos-move/move-examples/tests/move_unit_tests.rs b/aptos-move/move-examples/tests/move_unit_tests.rs index d74e144d4f7ff1..91f93a415e0210 100644 --- a/aptos-move/move-examples/tests/move_unit_tests.rs +++ b/aptos-move/move-examples/tests/move_unit_tests.rs @@ -56,6 +56,7 @@ pub fn run_tests_for_pkg( pub fn aptos_test_natives() -> NativeFunctionTable { natives::configure_for_unit_test(); + extended_checks::configure_extended_checks_for_unit_test(); natives::aptos_natives( LATEST_GAS_FEATURE_VERSION, NativeGasParameters::zeros(), diff --git a/crates/aptos/src/common/types.rs b/crates/aptos/src/common/types.rs index 48b674da449ffb..208cd61b99773a 100644 --- a/crates/aptos/src/common/types.rs +++ b/crates/aptos/src/common/types.rs @@ -1125,6 +1125,12 @@ pub struct MovePackageDir { /// Do not complain about unknown attributes in Move code. #[clap(long)] pub skip_attribute_checks: bool, + + /// Do apply extended checks for Aptos (e.g. `#[view]` attribute) also on test code. + /// NOTE: this behavior will become the default in the future. + /// See https://github.com/aptos-labs/aptos-core/issues/10335 + #[clap(long, env = "APTOS_CHECK_TEST_CODE")] + pub check_test_code: bool, } impl MovePackageDir { @@ -1138,6 +1144,7 @@ impl MovePackageDir { bytecode_version: None, compiler_version: None, skip_attribute_checks: false, + check_test_code: false, } } diff --git a/crates/aptos/src/governance/mod.rs b/crates/aptos/src/governance/mod.rs index aa55ad9316448c..a781f12dbee320 100644 --- a/crates/aptos/src/governance/mod.rs +++ b/crates/aptos/src/governance/mod.rs @@ -998,6 +998,7 @@ impl CliCommand<()> for GenerateUpgradeProposal { move_options.bytecode_version, move_options.compiler_version, move_options.skip_attribute_checks, + move_options.check_test_code, ); let package = BuiltPackage::build(package_path, options)?; let release = ReleasePackage::new(package)?; diff --git a/crates/aptos/src/move_tool/aptos_debug_natives.rs b/crates/aptos/src/move_tool/aptos_debug_natives.rs index 5efb5601d826d7..926f1c48826caa 100644 --- a/crates/aptos/src/move_tool/aptos_debug_natives.rs +++ b/crates/aptos/src/move_tool/aptos_debug_natives.rs @@ -1,6 +1,7 @@ // Copyright © Aptos Foundation // SPDX-License-Identifier: Apache-2.0 +use aptos_framework::extended_checks; use aptos_gas_schedule::{MiscGasParameters, NativeGasParameters, LATEST_GAS_FEATURE_VERSION}; use aptos_types::on_chain_config::{Features, TimedFeaturesBuilder}; use aptos_vm::natives; @@ -13,6 +14,7 @@ pub fn aptos_debug_natives( ) -> NativeFunctionTable { // As a side effect, also configure for unit testing natives::configure_for_unit_test(); + extended_checks::configure_extended_checks_for_unit_test(); // Return all natives -- build with the 'testing' feature, therefore containing // debug related functions. natives::aptos_natives( diff --git a/crates/aptos/src/move_tool/mod.rs b/crates/aptos/src/move_tool/mod.rs index e2c62fc4b12e64..e4292e9db7739e 100644 --- a/crates/aptos/src/move_tool/mod.rs +++ b/crates/aptos/src/move_tool/mod.rs @@ -33,8 +33,8 @@ use crate::{ }; use aptos_crypto::HashValue; use aptos_framework::{ - build_model, docgen::DocgenOptions, extended_checks, natives::code::UpgradePolicy, - prover::ProverOptions, BuildOptions, BuiltPackage, + docgen::DocgenOptions, extended_checks, natives::code::UpgradePolicy, prover::ProverOptions, + BuildOptions, BuiltPackage, }; use aptos_gas_schedule::{MiscGasParameters, NativeGasParameters}; use aptos_rest_client::aptos_api_types::{ @@ -46,10 +46,6 @@ use aptos_types::{ }; use async_trait::async_trait; use clap::{Parser, Subcommand, ValueEnum}; -use codespan_reporting::{ - diagnostic::Severity, - term::termcolor::{ColorChoice, StandardStream}, -}; use itertools::Itertools; use move_cli::{self, base::test::UnitTestResult}; use move_command_line_common::env::MOVE_HOME; @@ -317,6 +313,7 @@ impl CliCommand> for CompilePackage { self.move_options.bytecode_version, self.move_options.compiler_version, self.move_options.skip_attribute_checks, + self.move_options.check_test_code, ) }; let pack = BuiltPackage::build(self.move_options.get_package_path()?, build_options) @@ -378,6 +375,7 @@ impl CompileScript { self.move_options.bytecode_version, self.move_options.compiler_version, self.move_options.skip_attribute_checks, + self.move_options.check_test_code, ) }; let package_dir = self.move_options.get_package_path()?; @@ -455,6 +453,7 @@ impl CliCommand<&'static str> for TestPackage { dev_mode: self.move_options.dev, additional_named_addresses: self.move_options.named_addresses(), test_mode: true, + full_model_generation: self.move_options.check_test_code, install_dir: self.move_options.output_dir.clone(), skip_fetch_latest_git_deps: self.move_options.skip_fetch_latest_git_deps, compiler_config: CompilerConfig { @@ -465,27 +464,6 @@ impl CliCommand<&'static str> for TestPackage { ..Default::default() }; - // Build the Move model for extended checks - let model = &build_model( - self.move_options.dev, - self.move_options.get_package_path()?.as_path(), - self.move_options.named_addresses(), - None, - self.move_options.bytecode_version, - self.move_options.compiler_version, - self.move_options.skip_attribute_checks, - known_attributes.clone(), - )?; - let _ = extended_checks::run_extended_checks(model); - if model.diag_count(Severity::Warning) > 0 { - let mut error_writer = StandardStream::stderr(ColorChoice::Auto); - model.report_diag(&mut error_writer, Severity::Warning); - if model.has_errors() { - return Err(CliError::MoveCompilationError( - "extended checks failed".to_string(), - )); - } - } let path = self.move_options.get_package_path()?; let result = move_cli::base::test::run_move_unit_tests( path.as_path(), @@ -611,6 +589,7 @@ impl CliCommand<&'static str> for DocumentPackage { bytecode_version: move_options.bytecode_version, compiler_version: move_options.compiler_version, skip_attribute_checks: move_options.skip_attribute_checks, + check_test_code: move_options.check_test_code, known_attributes: extended_checks::get_all_attribute_names().clone(), }; BuiltPackage::build(move_options.get_package_path()?, build_options)?; @@ -679,6 +658,7 @@ impl TryInto for &PublishPackage { self.move_options.bytecode_version, self.move_options.compiler_version, self.move_options.skip_attribute_checks, + self.move_options.check_test_code, ); let package = BuiltPackage::build(package_path, options) .map_err(|e| CliError::MoveCompilationError(format!("{:#}", e)))?; @@ -748,6 +728,7 @@ impl IncludedArtifacts { bytecode_version: Option, compiler_version: Option, skip_attribute_checks: bool, + check_test_code: bool, ) -> BuildOptions { use IncludedArtifacts::*; match self { @@ -763,6 +744,7 @@ impl IncludedArtifacts { bytecode_version, compiler_version, skip_attribute_checks, + check_test_code, known_attributes: extended_checks::get_all_attribute_names().clone(), ..BuildOptions::default() }, @@ -777,6 +759,7 @@ impl IncludedArtifacts { bytecode_version, compiler_version, skip_attribute_checks, + check_test_code, known_attributes: extended_checks::get_all_attribute_names().clone(), ..BuildOptions::default() }, @@ -791,6 +774,7 @@ impl IncludedArtifacts { bytecode_version, compiler_version, skip_attribute_checks, + check_test_code, known_attributes: extended_checks::get_all_attribute_names().clone(), ..BuildOptions::default() }, @@ -935,6 +919,7 @@ impl CliCommand for CreateResourceAccountAndPublishPackage { move_options.bytecode_version, move_options.compiler_version, move_options.skip_attribute_checks, + move_options.check_test_code, ); let package = BuiltPackage::build(package_path, options)?; let compiled_units = package.extract_code(); @@ -1074,6 +1059,7 @@ impl CliCommand<&'static str> for VerifyPackage { self.move_options.bytecode_version, self.move_options.compiler_version, self.move_options.skip_attribute_checks, + self.move_options.check_test_code, ) }; let pack = BuiltPackage::build(self.move_options.get_package_path()?, build_options) diff --git a/crates/aptos/src/move_tool/show.rs b/crates/aptos/src/move_tool/show.rs index 0d27e52adcbb1e..22e49f0848a3cc 100644 --- a/crates/aptos/src/move_tool/show.rs +++ b/crates/aptos/src/move_tool/show.rs @@ -66,6 +66,7 @@ impl CliCommand> for ShowAbi { self.move_options.bytecode_version, self.move_options.compiler_version, self.move_options.skip_attribute_checks, + self.move_options.check_test_code, ) }; diff --git a/crates/aptos/src/test/mod.rs b/crates/aptos/src/test/mod.rs index fd6cf57110773c..6f519c03963d37 100644 --- a/crates/aptos/src/test/mod.rs +++ b/crates/aptos/src/test/mod.rs @@ -1048,6 +1048,7 @@ impl CliTestFramework { bytecode_version: None, compiler_version: None, skip_attribute_checks: false, + check_test_code: false, } } diff --git a/third_party/move/move-compiler/src/shared/mod.rs b/third_party/move/move-compiler/src/shared/mod.rs index 172a13b709cf90..2b2ea88dbb3a91 100644 --- a/third_party/move/move-compiler/src/shared/mod.rs +++ b/third_party/move/move-compiler/src/shared/mod.rs @@ -379,6 +379,19 @@ impl Flags { } } + pub fn all_functions() -> Self { + Self { + test: true, + verify: true, + shadow: false, + flavor: "".to_string(), + bytecode_version: None, + keep_testing_functions: false, + skip_attribute_checks: false, + debug: debug_compiler_env_var(), + } + } + pub fn verification() -> Self { Self { test: false, diff --git a/third_party/move/move-model/src/ast.rs b/third_party/move/move-model/src/ast.rs index 87671c878e6720..7491a61389514c 100644 --- a/third_party/move/move-model/src/ast.rs +++ b/third_party/move/move-model/src/ast.rs @@ -73,6 +73,18 @@ pub enum Attribute { Assign(NodeId, Symbol, AttributeValue), } +impl Attribute { + pub fn name(&self) -> Symbol { + match self { + Attribute::Assign(_, s, _) | Attribute::Apply(_, s, _) => *s, + } + } + + pub fn has(attrs: &[Attribute], pred: impl Fn(&Attribute) -> bool) -> bool { + attrs.iter().any(pred) + } +} + // ================================================================================================= /// # Conditions diff --git a/third_party/move/move-model/src/model.rs b/third_party/move/move-model/src/model.rs index 92002d53c4463b..8f865e596540d6 100644 --- a/third_party/move/move-model/src/model.rs +++ b/third_party/move/move-model/src/model.rs @@ -31,6 +31,7 @@ use crate::{ ty::{ PrimitiveType, ReferenceKind, Type, TypeDisplayContext, TypeUnificationAdapter, Variance, }, + well_known, }; use codespan::{ByteIndex, ByteOffset, ColumnOffset, FileId, Files, LineOffset, Location, Span}; use codespan_reporting::{ @@ -989,10 +990,10 @@ impl GlobalEnv { } /// Writes accumulated diagnostics that pass through `filter` - pub fn report_diag_with_filter) -> bool>( + pub fn report_diag_with_filter) -> bool>( &self, writer: &mut W, - filter: F, + mut filter: F, ) { let mut shown = BTreeSet::new(); for (diag, reported) in self @@ -2085,6 +2086,27 @@ impl<'env> ModuleEnv<'env> { &self.data.attributes } + /// Checks whether the module has an attribute. + pub fn has_attribute(&self, pred: impl Fn(&Attribute) -> bool) -> bool { + Attribute::has(&self.data.attributes, pred) + } + + /// Checks whether this item is only used in tests. + pub fn is_test_only(&self) -> bool { + self.has_attribute(|a| { + let s = self.symbol_pool().string(a.name()); + well_known::is_test_only_attribute_name(s.as_str()) + }) + } + + /// Checks whether this item is only used in verification. + pub fn is_verify_only(&self) -> bool { + self.has_attribute(|a| { + let s = self.symbol_pool().string(a.name()); + well_known::is_verify_only_attribute_name(s.as_str()) + }) + } + /// Returns the use declarations of this module. pub fn get_use_decls(&self) -> &[UseDecl] { &self.data.use_decls @@ -2751,6 +2773,27 @@ impl<'env> StructEnv<'env> { &self.data.attributes } + /// Checks whether the struct has an attribute. + pub fn has_attribute(&self, pred: impl Fn(&Attribute) -> bool) -> bool { + Attribute::has(&self.data.attributes, pred) + } + + /// Checks whether this item is only used in tests. + pub fn is_test_only(&self) -> bool { + self.has_attribute(|a| { + let s = self.symbol_pool().string(a.name()); + well_known::is_test_only_attribute_name(s.as_str()) + }) + } + + /// Checks whether this item is only used in verification. + pub fn is_verify_only(&self) -> bool { + self.has_attribute(|a| { + let s = self.symbol_pool().string(a.name()); + well_known::is_verify_only_attribute_name(s.as_str()) + }) + } + /// Get documentation associated with this struct. pub fn get_doc(&self) -> &str { self.module_env.env.get_doc(&self.data.loc) @@ -3239,6 +3282,27 @@ impl<'env> FunctionEnv<'env> { &self.data.attributes } + /// Checks whether the function has an attribute. + pub fn has_attribute(&self, pred: impl Fn(&Attribute) -> bool) -> bool { + Attribute::has(&self.data.attributes, pred) + } + + /// Checks whether this item is only used in tests. + pub fn is_test_only(&self) -> bool { + self.has_attribute(|a| { + let s = self.symbol_pool().string(a.name()); + well_known::is_test_only_attribute_name(s.as_str()) + }) + } + + /// Checks whether this item is only used in verification. + pub fn is_verify_only(&self) -> bool { + self.has_attribute(|a| { + let s = self.symbol_pool().string(a.name()); + well_known::is_verify_only_attribute_name(s.as_str()) + }) + } + /// Returns the location of the specification block of this function. If the function has /// none, returns that of the function itself. pub fn get_spec_loc(&self) -> Loc { diff --git a/third_party/move/move-model/src/well_known.rs b/third_party/move/move-model/src/well_known.rs index 609c974249ba26..7ce1b4b2e3359e 100644 --- a/third_party/move/move-model/src/well_known.rs +++ b/third_party/move/move-model/src/well_known.rs @@ -2,10 +2,23 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -//! Names of well-known functions. +//! Names of well-known functions or attributes. //! //! This currently only contains those declarations used somewhere, not all well-known //! declarations. It can be extended on the go. +//! + +/// Function identifying the name of an attribute which declares an +/// item to be part of test. +pub fn is_test_only_attribute_name(s: &str) -> bool { + s == "test" || s == "test_only " +} + +/// Function identifying the name of an attribute which declares an +/// item to be part of verification only. +pub fn is_verify_only_attribute_name(s: &str) -> bool { + s == "verify_only" +} pub const VECTOR_BORROW_MUT: &str = "vector::borrow_mut"; pub const EVENT_EMIT_EVENT: &str = "event::emit_event"; diff --git a/third_party/move/move-prover/move-docgen/src/docgen.rs b/third_party/move/move-prover/move-docgen/src/docgen.rs index b0d1bbc014500f..7655c941919eca 100644 --- a/third_party/move/move-prover/move-docgen/src/docgen.rs +++ b/third_party/move/move-prover/move-docgen/src/docgen.rs @@ -671,6 +671,7 @@ impl<'env> Docgen<'env> { if !module_env.get_structs().count() > 0 { for s in module_env .get_structs() + .filter(|s| !s.is_test_only()) .sorted_by(|a, b| Ord::cmp(&a.get_loc(), &b.get_loc())) { self.gen_struct(&spec_block_map, &s); @@ -684,7 +685,7 @@ impl<'env> Docgen<'env> { let funs = module_env .get_functions() - .filter(|f| self.options.include_private_fun || f.is_exposed()) + .filter(|f| (self.options.include_private_fun || f.is_exposed()) && !f.is_test_only()) .sorted_by(|a, b| Ord::cmp(&a.get_loc(), &b.get_loc())) .collect_vec(); if !funs.is_empty() { @@ -1338,6 +1339,7 @@ impl<'env> Docgen<'env> { self.gen_spec_blocks(module_env, "", &SpecBlockTarget::Module, spec_block_map); for struct_env in module_env .get_structs() + .filter(|s| !s.is_test_only()) .sorted_by(|a, b| Ord::cmp(&a.get_loc(), &b.get_loc())) { let target = @@ -1355,6 +1357,7 @@ impl<'env> Docgen<'env> { } for func_env in module_env .get_functions() + .filter(|f| !f.is_test_only()) .sorted_by(|a, b| Ord::cmp(&a.get_loc(), &b.get_loc())) { let target = SpecBlockTarget::Function(func_env.module_env.get_id(), func_env.get_id()); @@ -1869,7 +1872,11 @@ impl<'env> Docgen<'env> { )) .unwrap_or(""); let newl_at = source_before.rfind('\n').unwrap_or(0); - let mut indent = source_before.len() - newl_at - 1; + let mut indent = if source_before.len() > newl_at { + source_before.len() - newl_at - 1 + } else { + 0 + }; if indent >= 4 && source_before.ends_with("spec ") { // Special case for `spec define` and similar constructs. indent -= 4; diff --git a/third_party/move/tools/move-cli/Cargo.toml b/third_party/move/tools/move-cli/Cargo.toml index df31e9ea0a1ace..225cd5e79c5e1a 100644 --- a/third_party/move/tools/move-cli/Cargo.toml +++ b/third_party/move/tools/move-cli/Cargo.toml @@ -41,6 +41,7 @@ move-disassembler = { path = "../move-disassembler" } move-docgen = { path = "../../move-prover/move-docgen" } move-errmapgen = { path = "../../move-prover/move-errmapgen" } move-ir-types = { path = "../../move-ir/types" } +move-model = { path = "../../move-model" } move-package = { path = "../move-package" } move-prover = { path = "../../move-prover" } move-resource-viewer = { path = "../move-resource-viewer" } diff --git a/third_party/move/tools/move-cli/src/base/mod.rs b/third_party/move/tools/move-cli/src/base/mod.rs index 62b0ee9441d3ad..f17d540d3e55b9 100644 --- a/third_party/move/tools/move-cli/src/base/mod.rs +++ b/third_party/move/tools/move-cli/src/base/mod.rs @@ -11,6 +11,7 @@ pub mod movey_upload; pub mod new; pub mod prove; pub mod test; +pub mod test_validation; use move_package::source_package::layout::SourcePackageLayout; use std::path::PathBuf; diff --git a/third_party/move/tools/move-cli/src/base/test.rs b/third_party/move/tools/move-cli/src/base/test.rs index 1539a663de3002..b07a958d38c9db 100644 --- a/third_party/move/tools/move-cli/src/base/test.rs +++ b/third_party/move/tools/move-cli/src/base/test.rs @@ -2,9 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 use super::reroot_path; -use crate::NativeFunctionRecord; -use anyhow::Result; +use crate::{base::test_validation, NativeFunctionRecord}; +use anyhow::{bail, Result}; use clap::*; +use codespan_reporting::term::{termcolor, termcolor::StandardStream}; use move_command_line_common::files::{FileHash, MOVE_COVERAGE_MAP_EXTENSION}; use move_compiler::{ diagnostics::{self, codes::Severity}, @@ -163,6 +164,7 @@ pub fn run_move_unit_tests( let mut test_plan = None; build_config.test_mode = true; build_config.dev_mode = true; + build_config.generate_move_model = test_validation::needs_validation(); // Build the resolution graph (resolution graph diagnostics are only needed for CLI commands so // ignore them by passing a vector as the writer) @@ -203,7 +205,7 @@ pub fn run_move_unit_tests( // Move package system, to first grab the compilation env, construct the test plan from it, and // then save it, before resuming the rest of the compilation and returning the results and // control back to the Move package system. - build_plan.compile_with_driver( + let (_, model_opt) = build_plan.compile_with_driver( writer, &CompilerConfig::default(), |compiler| { @@ -232,6 +234,22 @@ pub fn run_move_unit_tests( unimplemented_v2_driver, )?; + // If configured, run extra validation + if test_validation::needs_validation() { + let model = &model_opt.expect("move model"); + test_validation::validate(model); + let diag_count = model.diag_count(codespan_reporting::diagnostic::Severity::Warning); + if diag_count > 0 { + model.report_diag( + &mut StandardStream::stderr(termcolor::ColorChoice::Auto), + codespan_reporting::diagnostic::Severity::Warning, + ); + if model.has_errors() { + bail!("compilation failed") + } + } + } + let (test_plan, mut files, units) = test_plan.unwrap(); files.extend(dep_file_map); let test_plan = test_plan.unwrap(); diff --git a/third_party/move/tools/move-cli/src/base/test_validation.rs b/third_party/move/tools/move-cli/src/base/test_validation.rs new file mode 100644 index 00000000000000..e721eba9fcad4f --- /dev/null +++ b/third_party/move/tools/move-cli/src/base/test_validation.rs @@ -0,0 +1,53 @@ +// Copyright (c) The Diem Core Contributors +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +//! This module manages validation of the unit tests, in addition to standard compiler +//! checking. + +use codespan_reporting::term::{termcolor, termcolor::StandardStream}; +use move_model::model::GlobalEnv; +use once_cell::sync::Lazy; +use std::sync::Mutex; + +static VALIDATION_HOOK: Lazy>>> = + Lazy::new(|| Mutex::new(None)); + +/// Sets a hook which is called to validate the tested modules. The hook gets +/// passed the model containing the unit tests. Any errors during validation +/// should be attached to the model. +pub fn set_validation_hook(p: Box) { + *VALIDATION_HOOK.lock().unwrap() = Some(p) +} + +/// Returns true if validation is needed. This should be called to avoid building +/// a model unless needed. +pub fn needs_validation() -> bool { + VALIDATION_HOOK.lock().unwrap().is_some() +} + +/// Validates the modules in the env. +pub(crate) fn validate(env: &GlobalEnv) { + if let Some(h) = &*VALIDATION_HOOK.lock().unwrap() { + (*h)(env) + } +} + +pub fn has_errors_then_report(model: &GlobalEnv) -> bool { + let mut has_errors = false; + model.report_diag_with_filter( + &mut StandardStream::stderr(termcolor::ColorChoice::Auto), + |d| { + let include = d.labels.iter().all(|l| { + let fname = model.get_file(l.file_id).to_string_lossy(); + !fname.contains("aptos-framework/sources") + && !fname.contains("aptos-stdlib/sources") + }); + if include && d.severity == codespan_reporting::diagnostic::Severity::Error { + has_errors = true; + } + include + }, + ); + has_errors +} diff --git a/third_party/move/tools/move-package/src/compilation/build_plan.rs b/third_party/move/tools/move-package/src/compilation/build_plan.rs index 125f235bfb0933..0548c41e2e5fec 100644 --- a/third_party/move/tools/move-package/src/compilation/build_plan.rs +++ b/third_party/move/tools/move-package/src/compilation/build_plan.rs @@ -17,6 +17,7 @@ use move_compiler::{ diagnostics::{report_diagnostics_to_color_buffer, report_warnings, FilesSourceText}, Compiler, }; +use move_model::model; use petgraph::algo::toposort; use std::{collections::BTreeSet, io::Write, path::Path}; #[cfg(feature = "evm-backend")] @@ -118,6 +119,7 @@ impl BuildPlan { |compiler| compiler.build_and_report(), build_and_report_v2_driver, ) + .map(|(package, _)| package) } /// Compilation process does not exit even if warnings/failures are encountered @@ -125,7 +127,7 @@ impl BuildPlan { &self, config: &CompilerConfig, writer: &mut W, - ) -> Result { + ) -> Result<(CompiledPackage, Option)> { self.compile_with_driver( writer, config, @@ -156,7 +158,7 @@ impl BuildPlan { config: &CompilerConfig, compiler_driver_v1: impl FnMut(Compiler) -> CompilerDriverResult, compiler_driver_v2: impl FnMut(move_compiler_v2::Options) -> CompilerDriverResult, - ) -> Result { + ) -> Result<(CompiledPackage, Option)> { let root_package = &self.resolution_graph.package_table[&self.root]; let project_root = match &self.resolution_graph.build_options.install_dir { Some(under_path) => under_path.clone(), @@ -192,7 +194,7 @@ impl BuildPlan { }) .collect(); - let compiled = CompiledPackage::build_all( + let (compiled, model) = CompiledPackage::build_all( writer, &project_root, root_package.clone(), @@ -207,7 +209,7 @@ impl BuildPlan { &project_root.join(CompiledPackageLayout::Root.path()), self.sorted_deps.iter().copied().collect(), )?; - Ok(compiled) + Ok((compiled, model)) } #[cfg(feature = "evm-backend")] diff --git a/third_party/move/tools/move-package/src/compilation/compiled_package.rs b/third_party/move/tools/move-package/src/compilation/compiled_package.rs index ec54257b088ead..0e8979c2df1eb6 100644 --- a/third_party/move/tools/move-package/src/compilation/compiled_package.rs +++ b/third_party/move/tools/move-package/src/compilation/compiled_package.rs @@ -32,7 +32,10 @@ use move_compiler::{ Compiler, }; use move_docgen::{Docgen, DocgenOptions}; -use move_model::{model::GlobalEnv, options::ModelBuilderOptions, run_model_builder_with_options}; +use move_model::{ + model::GlobalEnv, options::ModelBuilderOptions, + run_model_builder_with_options_and_compilation_flags, +}; use move_symbol_pool::Symbol; use serde::{Deserialize, Serialize}; use std::{ @@ -72,7 +75,7 @@ pub struct CompiledPackageInfo { } /// Represents a compiled package in memory. -#[derive(Debug, Clone)] +#[derive(Debug)] pub struct CompiledPackage { /// Meta information about the compilation of this `CompiledPackage` pub compiled_package_info: CompiledPackageInfo, @@ -542,7 +545,7 @@ impl CompiledPackage { resolution_graph: &ResolvedGraph, mut compiler_driver_v1: impl FnMut(Compiler) -> CompilerDriverResult, mut compiler_driver_v2: impl FnMut(move_compiler_v2::Options) -> CompilerDriverResult, - ) -> Result { + ) -> Result<(CompiledPackage, Option)> { let immediate_dependencies = transitive_dependencies .iter() .filter(|(_, is_immediate, _, _, _)| *is_immediate) @@ -692,14 +695,26 @@ impl CompiledPackage { let mut compiled_docs = None; let mut compiled_abis = None; + let mut move_model = None; if resolution_graph.build_options.generate_docs || resolution_graph.build_options.generate_abis + || resolution_graph.build_options.generate_move_model { - let model = run_model_builder_with_options( + let mut flags = if resolution_graph.build_options.full_model_generation { + Flags::all_functions() + } else { + // Include verification functions as this has been legacy behavior. + Flags::verification() + }; + + if skip_attribute_checks { + flags = flags.set_skip_attribute_checks(true) + } + let model = run_model_builder_with_options_and_compilation_flags( vec![sources_package_paths], deps_package_paths.into_iter().map(|(p, _)| p).collect_vec(), ModelBuilderOptions::default(), - skip_attribute_checks, + flags, &known_attributes, )?; @@ -720,6 +735,10 @@ impl CompiledPackage { &root_compiled_units, )); } + + if resolution_graph.build_options.generate_move_model { + move_model = Some(model) + } }; let compiled_package = CompiledPackage { @@ -740,7 +759,7 @@ impl CompiledPackage { bytecode_version, )?; - Ok(compiled_package) + Ok((compiled_package, move_model)) } // We take the (restrictive) view that all filesystems are case insensitive to maximize diff --git a/third_party/move/tools/move-package/src/lib.rs b/third_party/move/tools/move-package/src/lib.rs index 40f2e7b88b37a5..78557c40dd5701 100644 --- a/third_party/move/tools/move-package/src/lib.rs +++ b/third_party/move/tools/move-package/src/lib.rs @@ -23,7 +23,7 @@ use move_compiler::{ command_line::SKIP_ATTRIBUTE_CHECKS, shared::known_attributes::KnownAttribute, }; use move_core_types::account_address::AccountAddress; -use move_model::model::GlobalEnv; +use move_model::model; use serde::{Deserialize, Serialize}; use source_package::layout::SourcePackageLayout; use std::{ @@ -114,6 +114,14 @@ pub struct BuildConfig { #[clap(name = "generate-abis", long = "abi", global = true)] pub generate_abis: bool, + /// Whether to generate a move model. Used programmatically only. + #[clap(skip)] + pub generate_move_model: bool, + + /// Whether the generated model shall contain all functions, including test-only ones. + #[clap(skip)] + pub full_model_generation: bool, + /// Installation directory for compiled artifacts. Defaults to current directory. #[clap(long = "install-dir", value_parser, global = true)] pub install_dir: Option, @@ -199,7 +207,7 @@ impl BuildConfig { self, path: &Path, writer: &mut W, - ) -> Result { + ) -> Result<(CompiledPackage, Option)> { let config = self.compiler_config.clone(); // Need clone because of mut self let resolved_graph = self.resolution_graph_for_package(path, writer)?; let mutx = PackageLock::lock(); @@ -228,7 +236,7 @@ impl BuildConfig { self, path: &Path, model_config: ModelConfig, - ) -> Result { + ) -> Result { // resolution graph diagnostics are only needed for CLI commands so ignore them by passing a // vector as the writer let resolved_graph = self.resolution_graph_for_package(path, &mut Vec::new())?; diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps/Move.exp index 7e4bd3ee067785..74974590096442 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps/Move.exp @@ -9,6 +9,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_assigned/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_assigned/Move.exp index b5836f28256d23..4190a24dfc52be 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_assigned/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_assigned/Move.exp @@ -11,6 +11,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp index 57405ba98b35a3..2841ccbc362160 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp @@ -11,6 +11,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_test_mode/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_test_mode/Move.exp index 2db2c9dbb0d164..7dc62aba7699f6 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_test_mode/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/basic_no_deps_test_mode/Move.exp @@ -11,6 +11,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_backflow_resolution/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_backflow_resolution/Move.exp index 964729bb7c9c10..935b5c9353d4db 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_backflow_resolution/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_backflow_resolution/Move.exp @@ -12,6 +12,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_no_conflict/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_no_conflict/Move.exp index 964729bb7c9c10..935b5c9353d4db 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_no_conflict/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/diamond_problem_no_conflict/Move.exp @@ -12,6 +12,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename/Move.exp index 177c0a39ca4f8f..35c1cb82d79da4 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename/Move.exp @@ -13,6 +13,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename_one/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename_one/Move.exp index c68534053b8209..6fe1e4eae7340f 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename_one/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/multiple_deps_rename_one/Move.exp @@ -13,6 +13,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep/Move.exp index 4c01ee04c4c3b1..33a4138c82e379 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep/Move.exp @@ -11,6 +11,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_assigned_address/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_assigned_address/Move.exp index 26a227dc2b455e..edce6b07bd119a 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_assigned_address/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_assigned_address/Move.exp @@ -11,6 +11,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_renamed/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_renamed/Move.exp index 4c01ee04c4c3b1..33a4138c82e379 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_renamed/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_renamed/Move.exp @@ -11,6 +11,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_with_scripts/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_with_scripts/Move.exp index 4c01ee04c4c3b1..33a4138c82e379 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_with_scripts/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/one_dep_with_scripts/Move.exp @@ -11,6 +11,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/test_symlinks/Move.exp b/third_party/move/tools/move-package/tests/test_sources/compilation/test_symlinks/Move.exp index b5836f28256d23..4190a24dfc52be 100644 --- a/third_party/move/tools/move-package/tests/test_sources/compilation/test_symlinks/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/test_symlinks/Move.exp @@ -11,6 +11,8 @@ CompiledPackageInfo { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/parsing/invalid_identifier_package_name/Move.exp b/third_party/move/tools/move-package/tests/test_sources/parsing/invalid_identifier_package_name/Move.exp index 936c4bd9a97739..5587495f0e9e7c 100644 --- a/third_party/move/tools/move-package/tests/test_sources/parsing/invalid_identifier_package_name/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/parsing/invalid_identifier_package_name/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/parsing/minimal_manifest/Move.exp b/third_party/move/tools/move-package/tests/test_sources/parsing/minimal_manifest/Move.exp index a7821b83ba9e83..69352261a1ec38 100644 --- a/third_party/move/tools/move-package/tests/test_sources/parsing/minimal_manifest/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/parsing/minimal_manifest/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps/Move.exp index 561972d369acd3..939fcbae34e4a2 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_assigned/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_assigned/Move.exp index 772b03a09baed5..058aedd83bd995 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_assigned/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_assigned/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp index 9826086a65a2bc..731c3188ea6130 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/basic_no_deps_address_not_assigned_with_dev_assignment/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/dep_good_digest/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/dep_good_digest/Move.exp index 98faede277b8f2..31949c58a7dce5 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/dep_good_digest/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/dep_good_digest/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_backflow_resolution/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_backflow_resolution/Move.exp index 0cf45c9ce8aac8..e32b8c03506a2f 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_backflow_resolution/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_backflow_resolution/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_no_conflict/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_no_conflict/Move.exp index fbba67433e6a6c..9b0eb0b45f3d98 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_no_conflict/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/diamond_problem_no_conflict/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/multiple_deps_rename/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/multiple_deps_rename/Move.exp index bb5c59a839352f..addf6865e89d5f 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/multiple_deps_rename/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/multiple_deps_rename/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep/Move.exp index 31ba77943079de..05430b1524bb17 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_assigned_address/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_assigned_address/Move.exp index dc6fe5c33b3fc3..17cfbfe25e3fbe 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_assigned_address/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_assigned_address/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_multiple_of_same_name/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_multiple_of_same_name/Move.exp index 9fc55bd2e7ca00..98fb05cb1e34f4 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_multiple_of_same_name/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_multiple_of_same_name/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_reassigned_address/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_reassigned_address/Move.exp index 5ace088e634579..afb0c5b5f51007 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_reassigned_address/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_reassigned_address/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ), diff --git a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_unification_across_local_renamings/Move.exp b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_unification_across_local_renamings/Move.exp index f0855befe74e75..fce608dd12ac2f 100644 --- a/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_unification_across_local_renamings/Move.exp +++ b/third_party/move/tools/move-package/tests/test_sources/resolution/one_dep_unification_across_local_renamings/Move.exp @@ -5,6 +5,8 @@ ResolutionGraph { test_mode: false, generate_docs: false, generate_abis: false, + generate_move_model: false, + full_model_generation: false, install_dir: Some( "ELIDED_FOR_TEST", ),