diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 876cea8d5f..400f4a71f5 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -215,7 +215,7 @@ jobs: - name: Use Node.js 14 uses: actions/setup-node@v2.4.0 with: - node-version: '14' + node-version: "14" - name: Install NPM dependencies working-directory: language/move-analyzer/editors/code run: npm install @@ -271,4 +271,4 @@ jobs: - name: Build BasicCoin Move module run: | cd ./language/documentation/tutorial/step_1/BasicCoin - docker run -v `pwd`:/project move/cli package build + docker run -v `pwd`:/project move/cli build diff --git a/README.md b/README.md index 29eacaceec..639e1d020a 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ docker build -t move/cli -f docker/move-cli/Dockerfile . ``` cd ./language/documentation/tutorial/step_1/BasicCoin -docker run -v `pwd`:/project move/cli package build +docker run -v `pwd`:/project move/cli build ``` ## Community diff --git a/language/changes/7-packages.md b/language/changes/7-packages.md index 9ddf636428..dae0e71799 100644 --- a/language/changes/7-packages.md +++ b/language/changes/7-packages.md @@ -267,10 +267,10 @@ NamedAddr = "0xC0FFEE" ## Usage, Artifacts, and Data Structures The Move package system comes with a command line option as part of the Move -CLI `move package `. Unless a +CLI `move `. Unless a particular path is provided, all package commands will run in the current working -directory. The full list of commands and flags for the Move Package CLI can be found by -running `move package --help`. +directory. The full list of commands and flags for the Move CLI can be found by +running `move --help`. ### Usage diff --git a/language/documentation/book/src/packages.md b/language/documentation/book/src/packages.md index 82f95666b4..37947cc59d 100644 --- a/language/documentation/book/src/packages.md +++ b/language/documentation/book/src/packages.md @@ -248,10 +248,10 @@ named_addr = "0xC0FFEE" ## Usage, Artifacts, and Data Structures The Move package system comes with a command line option as part of the Move -CLI `move package `. Unless a +CLI `move `. Unless a particular path is provided, all package commands will run in the current working -directory. The full list of commands and flags for the Move Package CLI can be found by -running `move package --help`. +directory. The full list of commands and flags for the Move CLI can be found by +running `move --help`. ### Usage diff --git a/language/documentation/book/src/unit-testing.md b/language/documentation/book/src/unit-testing.md index db64a94869..868e3b3c40 100644 --- a/language/documentation/book/src/unit-testing.md +++ b/language/documentation/book/src/unit-testing.md @@ -95,7 +95,7 @@ fun test_only_function(...) { ... } ## Running Unit Tests -Unit tests for a Move package can be run with the [`move package test` +Unit tests for a Move package can be run with the [`move test` command](./packages.md). When running tests, every test will either `PASS`, `FAIL`, or `TIMEOUT`. If a test case fails, the location of the failure along with the function name that caused the failure will be reported if possible. You can see an example of this below. @@ -105,7 +105,7 @@ A test will be marked as timing out if it exceeds the maximum number of instruct There are also a number of options that can be passed to the unit testing binary to fine-tune testing and to help debug failing tests. These can be found using the the help flag: ``` -$ move package -h +$ move -h ``` ## Example @@ -114,7 +114,7 @@ A simple module using some of the unit testing features is shown in the followin First create an empty package and change directory into it: ``` -$ move package new TestExample; cd TestExample +$ move new TestExample; cd TestExample ``` Next add the following to the `Move.toml`: @@ -173,10 +173,10 @@ module 0x1::my_module { ### Running Tests -You can then run these tests with the `move package test` command: +You can then run these tests with the `move test` command: ``` -$ move package test +$ move test BUILDING MoveStdlib BUILDING TestExample Running Move unit tests @@ -192,7 +192,7 @@ Test result: OK. Total tests: 3; passed: 3; failed: 0 This will only run tests whose fully qualified name contains ``. For example if we wanted to only run tests with `"zero_coin"` in their name: ``` -$ move package test -f zero_coin +$ move test -f zero_coin CACHED MoveStdlib BUILDING TestExample Running Move unit tests @@ -205,7 +205,7 @@ Test result: OK. Total tests: 2; passed: 2; failed: 0 This bounds the number of instructions that can be executed for any one test to ``: ``` -$ move package test -i 0 +$ move test -i 0 CACHED MoveStdlib BUILDING TestExample Running Move unit tests @@ -238,7 +238,7 @@ Test result: FAILED. Total tests: 3; passed: 0; failed: 3 With these flags you can gather statistics about the tests run and report the runtime and instructions executed for each test. For example, if we wanted to see the statistics for the tests in the example above: ``` -$ move package test -s +$ move test -s CACHED MoveStdlib BUILDING TestExample Running Move unit tests @@ -279,7 +279,7 @@ module 0x1::my_module { we would get get the following output when running the tests: ``` -$ move package test -g +$ move test -g CACHED MoveStdlib BUILDING TestExample Running Move unit tests diff --git a/language/documentation/examples/diem-framework/build_all.sh b/language/documentation/examples/diem-framework/build_all.sh index 934104ac32..cb5a07535a 100755 --- a/language/documentation/examples/diem-framework/build_all.sh +++ b/language/documentation/examples/diem-framework/build_all.sh @@ -5,6 +5,6 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- package build && -cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- package build && -cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- package build +cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- build && +cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- build && +cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- build diff --git a/language/documentation/examples/diem-framework/crates/cli/src/main.rs b/language/documentation/examples/diem-framework/crates/cli/src/main.rs index 354249d780..f974828c32 100644 --- a/language/documentation/examples/diem-framework/crates/cli/src/main.rs +++ b/language/documentation/examples/diem-framework/crates/cli/src/main.rs @@ -49,13 +49,13 @@ fn main() -> Result<()> { let num_natives = natives.len(); let args = DfCli::parse(); - match &args.cmd { + match args.cmd { DfCommands::Command(cmd) => move_cli::run_cli( natives, &cost_table(num_natives), // TODO: implement this &ErrorMapping::default(), - &args.move_args, + args.move_args, cmd, ), } diff --git a/language/documentation/examples/diem-framework/prove_all.sh b/language/documentation/examples/diem-framework/prove_all.sh index bf3c64939c..d5ed1a864d 100755 --- a/language/documentation/examples/diem-framework/prove_all.sh +++ b/language/documentation/examples/diem-framework/prove_all.sh @@ -5,6 +5,6 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- package prove && -cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- package prove && -cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- package prove +cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- prove && +cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- prove && +cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- prove diff --git a/language/documentation/examples/diem-framework/test_all.sh b/language/documentation/examples/diem-framework/test_all.sh index ff78267b8c..d82ab2ce3e 100755 --- a/language/documentation/examples/diem-framework/test_all.sh +++ b/language/documentation/examples/diem-framework/test_all.sh @@ -5,6 +5,6 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- package test && -cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- package test && -cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- package test +cd "${SCRIPT_DIR}/move-packages/DPN" && cargo run -p df-cli -- test && +cd "${SCRIPT_DIR}/move-packages/core" && cargo run -p df-cli -- test && +cd "${SCRIPT_DIR}/move-packages/experimental" && cargo run -p df-cli -- test diff --git a/language/documentation/examples/experimental/math-puzzle/README.md b/language/documentation/examples/experimental/math-puzzle/README.md index 5bcf7e01df..a272614299 100644 --- a/language/documentation/examples/experimental/math-puzzle/README.md +++ b/language/documentation/examples/experimental/math-puzzle/README.md @@ -30,7 +30,7 @@ In `sources/puzzlie.move`, the function `Puzzle::puzzle` is constructed to take Use the following command to run Move Prover: ``` -move package prove +move prove ``` The following is the expected output of Move Prover: diff --git a/language/documentation/tutorial/README.md b/language/documentation/tutorial/README.md index e8a6a1625b..55c09debc8 100644 --- a/language/documentation/tutorial/README.md +++ b/language/documentation/tutorial/README.md @@ -55,7 +55,7 @@ cargo install --path language/tools/move-cli You can check that it is working by running the following command: ```bash -move package --help +move --help ``` You should see something like this along with a list and description of a @@ -66,7 +66,7 @@ move-package Execute a package command. Executed in the current directory or the closest containing Move package USAGE: - move package [OPTIONS] + move [OPTIONS] OPTIONS: --abi Generate ABIs for packages @@ -158,10 +158,10 @@ Let's take a look at this function and what it's saying: * It creates a `Coin` with the given value and stores it under the `account` using the `move_to` operator. -Let's make sure it builds! This can be done with the `package build` command from within the package folder ([`step_1/BasicCoin`](./step_1/BasicCoin/)): +Let's make sure it builds! This can be done with the `build` command from within the package folder ([`step_1/BasicCoin`](./step_1/BasicCoin/)): ```bash -move package build +move build ```
@@ -169,7 +169,7 @@ move package build * You can create an empty Move package by calling: ```bash - move package new + move new ``` * Move code can also live a number of other places. More information on the Move package system can be found in the [Move @@ -218,7 +218,7 @@ unit tests in Rust if you're familiar with them -- tests are annotated with You can run the tests with the `package test` command: ```bash -move package test +move test ``` Let's now take a look at the contents of the [`FirstModule.move` @@ -270,7 +270,7 @@ assertion fails the unit test will fail. #### Exercises * Change the assertion to `11` so that the test fails. Find a flag that you can - pass to the `move package test` command that will show you the global state when + pass to the `move test` command that will show you the global state when the test fails. It should look something like this: ``` ┌── test_mint_10 ────── @@ -293,7 +293,7 @@ assertion fails the unit test will fail. └────────────────── ``` * Find a flag that allows you to gather test coverage information, and - then play around with using the `move package coverage` command to look at + then play around with using the `move coverage` command to look at coverage statistics and source coverage.
@@ -383,7 +383,7 @@ implementation of the methods inside [`BasicCoin.move`](./step_4/sources/BasicCo Let's first try building the code using Move package by running the following command in [`step_4/BasicCoin`](./step_4/BasicCoin) folder: ```bash -move package build +move build ``` ### Implementation of methods @@ -473,7 +473,7 @@ take a look at some tools we can use to help us write tests. To get started, run the `package test` command in the [`step_5/BasicCoin`](./step_5/BasicCoin) folder ```bash -move package test +move test ``` You should see something like this: @@ -592,7 +592,7 @@ Informally speaking, the block `spec balance_of {...}` contains the property spe Let's first run the prover using the following command inside [`BasicCoin` directory](./step_7/BasicCoin/): ```bash -move package prove +move prove ``` which outputs the following error information: @@ -627,7 +627,7 @@ The prover basically tells us that we need to explicitly specify the condition u ``` After adding this condition, try running the `prove` command again to confirm that there are no verification errors: ```bash -move package prove +move prove ``` Apart from the abort condition, we also want to define the functional properties. In Step 8, we will give more detailed introduction to the prover by specifying properties for the methods defined the `BasicCoin` module. diff --git a/language/documentation/tutorial/step_2_sol/solution_commands b/language/documentation/tutorial/step_2_sol/solution_commands index 6aa18e3ce1..54ab34115e 100644 --- a/language/documentation/tutorial/step_2_sol/solution_commands +++ b/language/documentation/tutorial/step_2_sol/solution_commands @@ -1,11 +1,11 @@ # Exercise 1 -move package test -g +move test -g # Exercise 2 -move package test --coverage +move test --coverage Followed by: -move package coverage summary -move package coverage summary --summarize-functions -move package coverage source --module BasicCoin +move coverage summary +move coverage summary --summarize-functions +move coverage source --module BasicCoin diff --git a/language/evm/examples/README.md b/language/evm/examples/README.md index fa67872429..1098286dbe 100644 --- a/language/evm/examples/README.md +++ b/language/evm/examples/README.md @@ -11,4 +11,4 @@ This directory contains (a growing set of) examples of "Move-on-EVM", a programm - [ERC1155.move](./sources/ERC1155.move) contains an implementation of ERC1155 which is the standard for multi-tokens. - [TestUniswap.move](./sources/TestUniswap.move) and [TestUniswapLiquidity.move](./sources/TestUniswapLiquidity.move) are the sample client modules of `Uniswap`. -This directory is a Move package. To build the source files, use `move package build`. Moreover, use `move package test` to run the unit tests located in the `tests` directory. +This directory is a Move package. To build the source files, use `move build`. Moreover, use `move test` to run the unit tests located in the `tests` directory. diff --git a/language/evm/hardhat-move/src/index.ts b/language/evm/hardhat-move/src/index.ts index a8b5eb0b7e..1784b03017 100644 --- a/language/evm/hardhat-move/src/index.ts +++ b/language/evm/hardhat-move/src/index.ts @@ -153,7 +153,7 @@ async function locateMoveExecutablePath(): Promise> { class MoveBuildError { exec_err: ChildProcess.ExecException; - // TODO: right now, `move package build` outputs its build errors to stdout instead of stderr. + // TODO: right now, `move build` outputs its build errors to stdout instead of stderr. // This may not be ideal and we may want to fix it and then revisit the error definition here. stdout: string; stderr: string; @@ -166,7 +166,7 @@ class MoveBuildError { } async function movePackageBuild(movePath: string, packagePath: string): Promise> { - let cmd = `${movePath} package build --path ${packagePath} --arch ethereum`; + let cmd = `${movePath} build --path ${packagePath} --arch ethereum`; let [e, stdout, stderr] = await executeChildProcess(cmd); diff --git a/language/extensions/move-table-extension/tests/move_unit_tests.rs b/language/extensions/move-table-extension/tests/move_unit_tests.rs index df7b40ec61..2bd17c892e 100644 --- a/language/extensions/move-table-extension/tests/move_unit_tests.rs +++ b/language/extensions/move-table-extension/tests/move_unit_tests.rs @@ -2,7 +2,7 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -use move_cli::package::{cli, cli::UnitTestResult}; +use move_cli::base::test::{run_move_unit_tests, UnitTestResult}; use move_core_types::account_address::AccountAddress; use move_table_extension::table_natives; use move_unit_test::UnitTestingConfig; @@ -16,7 +16,7 @@ fn run_tests_for_pkg(path_to_pkg: impl Into) { natives.append(&mut table_natives( AccountAddress::from_hex_literal("0x2").unwrap(), )); - let res = cli::run_move_unit_tests( + let res = run_move_unit_tests( &pkg_path, move_package::BuildConfig { test_mode: true, diff --git a/language/move-prover/doc/user/prover-guide.md b/language/move-prover/doc/user/prover-guide.md index b95418bdf1..c489ef025a 100644 --- a/language/move-prover/doc/user/prover-guide.md +++ b/language/move-prover/doc/user/prover-guide.md @@ -29,15 +29,15 @@ alias move="cargo run --release --quiet --package move-cli --" We assume in the sequel that the Move CLI is reachable from the command line via the `move` command (defined by an alias as above or by other means). -In order to call the CLI, you must have a [*move package*](https://move-language.github.io/move/packages.html). In the simplest +In order to call the CLI, you must have a [*move *](https://move-language.github.io/move/packages.html). In the simplest case, a Move package is defined by a directory with a set of `.move` files in it and a manifest of the name `Move.toml`. -You can create a package `` in a sub-directory by calling `move package new `. +You can create a package `` in a sub-directory by calling `move new `. Now, to call the prover simply use one of the following commands: ```shell script -move package -p prove # Prove the sources of the package at -move package prove # Equivalent to `move package -p . prove` +move -p prove # Prove the sources of the package at +move prove # Equivalent to `move -p . prove` ``` ### Target Filtering @@ -47,7 +47,7 @@ often more effective to focus verification on particular files. You do this with `-t` (`--target`) option: ```shell script -move package prove -t DiemConfig +move prove -t DiemConfig ``` In general, if the string provided via the `-t` option is contained somewhere in the file name of a source, that source @@ -55,19 +55,19 @@ will be included for verification. > NOTE: the Move prover ensures that there is no semantic difference between verifying modules one-by-one > or all at once. However, if your goal is to verify all modules, verifying them in a single -> `move package prove` run will be significantly faster then sequentially. +> `move prove` run will be significantly faster then sequentially. ### Prover Options The prover has a number of options which are not directly handled by the CLI but rather passed through. You pass options -through with an invocation like `move package prove -- `. The most commonly used option is the `-t` (`--trace`) +through with an invocation like `move prove -- `. The most commonly used option is the `-t` (`--trace`) option which lets the prover produce richer diagnosis when it encounters errors: ```shell script -move package prove -t DiemConfig -- -t +move prove -t DiemConfig -- -t ``` -To see the list of all command line options, use `move package prove -- --help`. +To see the list of all command line options, use `move prove -- --help`. ### Prover Configuration File @@ -113,7 +113,7 @@ proc_cores = 4 > HINT: for local verification, you may want to set proc_cores to an aggressive number > (your actual cores) to speed up the turn-around cycle. -> NOTE: To let the prover dump all the available toml options, use `move package prove -- --print-config`. This +> NOTE: To let the prover dump all the available toml options, use `move prove -- --print-config`. This > will, however, contain many more unrelated and potentially defunct experimental options. ## Prover Tests diff --git a/language/move-stdlib/tests/move_unit_test.rs b/language/move-stdlib/tests/move_unit_test.rs index 37bd61c72b..06f3812580 100644 --- a/language/move-stdlib/tests/move_unit_test.rs +++ b/language/move-stdlib/tests/move_unit_test.rs @@ -2,7 +2,7 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -use move_cli::package::{cli, cli::UnitTestResult}; +use move_cli::base::test::{run_move_unit_tests, UnitTestResult}; use move_core_types::account_address::AccountAddress; use move_stdlib::{natives::all_natives, path_in_crate}; use move_unit_test::UnitTestingConfig; @@ -10,7 +10,7 @@ use tempfile::tempdir; fn run_tests_for_pkg(path_to_pkg: impl Into) { let pkg_path = path_in_crate(path_to_pkg); - let result = cli::run_move_unit_tests( + let result = run_move_unit_tests( &pkg_path, move_package::BuildConfig { test_mode: true, diff --git a/language/move-stdlib/tests/move_verification_test.rs b/language/move-stdlib/tests/move_verification_test.rs index 783b91353e..70b42a8317 100644 --- a/language/move-stdlib/tests/move_verification_test.rs +++ b/language/move-stdlib/tests/move_verification_test.rs @@ -2,7 +2,7 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -use move_cli::package::prover::ProverTest; +use move_cli::base::prove::ProverTest; // TODO: split this into individual tests once the package system supports this. diff --git a/language/tools/move-cli/README.md b/language/tools/move-cli/README.md index d8ffdb590b..093a411f5b 100644 --- a/language/tools/move-cli/README.md +++ b/language/tools/move-cli/README.md @@ -46,30 +46,30 @@ i.e., `move --help`. Package commands provide wrappers with sane defaults around other commands that are provided either by various Move tools, compiler, or prover. -The `move package new` command will create a new empty Move package: +The `move new` command will create a new empty Move package: ```shell -$ move package new # Create a Move package under the current dir -$ move package new -p # Create a Move package under path +$ move new # Create a Move package under the current dir +$ move new -p # Create a Move package under path ``` From within a package's root directory, you can build the modules and/or scripts that you have written in the package with: ```shell -$ move package build # Builds the Move package you are currently in -$ move package build -p # Builds the Move package at +$ move build # Builds the Move package you are currently in +$ move build -p # Builds the Move package at ``` The compiled artifacts will by default be stored in the `build` directory. You can change where the build artifacts are saved by passing the optional `--build-dir` flag: ```shell -$ move package build --build-dir # Build current Move package and save artifacts under +$ move build --build-dir # Build current Move package and save artifacts under ``` You can verify the specifications in a Move package using the Move Prover with the `prove` command: ```shell -$ move package prove # Verify the specifications in the current package -$ move package prove -p # Verify the specifications in the package at +$ move prove # Verify the specifications in the current package +$ move prove -p # Verify the specifications in the package at ``` In order to run the Move Prover [additional tools need to be @@ -82,8 +82,8 @@ and You can also run unit tests in a package using the `test` command ```shell -$ move package test # Run Move unit tests in the current package -$ move package test -p # Run Move unit tests in the package at +$ move test # Run Move unit tests in the current package +$ move test -p # Run Move unit tests in the package at ``` ## Sandbox Commands @@ -97,7 +97,7 @@ Each sandbox command is run in the context of a Move package. So let's create a Move package that we'll use for the code in this README and `cd` into it: ```shell -$ move package new readme +$ move new readme $ cd readme ``` @@ -189,7 +189,7 @@ module 0x2::Test { Now, try ```shell -$ move package build +$ move build ``` This will cause the CLI to compile and typecheck the modules under @@ -250,13 +250,13 @@ public write() { ``` You can also look at the compiled bytecode before publishing to `storage` by -running either `move package disassemble --name ` or `move package +running either `move disassemble --name ` or `move disassemble --name --interactive` to interactively inspect the bytecode and how it relates to the Move source code: ```shell -$ move package disassemble --name Test --interactive # You can quit by pressing "q" -$ move package disassemble --name Test +$ move disassemble --name Test --interactive # You can quit by pressing "q" +$ move disassemble --name Test // Move bytecode v4 module 2.Test { struct Resource has key { @@ -408,7 +408,7 @@ $ cat readme/args.txt ## Arg files can have comments! sandbox run sources/debug_script.move --signers 0xf sandbox run sources/debug_script.move --signers 0xf -package build +build sandbox publish sandbox view storage/0x00000000000000000000000000000002/modules/Test.mv sandbox run sources/test_script.move --signers 0xf -v diff --git a/language/tools/move-cli/src/base/build.rs b/language/tools/move-cli/src/base/build.rs new file mode 100644 index 0000000000..02c422012e --- /dev/null +++ b/language/tools/move-cli/src/base/build.rs @@ -0,0 +1,34 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +use super::reroot_path; +use clap::*; +use move_package::{Architecture, BuildConfig}; +use std::path::Path; + +/// Build the package at `path`. If no path is provided defaults to current directory. +#[derive(Parser)] +#[clap(name = "build")] +pub struct Build; + +impl Build { + pub fn execute(self, path: &Path, config: BuildConfig) -> anyhow::Result<()> { + let rerooted_path = reroot_path(path)?; + let architecture = config.architecture.unwrap_or(Architecture::Move); + + match architecture { + Architecture::Move | Architecture::AsyncMove => { + config.compile_package(&rerooted_path, &mut std::io::stderr())?; + } + + Architecture::Ethereum => { + #[cfg(feature = "evm-backend")] + config.compile_package_evm(&rerooted_path, &mut std::io::stderr())?; + + #[cfg(not(feature = "evm-backend"))] + anyhow::bail!("The Ethereum architecture is not supported because move-cli was not compiled with feature flag `evm-backend`."); + } + } + Ok(()) + } +} diff --git a/language/tools/move-cli/src/base/commands/check.rs b/language/tools/move-cli/src/base/commands/check.rs deleted file mode 100644 index ff1af16544..0000000000 --- a/language/tools/move-cli/src/base/commands/check.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) The Diem Core Contributors -// Copyright (c) The Move Contributors -// SPDX-License-Identifier: Apache-2.0 - -use std::collections::BTreeMap; - -use anyhow::Result; -use move_compiler::{self, shared::NumericalAddress, Compiler, Flags}; - -/// Type-check the user modules in `files` and the dependencies in `interface_files` -pub fn check( - interface_files: Vec, - sources_shadow_deps: bool, - files: Vec, - named_addresses: BTreeMap, - verbose: bool, -) -> Result<()> { - if verbose { - println!("Checking Move files..."); - } - Compiler::from_files(files, interface_files, named_addresses) - .set_flags(Flags::empty().set_sources_shadow_deps(sources_shadow_deps)) - .check_and_report()?; - Ok(()) -} diff --git a/language/tools/move-cli/src/base/commands/compile.rs b/language/tools/move-cli/src/base/commands/compile.rs deleted file mode 100644 index 3416925b68..0000000000 --- a/language/tools/move-cli/src/base/commands/compile.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) The Diem Core Contributors -// Copyright (c) The Move Contributors -// SPDX-License-Identifier: Apache-2.0 - -use anyhow::Result; -use move_command_line_common::env::get_bytecode_version_from_env; -use move_compiler::{self, shared::NumericalAddress, Compiler, Flags}; -use std::collections::BTreeMap; - -/// Compile the user modules in `sources` against the dependencies in `interface_files`, placing -/// the resulting binaries in `output_dir`. -pub fn compile( - interface_files: Vec, - output_dir: &str, - sources_shadow_deps: bool, - sources: Vec, - named_address_mapping: BTreeMap, - emit_source_map: bool, - verbose: bool, -) -> Result<()> { - if verbose { - println!("Compiling Move files..."); - } - let (files, compiled_units) = - Compiler::from_files(sources, interface_files, named_address_mapping) - .set_flags(Flags::empty().set_sources_shadow_deps(sources_shadow_deps)) - .build_and_report()?; - move_compiler::output_compiled_units( - get_bytecode_version_from_env(), - emit_source_map, - files, - compiled_units, - output_dir, - ) -} diff --git a/language/tools/move-cli/src/base/commands/mod.rs b/language/tools/move-cli/src/base/commands/mod.rs deleted file mode 100644 index 76a2f34147..0000000000 --- a/language/tools/move-cli/src/base/commands/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) The Diem Core Contributors -// Copyright (c) The Move Contributors -// SPDX-License-Identifier: Apache-2.0 - -pub mod check; -pub mod compile; - -pub use check::*; -pub use compile::*; diff --git a/language/tools/move-cli/src/base/coverage.rs b/language/tools/move-cli/src/base/coverage.rs new file mode 100644 index 0000000000..ce2ff5c1d0 --- /dev/null +++ b/language/tools/move-cli/src/base/coverage.rs @@ -0,0 +1,110 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +use super::reroot_path; +use clap::*; +use move_compiler::compiled_unit::{CompiledUnit, NamedCompiledModule}; +use move_coverage::{ + coverage_map::CoverageMap, format_csv_summary, format_human_summary, + source_coverage::SourceCoverageBuilder, summary::summarize_inst_cov, +}; +use move_disassembler::disassembler::Disassembler; +use move_package::BuildConfig; +use std::path::Path; + +#[derive(Parser)] +pub enum CoverageSummaryOptions { + /// Display a coverage summary for all modules in this package + #[clap(name = "summary")] + Summary { + /// Whether function coverage summaries should be displayed + #[clap(long = "summarize-functions")] + functions: bool, + /// Output CSV data of coverage + #[clap(long = "csv")] + output_csv: bool, + }, + /// Display coverage information about the module against source code + #[clap(name = "source")] + Source { + #[clap(long = "module")] + module_name: String, + }, + /// Display coverage information about the module against disassembled bytecode + #[clap(name = "bytecode")] + Bytecode { + #[clap(long = "module")] + module_name: String, + }, +} + +/// Inspect test coverage for this package. A previous test run with the `--coverage` flag must +/// have previously been run. +#[derive(Parser)] +#[clap(name = "coverage")] +pub struct Coverage { + #[clap(subcommand)] + options: CoverageSummaryOptions, +} + +impl Coverage { + pub fn execute(self, path: &Path, config: BuildConfig) -> anyhow::Result<()> { + let path = reroot_path(path)?; + let coverage_map = CoverageMap::from_binary_file(path.join(".coverage_map.mvcov"))?; + let package = config.compile_package(&path, &mut Vec::new())?; + let modules: Vec<_> = package + .root_modules() + .filter_map(|unit| match &unit.unit { + CompiledUnit::Module(NamedCompiledModule { module, .. }) => Some(module.clone()), + _ => None, + }) + .collect(); + match self.options { + CoverageSummaryOptions::Source { module_name } => { + let unit = package.get_module_by_name_from_root(&module_name)?; + let source_path = &unit.source_path; + let (module, source_map) = match &unit.unit { + CompiledUnit::Module(NamedCompiledModule { + module, source_map, .. + }) => (module, source_map), + _ => panic!("Should all be modules"), + }; + let source_coverage = SourceCoverageBuilder::new(module, &coverage_map, source_map); + source_coverage + .compute_source_coverage(source_path) + .output_source_coverage(&mut std::io::stdout()) + .unwrap(); + } + CoverageSummaryOptions::Summary { + functions, + output_csv, + .. + } => { + let coverage_map = coverage_map.to_unified_exec_map(); + if output_csv { + format_csv_summary( + modules.as_slice(), + &coverage_map, + summarize_inst_cov, + &mut std::io::stdout(), + ) + } else { + format_human_summary( + modules.as_slice(), + &coverage_map, + summarize_inst_cov, + &mut std::io::stdout(), + functions, + ) + } + } + CoverageSummaryOptions::Bytecode { module_name } => { + let unit = package.get_module_by_name_from_root(&module_name)?; + let mut disassembler = Disassembler::from_unit(&unit.unit); + disassembler.add_coverage_map(coverage_map.to_unified_exec_map()); + println!("{}", disassembler.disassemble()?); + } + } + Ok(()) + } +} diff --git a/language/tools/move-cli/src/base/disassemble.rs b/language/tools/move-cli/src/base/disassemble.rs new file mode 100644 index 0000000000..44e7dae59c --- /dev/null +++ b/language/tools/move-cli/src/base/disassemble.rs @@ -0,0 +1,74 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +use super::reroot_path; +use clap::*; +use move_compiler::compiled_unit::{CompiledUnit, NamedCompiledModule}; +use move_disassembler::disassembler::Disassembler; +use move_package::{compilation::compiled_package::CompiledUnitWithSource, BuildConfig}; +use std::path::Path; + +/// Disassemble the Move bytecode pointed to +#[derive(Parser)] +#[clap(name = "disassemble")] +pub struct Disassemble { + /// Start a disassembled bytecode-to-source explorer + #[clap(long = "interactive")] + interactive: bool, + /// The package name. If not provided defaults to current package modules only + #[clap(long = "package")] + package_name: Option, + /// The name of the module or script in the package to disassemble + #[clap(long = "name")] + module_or_script_name: String, +} + +impl Disassemble { + pub fn execute(self, path: &Path, config: BuildConfig) -> anyhow::Result<()> { + let rerooted_path = reroot_path(path)?; + let Self { + interactive, + package_name, + module_or_script_name, + } = self; + // Make sure the package is built + let package = config.compile_package(&rerooted_path, &mut Vec::new())?; + let needle_package = package_name + .as_deref() + .unwrap_or(package.compiled_package_info.package_name.as_str()); + match package + .get_module_by_name(needle_package, &module_or_script_name) + .ok() + { + None => anyhow::bail!( + "Unable to find module or script with name '{}' in package '{}'", + module_or_script_name, + needle_package, + ), + Some(unit) => { + // Once we find the compiled bytecode we're interested in, startup the bytecode + // viewer, or run the disassembler depending on if we need to run interactively + // or not. + if interactive { + match unit { + CompiledUnitWithSource { + unit: + CompiledUnit::Module(NamedCompiledModule { + module, source_map, .. + }), + source_path, + } => move_bytecode_viewer::start_viewer_in_memory( + module.clone(), + source_map.clone(), + source_path, + ), + _ => anyhow::bail!("Interactive disassembler not supported for scripts"), + } + } else { + println!("{}", Disassembler::from_unit(&unit.unit).disassemble()?); + } + } + } + Ok(()) + } +} diff --git a/language/tools/move-cli/src/base/errmap.rs b/language/tools/move-cli/src/base/errmap.rs new file mode 100644 index 0000000000..e16570473f --- /dev/null +++ b/language/tools/move-cli/src/base/errmap.rs @@ -0,0 +1,50 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +use super::reroot_path; +use clap::*; +use move_package::{BuildConfig, ModelConfig}; +use std::path::{Path, PathBuf}; + +/// Generate error map for the package and its dependencies at `path` for use by the Move +/// explanation tool. +#[derive(Parser)] +#[clap(name = "errmap")] +pub struct Errmap { + /// The prefix that all error reasons within modules will be prefixed with, e.g., "E" if + /// all error reasons are "E_CANNOT_PERFORM_OPERATION", "E_CANNOT_ACCESS", etc. + #[clap(long)] + error_prefix: Option, + /// The file to serialize the generated error map to. + #[clap(long, default_value = "error_map", parse(from_os_str))] + output_file: PathBuf, +} + +impl Errmap { + pub fn execute(self, path: &Path, config: BuildConfig) -> anyhow::Result<()> { + let rerooted_path = reroot_path(path)?; + let Self { + error_prefix, + output_file, + } = self; + let mut errmap_options = move_errmapgen::ErrmapOptions::default(); + if let Some(err_prefix) = error_prefix { + errmap_options.error_prefix = err_prefix; + } + errmap_options.output_file = output_file + .with_extension(move_command_line_common::files::MOVE_ERROR_DESC_EXTENSION) + .to_string_lossy() + .to_string(); + let model = config.move_model_for_package( + &rerooted_path, + ModelConfig { + all_files_as_targets: true, + target_filter: None, + }, + )?; + let mut errmap_gen = move_errmapgen::ErrmapGen::new(&model, &errmap_options); + errmap_gen.gen(); + errmap_gen.save_result(); + Ok(()) + } +} diff --git a/language/tools/move-cli/src/base/info.rs b/language/tools/move-cli/src/base/info.rs new file mode 100644 index 0000000000..da40f9623a --- /dev/null +++ b/language/tools/move-cli/src/base/info.rs @@ -0,0 +1,21 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +use super::reroot_path; +use clap::*; +use move_package::BuildConfig; +use std::path::Path; + +/// Print address information. +#[derive(Parser)] +#[clap(name = "info")] +pub struct Info; + +impl Info { + pub fn execute(self, path: &Path, config: BuildConfig) -> anyhow::Result<()> { + let rerooted_path = reroot_path(path)?; + config + .resolution_graph_for_package(&rerooted_path)? + .print_info() + } +} diff --git a/language/tools/move-cli/src/base/mod.rs b/language/tools/move-cli/src/base/mod.rs index b5c92db601..07c75cae87 100644 --- a/language/tools/move-cli/src/base/mod.rs +++ b/language/tools/move-cli/src/base/mod.rs @@ -1,5 +1,22 @@ -// Copyright (c) The Diem Core Contributors // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -pub mod commands; +pub mod build; +pub mod coverage; +pub mod disassemble; +pub mod errmap; +pub mod info; +pub mod new; +pub mod prove; +pub mod test; + +use move_package::source_package::layout::SourcePackageLayout; +use std::path::{Path, PathBuf}; + +pub fn reroot_path(path: &Path) -> anyhow::Result { + // Always root ourselves to the package root, and then compile relative to that. + let rooted_path = SourcePackageLayout::try_find_root(&path.canonicalize()?)?; + std::env::set_current_dir(&rooted_path).unwrap(); + + Ok(PathBuf::from(".")) +} diff --git a/language/tools/move-cli/src/base/new.rs b/language/tools/move-cli/src/base/new.rs new file mode 100644 index 0000000000..485f87c4ec --- /dev/null +++ b/language/tools/move-cli/src/base/new.rs @@ -0,0 +1,71 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +use clap::*; +use move_package::source_package::layout::SourcePackageLayout; +use std::{fmt::Display, fs::create_dir_all, io::Write, path::Path}; + +pub const MOVE_STDLIB_PACKAGE_NAME: &str = "MoveStdlib"; +pub const MOVE_STDLIB_PACKAGE_PATH: &str = "{ \ + git = \"https://github.com/move-language/move.git\", \ + subdir = \"language/move-stdlib\", rev = \"main\" \ +}"; +pub const MOVE_STDLIB_ADDR_NAME: &str = "std"; +pub const MOVE_STDLIB_ADDR_VALUE: &str = "0x1"; + +/// Create a new Move package with name `name` at `path`. If `path` is not provided the package +/// will be created in the directory `name`. +#[derive(Parser)] +#[clap(name = "new")] +pub struct New { + /// The name of the package to be created. + name: String, +} + +impl New { + pub fn execute_with_defaults(self, path: &Path) -> anyhow::Result<()> { + self.execute( + path, + "0.0.0", + [(MOVE_STDLIB_PACKAGE_NAME, MOVE_STDLIB_PACKAGE_PATH)], + [(MOVE_STDLIB_ADDR_NAME, MOVE_STDLIB_ADDR_VALUE)], + ) + } + + pub fn execute( + self, + path: &Path, + version: &str, + deps: impl IntoIterator, + addrs: impl IntoIterator, + ) -> anyhow::Result<()> { + // TODO warn on build config flags + let Self { name } = self; + create_dir_all(path.join(SourcePackageLayout::Sources.path()))?; + let mut w = std::fs::File::create(path.join(SourcePackageLayout::Manifest.path()))?; + writeln!( + &mut w, + "[package] + name = \"{name}\" + version = \"{version}\" + + [dependencies] + " + )?; + for (dep_name, dep_val) in deps { + writeln!(w, "{dep_name} = {dep_val}")?; + } + + writeln!( + w, + " + + [addresses] + " + )?; + for (addr_name, addr_val) in addrs { + writeln!(w, "{addr_name} = \"{addr_val}\"")?; + } + Ok(()) + } +} diff --git a/language/tools/move-cli/src/package/prover.rs b/language/tools/move-cli/src/base/prove.rs similarity index 77% rename from language/tools/move-cli/src/package/prover.rs rename to language/tools/move-cli/src/base/prove.rs index e6a37aae79..ce44393251 100644 --- a/language/tools/move-cli/src/package/prover.rs +++ b/language/tools/move-cli/src/base/prove.rs @@ -1,11 +1,9 @@ -// Copyright (c) The Diem Core Contributors // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -//! Support for the prover in the package system. - -use crate::package::cli; +use super::reroot_path; use anyhow::bail; +use clap::Parser; use codespan_reporting::term::termcolor::{ColorChoice, StandardStream}; use colored::Colorize; use move_package::{BuildConfig, ModelConfig}; @@ -17,6 +15,51 @@ use std::{ }; use tempfile::TempDir; +#[derive(Parser, Debug)] +pub enum ProverOptions { + // Pass through unknown commands to the prover Clap parser + #[clap( + external_subcommand, + takes_value(true), + multiple_values(true), + multiple_occurrences(true) + )] + Options(Vec), +} + +/// Run the Move Prover on the package at `path`. If no path is provided defaults to current +/// directory. Use `.. prove .. -- ` to pass on options to the prover. +#[derive(Parser)] +#[clap(name = "prove")] +pub struct Prove { + /// The target filter used to prune the modules to verify. Modules with a name that contains + /// this string will be part of verification. + #[clap(short = 't', long = "target")] + target_filter: Option, + /// Internal field indicating that this prover run is for a test. + #[clap(skip)] + for_test: bool, + /// Any options passed to the prover. + #[clap(subcommand)] + options: Option, +} + +impl Prove { + pub fn execute(self, path: &Path, config: BuildConfig) -> anyhow::Result<()> { + let rerooted_path = reroot_path(path)?; + let Self { + target_filter, + for_test, + options, + } = self; + let opts = match options { + Some(ProverOptions::Options(opts)) => opts, + _ => vec![], + }; + run_move_prover(config, &rerooted_path, &target_filter, for_test, &opts) + } +} + // ================================================================================================= // API for Rust unit tests @@ -66,18 +109,12 @@ impl ProverTest { // parallelize package based tests. let saved_cd = std::env::current_dir().expect("current directory"); let pkg_path = path_in_crate(std::mem::take(&mut self.path)); - let res = cli::handle_package_commands( - &pkg_path, - move_package::BuildConfig::default(), - &cli::PackageCommand::Prove { - target_filter: None, - for_test: true, - options: Some(cli::ProverOptions::Options(std::mem::take( - &mut self.options, - ))), - }, - vec![], // prover does not need natives - ); + let cmd = Prove { + target_filter: None, + for_test: true, + options: Some(ProverOptions::Options(std::mem::take(&mut self.options))), + }; + let res = cmd.execute(&pkg_path, move_package::BuildConfig::default()); std::env::set_current_dir(saved_cd).expect("restore current directory"); res.unwrap() } diff --git a/language/tools/move-cli/src/base/test.rs b/language/tools/move-cli/src/base/test.rs new file mode 100644 index 0000000000..30dd3092c6 --- /dev/null +++ b/language/tools/move-cli/src/base/test.rs @@ -0,0 +1,256 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +use super::reroot_path; +use crate::NativeFunctionRecord; +use anyhow::Result; +use clap::*; +use move_command_line_common::files::{FileHash, MOVE_COVERAGE_MAP_EXTENSION}; +use move_compiler::{ + diagnostics::{self, codes::Severity}, + shared::{NumberFormat, NumericalAddress}, + unit_test::{plan_builder::construct_test_plan, TestPlan}, + PASS_CFGIR, +}; +use move_coverage::coverage_map::{output_map_to_file, CoverageMap}; +use move_package::{compilation::build_plan::BuildPlan, BuildConfig}; +use move_unit_test::UnitTestingConfig; +use std::{collections::HashMap, fs, path::Path, process::ExitStatus}; +// if windows +#[cfg(target_family = "windows")] +use std::os::windows::process::ExitStatusExt; +// if unix +#[cfg(any(target_family = "unix"))] +use std::os::unix::prelude::ExitStatusExt; +// if not windows nor unix +#[cfg(not(any(target_family = "windows", target_family = "unix")))] +compile_error!("Unsupported OS, currently we only support windows and unix family"); + +/// Run Move unit tests in this package. +#[derive(Parser)] +#[clap(name = "test")] +pub struct Test { + /// Bound the number of instructions that can be executed by any one test. + #[clap( + name = "instructions", + default_value = "5000", + short = 'i', + long = "instructions" + )] + instruction_execution_bound: u64, + /// A filter string to determine which unit tests to run. A unit test will be run only if it + /// contains this string in its fully qualified (::::) name. + #[clap(name = "filter", short = 'f', long = "filter")] + filter: Option, + /// List all tests + #[clap(name = "list", short = 'l', long = "list")] + list: bool, + /// Number of threads to use for running tests. + #[clap( + name = "num_threads", + default_value = "8", + short = 't', + long = "threads" + )] + num_threads: usize, + /// Report test statistics at the end of testing + #[clap(name = "report_statistics", short = 's', long = "statistics")] + report_statistics: bool, + /// Show the storage state at the end of execution of a failing test + #[clap(name = "global_state_on_error", short = 'g', long = "state_on_error")] + report_storage_on_error: bool, + /// Use the stackless bytecode interpreter to run the tests and cross check its results with + /// the execution result from Move VM. + #[clap(long = "stackless")] + check_stackless_vm: bool, + /// Verbose mode + #[clap(long = "verbose")] + verbose_mode: bool, + /// Collect coverage information for later use with the various `package coverage` subcommands + #[clap(long = "coverage")] + compute_coverage: bool, + + /// Use the EVM-based execution backend. + /// Does not work with --stackless. + #[cfg(feature = "evm-backend")] + #[structopt(long = "evm")] + evm: bool, +} + +impl Test { + pub fn execute( + self, + path: &Path, + config: BuildConfig, + natives: Vec, + ) -> anyhow::Result<()> { + let rerooted_path = reroot_path(path)?; + let Self { + instruction_execution_bound, + filter, + list, + num_threads, + report_statistics, + report_storage_on_error, + check_stackless_vm, + verbose_mode, + compute_coverage, + #[cfg(feature = "evm-backend")] + evm, + } = self; + let unit_test_config = UnitTestingConfig { + instruction_execution_bound, + filter, + list, + num_threads, + report_statistics, + report_storage_on_error, + check_stackless_vm, + verbose: verbose_mode, + + #[cfg(feature = "evm-backend")] + evm, + + ..UnitTestingConfig::default_with_bound(None) + }; + let result = run_move_unit_tests( + &rerooted_path, + config, + unit_test_config, + natives, + compute_coverage, + )?; + + // Return a non-zero exit code if any test failed + if let UnitTestResult::Failure = result { + std::process::exit(1) + } + Ok(()) + } +} + +/// Encapsulates the possible returned states when running unit tests on a move package. +#[derive(PartialEq, Debug)] +pub enum UnitTestResult { + Success, + Failure, +} + +pub fn run_move_unit_tests( + pkg_path: &Path, + mut build_config: move_package::BuildConfig, + mut unit_test_config: UnitTestingConfig, + natives: Vec, + compute_coverage: bool, +) -> Result { + let mut test_plan = None; + build_config.test_mode = true; + build_config.dev_mode = true; + + // Build the resolution graph + let resolution_graph = build_config.resolution_graph_for_package(pkg_path)?; + + // Note: unit_test_config.named_address_values is always set to vec![] (the default value) before + // being passed in. + unit_test_config.named_address_values = resolution_graph + .extract_named_address_mapping() + .map(|(name, addr)| { + ( + name.to_string(), + NumericalAddress::new(addr.into_bytes(), NumberFormat::Hex), + ) + }) + .collect(); + + // Get the source files for all modules. We need this in order to report source-mapped error + // messages. + let dep_file_map: HashMap<_, _> = resolution_graph + .package_table + .iter() + .flat_map(|(_, rpkg)| { + rpkg.get_sources(&resolution_graph.build_options) + .unwrap() + .iter() + .map(|fname| { + let contents = fs::read_to_string(Path::new(fname.as_str())).unwrap(); + let fhash = FileHash::new(&contents); + (fhash, (*fname, contents)) + }) + .collect::>() + }) + .collect(); + let root_package = resolution_graph.root_package.package.name; + let build_plan = BuildPlan::create(resolution_graph)?; + // Compile the package. We need to intercede in the compilation, process being performed by the + // 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(&mut std::io::stdout(), |compiler| { + let (files, comments_and_compiler_res) = compiler.run::().unwrap(); + let (_, compiler) = + diagnostics::unwrap_or_report_diagnostics(&files, comments_and_compiler_res); + let (mut compiler, cfgir) = compiler.into_ast(); + let compilation_env = compiler.compilation_env(); + let built_test_plan = construct_test_plan(compilation_env, Some(root_package), &cfgir); + if let Err(diags) = compilation_env.check_diags_at_or_above_severity(Severity::Warning) { + diagnostics::report_diagnostics(&files, diags); + } + + let compilation_result = compiler.at_cfgir(cfgir).build(); + + let (units, _) = diagnostics::unwrap_or_report_diagnostics(&files, compilation_result); + test_plan = Some((built_test_plan, files.clone(), units.clone())); + Ok((files, units)) + })?; + + let (test_plan, mut files, units) = test_plan.unwrap(); + files.extend(dep_file_map); + let test_plan = test_plan.unwrap(); + let no_tests = test_plan.is_empty(); + let test_plan = TestPlan::new(test_plan, files, units); + + let trace_path = pkg_path.join(".trace"); + let coverage_map_path = pkg_path + .join(".coverage_map") + .with_extension(MOVE_COVERAGE_MAP_EXTENSION); + let cleanup_trace = || { + if compute_coverage && trace_path.exists() { + std::fs::remove_file(&trace_path).unwrap(); + } + }; + + cleanup_trace(); + + // If we need to compute test coverage set the VM tracking environment variable since we will + // need this trace to construct the coverage information. + if compute_coverage { + std::env::set_var("MOVE_VM_TRACE", &trace_path); + } + + // Run the tests. If any of the tests fail, then we don't produce a coverage report, so cleanup + // the trace files. + if !unit_test_config + .run_and_report_unit_tests(test_plan, Some(natives), std::io::stdout()) + .unwrap() + .1 + { + cleanup_trace(); + return Ok(UnitTestResult::Failure); + } + + // Compute the coverage map. This will be used by other commands after this. + if compute_coverage && !no_tests { + let coverage_map = CoverageMap::from_trace_file(trace_path); + output_map_to_file(&coverage_map_path, &coverage_map).unwrap(); + } + Ok(UnitTestResult::Success) +} + +impl From for ExitStatus { + fn from(result: UnitTestResult) -> Self { + match result { + UnitTestResult::Success => ExitStatus::from_raw(0), + UnitTestResult::Failure => ExitStatus::from_raw(1), + } + } +} diff --git a/language/tools/move-cli/src/lib.rs b/language/tools/move-cli/src/lib.rs index aa7e3ae45d..c4619d522b 100644 --- a/language/tools/move-cli/src/lib.rs +++ b/language/tools/move-cli/src/lib.rs @@ -2,11 +2,14 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 +use base::{ + build::Build, coverage::Coverage, disassemble::Disassemble, errmap::Errmap, info::Info, + new::New, prove::Prove, test::Test, +}; use move_package::BuildConfig; pub mod base; pub mod experimental; -pub mod package; pub mod sandbox; /// Default directory where saved Move resources live @@ -63,15 +66,19 @@ pub struct MoveCLI { cmd: Command, } +#[derive(Parser)] +pub enum Base {} + #[derive(Parser)] pub enum Command { - /// Execute a package command. Executed in the current directory or the closest containing Move - /// package. - #[clap(name = "package")] - Package { - #[clap(subcommand)] - cmd: package::cli::PackageCommand, - }, + Build(Build), + Coverage(Coverage), + Disassemble(Disassemble), + Errmap(Errmap), + Info(Info), + New(New), + Prove(Prove), + Test(Test), /// Execute a sandbox command. #[clap(name = "sandbox")] Sandbox { @@ -98,24 +105,26 @@ pub fn run_cli( natives: Vec, cost_table: &CostTable, error_descriptions: &ErrorMapping, - move_args: &Move, - cmd: &Command, + move_args: Move, + cmd: Command, ) -> Result<()> { match cmd { + Command::Build(c) => c.execute(&move_args.package_path, move_args.build_config), + Command::Coverage(c) => c.execute(&move_args.package_path, move_args.build_config), + Command::Disassemble(c) => c.execute(&move_args.package_path, move_args.build_config), + Command::Errmap(c) => c.execute(&move_args.package_path, move_args.build_config), + Command::Info(c) => c.execute(&move_args.package_path, move_args.build_config), + Command::New(c) => c.execute_with_defaults(&move_args.package_path), + Command::Prove(c) => c.execute(&move_args.package_path, move_args.build_config), + Command::Test(c) => c.execute(&move_args.package_path, move_args.build_config, natives), Command::Sandbox { storage_dir, cmd } => cmd.handle_command( natives, cost_table, error_descriptions, - move_args, - storage_dir, - ), - Command::Experimental { storage_dir, cmd } => cmd.handle_command(move_args, storage_dir), - Command::Package { cmd } => package::cli::handle_package_commands( - &move_args.package_path, - move_args.build_config.clone(), - cmd, - natives, + &move_args, + &storage_dir, ), + Command::Experimental { storage_dir, cmd } => cmd.handle_command(&move_args, &storage_dir), } } @@ -129,7 +138,7 @@ pub fn move_cli( natives, cost_table, error_descriptions, - &args.move_args, - &args.cmd, + args.move_args, + args.cmd, ) } diff --git a/language/tools/move-cli/src/package/cli.rs b/language/tools/move-cli/src/package/cli.rs deleted file mode 100644 index 4ab354a175..0000000000 --- a/language/tools/move-cli/src/package/cli.rs +++ /dev/null @@ -1,594 +0,0 @@ -// Copyright (c) The Diem Core Contributors -// Copyright (c) The Move Contributors -// SPDX-License-Identifier: Apache-2.0 - -use std::{ - collections::HashMap, - fs::{create_dir_all, read_to_string}, - io::Write, - path::{Path, PathBuf}, - process::ExitStatus, -}; - -// if windows -#[cfg(target_family = "windows")] -use std::os::windows::process::ExitStatusExt; -// if unix -#[cfg(any(target_family = "unix"))] -use std::os::unix::prelude::ExitStatusExt; -// if not windows nor unix -#[cfg(not(any(target_family = "windows", target_family = "unix")))] -compile_error!("Unsupported OS, currently we only support windows and unix family"); - -use anyhow::{bail, Result}; - -use clap::Parser; -use move_command_line_common::files::{FileHash, MOVE_COVERAGE_MAP_EXTENSION}; -use move_compiler::{ - compiled_unit::{CompiledUnit, NamedCompiledModule}, - diagnostics::{self, codes::Severity}, - shared::{NumberFormat, NumericalAddress}, - unit_test::{plan_builder::construct_test_plan, TestPlan}, - PASS_CFGIR, -}; -use move_coverage::{ - coverage_map::{output_map_to_file, CoverageMap}, - format_csv_summary, format_human_summary, - source_coverage::SourceCoverageBuilder, - summary::summarize_inst_cov, -}; -use move_disassembler::disassembler::Disassembler; -use move_package::{ - compilation::{build_plan::BuildPlan, compiled_package::CompiledUnitWithSource}, - source_package::layout::SourcePackageLayout, - Architecture, ModelConfig, -}; -use move_unit_test::UnitTestingConfig; - -use crate::{package::prover::run_move_prover, NativeFunctionRecord}; - -#[derive(Parser)] -pub enum CoverageSummaryOptions { - /// Display a coverage summary for all modules in this package - #[clap(name = "summary")] - Summary { - /// Whether function coverage summaries should be displayed - #[clap(long = "summarize-functions")] - functions: bool, - /// Output CSV data of coverage - #[clap(long = "csv")] - output_csv: bool, - }, - /// Display coverage information about the module against source code - #[clap(name = "source")] - Source { - #[clap(long = "module")] - module_name: String, - }, - /// Display coverage information about the module against disassembled bytecode - #[clap(name = "bytecode")] - Bytecode { - #[clap(long = "module")] - module_name: String, - }, -} - -#[derive(Parser)] -pub enum PackageCommand { - /// Create a new Move package with name `name` at `path`. If `path` is not provided the package - /// will be created in the directory `name`. - #[clap(name = "new")] - New { - /// The name of the package to be created. - name: String, - }, - /// Build the package at `path`. If no path is provided defaults to current directory. - #[clap(name = "build")] - Build, - /// Print address information. - #[clap(name = "info")] - Info, - /// Generate error map for the package and its dependencies at `path` for use by the Move - /// explanation tool. - #[clap(name = "errmap")] - ErrMapGen { - /// The prefix that all error reasons within modules will be prefixed with, e.g., "E" if - /// all error reasons are "E_CANNOT_PERFORM_OPERATION", "E_CANNOT_ACCESS", etc. - #[clap(long)] - error_prefix: Option, - /// The file to serialize the generated error map to. - #[clap(long, default_value = "error_map", parse(from_os_str))] - output_file: PathBuf, - }, - /// Run the Move Prover on the package at `path`. If no path is provided defaults to current - /// directory. Use `.. prove .. -- ` to pass on options to the prover. - #[clap(name = "prove")] - Prove { - /// The target filter used to prune the modules to verify. Modules with a name that contains - /// this string will be part of verification. - #[clap(short = 't', long = "target")] - target_filter: Option, - /// Internal field indicating that this prover run is for a test. - #[clap(skip)] - for_test: bool, - /// Any options passed to the prover. - #[clap(subcommand)] - options: Option, - }, - /// Inspect test coverage for this package. A previous test run with the `--coverage` flag must - /// have previously been run. - #[clap(name = "coverage")] - CoverageReport { - #[clap(subcommand)] - options: CoverageSummaryOptions, - }, - /// Run Move unit tests in this package. - #[clap(name = "test")] - UnitTest { - /// Bound the number of instructions that can be executed by any one test. - #[clap( - name = "instructions", - default_value = "5000", - short = 'i', - long = "instructions" - )] - instruction_execution_bound: u64, - /// A filter string to determine which unit tests to run. A unit test will be run only if it - /// contains this string in its fully qualified (::::) name. - #[clap(name = "filter", short = 'f', long = "filter")] - filter: Option, - /// List all tests - #[clap(name = "list", short = 'l', long = "list")] - list: bool, - /// Number of threads to use for running tests. - #[clap( - name = "num_threads", - default_value = "8", - short = 't', - long = "threads" - )] - num_threads: usize, - /// Report test statistics at the end of testing - #[clap(name = "report_statistics", short = 's', long = "statistics")] - report_statistics: bool, - /// Show the storage state at the end of execution of a failing test - #[clap(name = "global_state_on_error", short = 'g', long = "state_on_error")] - report_storage_on_error: bool, - /// Use the stackless bytecode interpreter to run the tests and cross check its results with - /// the execution result from Move VM. - #[clap(long = "stackless")] - check_stackless_vm: bool, - /// Verbose mode - #[clap(long = "verbose")] - verbose_mode: bool, - /// Collect coverage information for later use with the various `package coverage` subcommands - #[clap(long = "coverage")] - compute_coverage: bool, - - /// Use the EVM-based execution backend. - /// Does not work with --stackless. - #[cfg(feature = "evm-backend")] - #[structopt(long = "evm")] - evm: bool, - }, - /// Disassemble the Move bytecode pointed to - #[clap(name = "disassemble")] - BytecodeView { - /// Start a disassembled bytecode-to-source explorer - #[clap(long = "interactive")] - interactive: bool, - /// The package name. If not provided defaults to current package modules only - #[clap(long = "package")] - package_name: Option, - /// The name of the module or script in the package to disassemble - #[clap(long = "name")] - module_or_script_name: String, - }, -} - -#[derive(Parser, Debug)] -pub enum ProverOptions { - // Pass through unknown commands to the prover Clap parser - #[clap( - external_subcommand, - takes_value(true), - multiple_values(true), - multiple_occurrences(true) - )] - Options(Vec), -} - -/// Encapsulates the possible returned states when running unit tests on a move package. -#[derive(PartialEq, Debug)] -pub enum UnitTestResult { - Success, - Failure, -} - -impl From for ExitStatus { - fn from(result: UnitTestResult) -> Self { - match result { - UnitTestResult::Success => ExitStatus::from_raw(0), - UnitTestResult::Failure => ExitStatus::from_raw(1), - } - } -} - -impl CoverageSummaryOptions { - pub fn handle_command(&self, config: move_package::BuildConfig, path: &Path) -> Result<()> { - let coverage_map = CoverageMap::from_binary_file(path.join(".coverage_map.mvcov"))?; - let package = config.compile_package(path, &mut Vec::new())?; - let modules: Vec<_> = package - .root_modules() - .filter_map(|unit| match &unit.unit { - CompiledUnit::Module(NamedCompiledModule { module, .. }) => Some(module.clone()), - _ => None, - }) - .collect(); - match self { - CoverageSummaryOptions::Source { module_name } => { - let unit = package.get_module_by_name_from_root(module_name)?; - let source_path = &unit.source_path; - let (module, source_map) = match &unit.unit { - CompiledUnit::Module(NamedCompiledModule { - module, source_map, .. - }) => (module, source_map), - _ => panic!("Should all be modules"), - }; - let source_coverage = SourceCoverageBuilder::new(module, &coverage_map, source_map); - source_coverage - .compute_source_coverage(source_path) - .output_source_coverage(&mut std::io::stdout()) - .unwrap(); - } - CoverageSummaryOptions::Summary { - functions, - output_csv, - .. - } => { - let coverage_map = coverage_map.to_unified_exec_map(); - if *output_csv { - format_csv_summary( - modules.as_slice(), - &coverage_map, - summarize_inst_cov, - &mut std::io::stdout(), - ) - } else { - format_human_summary( - modules.as_slice(), - &coverage_map, - summarize_inst_cov, - &mut std::io::stdout(), - *functions, - ) - } - } - CoverageSummaryOptions::Bytecode { module_name } => { - let unit = package.get_module_by_name_from_root(module_name)?; - let mut disassembler = Disassembler::from_unit(&unit.unit); - disassembler.add_coverage_map(coverage_map.to_unified_exec_map()); - println!("{}", disassembler.disassemble()?); - } - } - Ok(()) - } -} - -pub fn handle_package_commands( - path: &Path, - config: move_package::BuildConfig, - cmd: &PackageCommand, - natives: Vec, -) -> Result<()> { - // This is the exceptional command as it doesn't need a package to run, so we can't count on - // being able to root ourselves. - if let PackageCommand::New { name } = cmd { - create_move_package(path, - name, - "0.0.0", - "MoveStdlib", - "{ git = \"https://github.com/move-language/move.git\", subdir = \"language/move-stdlib\", rev = \"main\" }", - "std", - "0x1")?; - return Ok(()); - } - - // Always root ourselves to the package root, and then compile relative to that. - let rooted_path = SourcePackageLayout::try_find_root(&path.canonicalize()?)?; - std::env::set_current_dir(&rooted_path).unwrap(); - - let rerooted_path = PathBuf::from("."); - - match cmd { - PackageCommand::Build => { - let architecture = config.architecture.unwrap_or(Architecture::Move); - - match architecture { - Architecture::Move | Architecture::AsyncMove => { - config.compile_package(&rerooted_path, &mut std::io::stderr())?; - } - - Architecture::Ethereum => { - #[cfg(feature = "evm-backend")] - config.compile_package_evm(&rerooted_path, &mut std::io::stderr())?; - - #[cfg(not(feature = "evm-backend"))] - bail!("The Ethereum architecture is not supported because move-cli was not compiled with feature flag `evm-backend`."); - } - } - } - PackageCommand::Info => { - config - .resolution_graph_for_package(&rerooted_path)? - .print_info()?; - } - PackageCommand::BytecodeView { - interactive, - package_name, - module_or_script_name, - } => { - // Make sure the package is built - let package = config.compile_package(&rerooted_path, &mut Vec::new())?; - let needle_package = package_name - .as_ref() - .map(|s| s.as_str()) - .unwrap_or(package.compiled_package_info.package_name.as_str()); - match package - .get_module_by_name(needle_package, module_or_script_name) - .ok() - { - None => bail!( - "Unable to find module or script with name '{}' in package '{}'", - module_or_script_name, - needle_package, - ), - Some(unit) => { - // Once we find the compiled bytecode we're interested in, startup the bytecode - // viewer, or run the disassembler depending on if we need to run interactively - // or not. - if *interactive { - match unit { - CompiledUnitWithSource { - unit: - CompiledUnit::Module(NamedCompiledModule { - module, source_map, .. - }), - source_path, - } => move_bytecode_viewer::start_viewer_in_memory( - module.clone(), - source_map.clone(), - source_path, - ), - _ => bail!("Interactive disassembler not supported for scripts"), - } - } else { - println!("{}", Disassembler::from_unit(&unit.unit).disassemble()?); - } - } - } - } - PackageCommand::Prove { - target_filter, - for_test, - options, - } => { - if let Some(ProverOptions::Options(opts)) = options { - run_move_prover(config, &rerooted_path, target_filter, *for_test, opts)? - } else { - run_move_prover(config, &rerooted_path, target_filter, *for_test, &[])? - } - } - PackageCommand::ErrMapGen { - error_prefix, - output_file, - } => { - let mut errmap_options = move_errmapgen::ErrmapOptions::default(); - if let Some(err_prefix) = error_prefix { - errmap_options.error_prefix = err_prefix.to_string(); - } - errmap_options.output_file = output_file - .with_extension(move_command_line_common::files::MOVE_ERROR_DESC_EXTENSION) - .to_string_lossy() - .to_string(); - let model = config.move_model_for_package( - &rerooted_path, - ModelConfig { - all_files_as_targets: true, - target_filter: None, - }, - )?; - let mut errmap_gen = move_errmapgen::ErrmapGen::new(&model, &errmap_options); - errmap_gen.gen(); - errmap_gen.save_result(); - } - PackageCommand::UnitTest { - instruction_execution_bound, - filter, - list, - num_threads, - report_statistics, - report_storage_on_error, - check_stackless_vm, - verbose_mode, - compute_coverage, - - #[cfg(feature = "evm-backend")] - evm, - } => { - let unit_test_config = UnitTestingConfig { - instruction_execution_bound: *instruction_execution_bound, - filter: filter.clone(), - list: *list, - num_threads: *num_threads, - report_statistics: *report_statistics, - report_storage_on_error: *report_storage_on_error, - check_stackless_vm: *check_stackless_vm, - verbose: *verbose_mode, - - #[cfg(feature = "evm-backend")] - evm: *evm, - - ..UnitTestingConfig::default_with_bound(None) - }; - let result = run_move_unit_tests( - &rerooted_path, - config, - unit_test_config, - natives, - *compute_coverage, - )?; - - // Return a non-zero exit code if any test failed - if let UnitTestResult::Failure = result { - std::process::exit(1) - } - } - PackageCommand::CoverageReport { options } => { - options.handle_command(config, &rerooted_path)?; - } - PackageCommand::New { .. } => { - panic!("Hit a package new command after it should have been handled -- this should never happen") - } - }; - Ok(()) -} - -pub fn run_move_unit_tests( - pkg_path: &Path, - mut build_config: move_package::BuildConfig, - mut unit_test_config: UnitTestingConfig, - natives: Vec, - compute_coverage: bool, -) -> Result { - let mut test_plan = None; - build_config.test_mode = true; - build_config.dev_mode = true; - - // Build the resolution graph - let resolution_graph = build_config.resolution_graph_for_package(pkg_path)?; - - // Note: unit_test_config.named_address_values is always set to vec![] (the default value) before - // being passed in. - unit_test_config.named_address_values = resolution_graph - .extract_named_address_mapping() - .map(|(name, addr)| { - ( - name.to_string(), - NumericalAddress::new(addr.into_bytes(), NumberFormat::Hex), - ) - }) - .collect(); - - // Get the source files for all modules. We need this in order to report source-mapped error - // messages. - let dep_file_map: HashMap<_, _> = resolution_graph - .package_table - .iter() - .flat_map(|(_, rpkg)| { - rpkg.get_sources(&resolution_graph.build_options) - .unwrap() - .iter() - .map(|fname| { - let contents = read_to_string(Path::new(fname.as_str())).unwrap(); - let fhash = FileHash::new(&contents); - (fhash, (*fname, contents)) - }) - .collect::>() - }) - .collect(); - let root_package = resolution_graph.root_package.package.name; - let build_plan = BuildPlan::create(resolution_graph)?; - // Compile the package. We need to intercede in the compilation, process being performed by the - // 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(&mut std::io::stdout(), |compiler| { - let (files, comments_and_compiler_res) = compiler.run::().unwrap(); - let (_, compiler) = - diagnostics::unwrap_or_report_diagnostics(&files, comments_and_compiler_res); - let (mut compiler, cfgir) = compiler.into_ast(); - let compilation_env = compiler.compilation_env(); - let built_test_plan = construct_test_plan(compilation_env, Some(root_package), &cfgir); - if let Err(diags) = compilation_env.check_diags_at_or_above_severity(Severity::Warning) { - diagnostics::report_diagnostics(&files, diags); - } - - let compilation_result = compiler.at_cfgir(cfgir).build(); - - let (units, _) = diagnostics::unwrap_or_report_diagnostics(&files, compilation_result); - test_plan = Some((built_test_plan, files.clone(), units.clone())); - Ok((files, units)) - })?; - - let (test_plan, mut files, units) = test_plan.unwrap(); - files.extend(dep_file_map); - let test_plan = test_plan.unwrap(); - let no_tests = test_plan.is_empty(); - let test_plan = TestPlan::new(test_plan, files, units); - - let trace_path = pkg_path.join(".trace"); - let coverage_map_path = pkg_path - .join(".coverage_map") - .with_extension(MOVE_COVERAGE_MAP_EXTENSION); - let cleanup_trace = || { - if compute_coverage && trace_path.exists() { - std::fs::remove_file(&trace_path).unwrap(); - } - }; - - cleanup_trace(); - - // If we need to compute test coverage set the VM tracking environment variable since we will - // need this trace to construct the coverage information. - if compute_coverage { - std::env::set_var("MOVE_VM_TRACE", &trace_path); - } - - // Run the tests. If any of the tests fail, then we don't produce a coverage report, so cleanup - // the trace files. - if !unit_test_config - .run_and_report_unit_tests(test_plan, Some(natives), std::io::stdout()) - .unwrap() - .1 - { - cleanup_trace(); - return Ok(UnitTestResult::Failure); - } - - // Compute the coverage map. This will be used by other commands after this. - if compute_coverage && !no_tests { - let coverage_map = CoverageMap::from_trace_file(trace_path); - output_map_to_file(&coverage_map_path, &coverage_map).unwrap(); - } - Ok(UnitTestResult::Success) -} - -pub fn create_move_package( - path: &Path, - name: &String, - version: &str, - dep_name: &str, - dep_val: &str, - addr_name: &str, - addr_val: &str, -) -> Result<()> { - let creation_path = Path::new(path).join(name); - create_dir_all(creation_path.join(SourcePackageLayout::Sources.path()))?; - let mut w = std::fs::File::create(creation_path.join(SourcePackageLayout::Manifest.path()))?; - writeln!( - &mut w, - "[package] -name = \"{}\" -version = \"{}\" - -[dependencies] -{} = {} - -[addresses] -{} = \"{}\" -", - name, version, dep_name, dep_val, addr_name, addr_val - )?; - Ok(()) -} diff --git a/language/tools/move-cli/src/package/mod.rs b/language/tools/move-cli/src/package/mod.rs deleted file mode 100644 index d2e24bf0b4..0000000000 --- a/language/tools/move-cli/src/package/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) The Diem Core Contributors -// Copyright (c) The Move Contributors -// SPDX-License-Identifier: Apache-2.0 - -pub mod cli; -pub mod prover; diff --git a/language/tools/move-cli/tests/build_tests/circular_dependencies/args.evm.exp b/language/tools/move-cli/tests/build_tests/circular_dependencies/args.evm.exp index e54c5429a1..a8ab51117c 100644 --- a/language/tools/move-cli/tests/build_tests/circular_dependencies/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/circular_dependencies/args.evm.exp @@ -1,4 +1,4 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: Error: Unable to resolve packages for package 'Foo' Caused by: diff --git a/language/tools/move-cli/tests/build_tests/circular_dependencies/args.evm.txt b/language/tools/move-cli/tests/build_tests/circular_dependencies/args.evm.txt index a57b42cc66..a8c353d3ef 100644 --- a/language/tools/move-cli/tests/build_tests/circular_dependencies/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/circular_dependencies/args.evm.txt @@ -1 +1 @@ -package build -v --arch ethereum +build -v --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/circular_dependencies/args.exp b/language/tools/move-cli/tests/build_tests/circular_dependencies/args.exp index 284d22c11b..2d5025aea7 100644 --- a/language/tools/move-cli/tests/build_tests/circular_dependencies/args.exp +++ b/language/tools/move-cli/tests/build_tests/circular_dependencies/args.exp @@ -1,4 +1,4 @@ -Command `package build -v`: +Command `build -v`: Error: Unable to resolve packages for package 'Foo' Caused by: diff --git a/language/tools/move-cli/tests/build_tests/circular_dependencies/args.txt b/language/tools/move-cli/tests/build_tests/circular_dependencies/args.txt index 8e772362b2..cc4865c0fe 100644 --- a/language/tools/move-cli/tests/build_tests/circular_dependencies/args.txt +++ b/language/tools/move-cli/tests/build_tests/circular_dependencies/args.txt @@ -1 +1 @@ -package build -v +build -v diff --git a/language/tools/move-cli/tests/build_tests/dependency_chain/args.evm.exp b/language/tools/move-cli/tests/build_tests/dependency_chain/args.evm.exp index ae4f762254..65c4757ca0 100644 --- a/language/tools/move-cli/tests/build_tests/dependency_chain/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/dependency_chain/args.evm.exp @@ -1,3 +1,3 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING A, Bar, Foo to Yul GENERATING EVM bytecote from Yul diff --git a/language/tools/move-cli/tests/build_tests/dependency_chain/args.evm.txt b/language/tools/move-cli/tests/build_tests/dependency_chain/args.evm.txt index a57b42cc66..a8c353d3ef 100644 --- a/language/tools/move-cli/tests/build_tests/dependency_chain/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/dependency_chain/args.evm.txt @@ -1 +1 @@ -package build -v --arch ethereum +build -v --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/dependency_chain/args.exp b/language/tools/move-cli/tests/build_tests/dependency_chain/args.exp index d39eeea57a..ea1be9b5e0 100644 --- a/language/tools/move-cli/tests/build_tests/dependency_chain/args.exp +++ b/language/tools/move-cli/tests/build_tests/dependency_chain/args.exp @@ -1,4 +1,4 @@ -Command `package build -v`: +Command `build -v`: INCLUDING DEPENDENCY Bar INCLUDING DEPENDENCY Foo BUILDING A diff --git a/language/tools/move-cli/tests/build_tests/dependency_chain/args.txt b/language/tools/move-cli/tests/build_tests/dependency_chain/args.txt index 8e772362b2..cc4865c0fe 100644 --- a/language/tools/move-cli/tests/build_tests/dependency_chain/args.txt +++ b/language/tools/move-cli/tests/build_tests/dependency_chain/args.txt @@ -1 +1 @@ -package build -v +build -v diff --git a/language/tools/move-cli/tests/build_tests/dev_address/args.evm.exp b/language/tools/move-cli/tests/build_tests/dev_address/args.evm.exp index 251232f06b..0c3b17550a 100644 --- a/language/tools/move-cli/tests/build_tests/dev_address/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/dev_address/args.evm.exp @@ -1,3 +1,3 @@ -Command `package build -v -d --arch ethereum`: +Command `build -v -d --arch ethereum`: COMPILING A to Yul GENERATING EVM bytecote from Yul diff --git a/language/tools/move-cli/tests/build_tests/dev_address/args.evm.txt b/language/tools/move-cli/tests/build_tests/dev_address/args.evm.txt index dd7a870450..15f5301cac 100644 --- a/language/tools/move-cli/tests/build_tests/dev_address/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/dev_address/args.evm.txt @@ -1 +1 @@ -package build -v -d --arch ethereum +build -v -d --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/dev_address/args.exp b/language/tools/move-cli/tests/build_tests/dev_address/args.exp index 55c9a73c8c..fa89fc39cc 100644 --- a/language/tools/move-cli/tests/build_tests/dev_address/args.exp +++ b/language/tools/move-cli/tests/build_tests/dev_address/args.exp @@ -1,2 +1,2 @@ -Command `package build -v -d`: +Command `build -v -d`: BUILDING A diff --git a/language/tools/move-cli/tests/build_tests/dev_address/args.txt b/language/tools/move-cli/tests/build_tests/dev_address/args.txt index 9cceaa5fc1..d3d916f197 100644 --- a/language/tools/move-cli/tests/build_tests/dev_address/args.txt +++ b/language/tools/move-cli/tests/build_tests/dev_address/args.txt @@ -1 +1 @@ -package build -v -d +build -v -d diff --git a/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.evm.exp b/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.evm.exp index d6dfd1ce94..532110eb8d 100644 --- a/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.evm.exp @@ -1,3 +1,3 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING A to Yul GENERATING EVM bytecote from Yul diff --git a/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.evm.txt b/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.evm.txt index a57b42cc66..a8c353d3ef 100644 --- a/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.evm.txt @@ -1 +1 @@ -package build -v --arch ethereum +build -v --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.exp b/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.exp index f7b66b6afa..dffc3c3b34 100644 --- a/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.exp +++ b/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.exp @@ -1,2 +1,2 @@ -Command `package build -v`: +Command `build -v`: BUILDING A diff --git a/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.txt b/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.txt index 8e772362b2..cc4865c0fe 100644 --- a/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.txt +++ b/language/tools/move-cli/tests/build_tests/empty_module_no_deps/args.txt @@ -1 +1 @@ -package build -v +build -v diff --git a/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.evm.exp b/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.evm.exp index 0b5db14168..d261504544 100644 --- a/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.evm.exp @@ -1,4 +1,4 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING build_include_exclude_stdlib to Yul exiting with Move build errors Failed to compile Move into Yul ERROR error: unbound module @@ -15,6 +15,6 @@ exiting with Move build errors Failed to compile Move into Yul ERROR Error: exiting with Move build errors -Command `-d -v package build --arch ethereum`: +Command `-d -v build --arch ethereum`: COMPILING MoveStdlib, build_include_exclude_stdlib to Yul GENERATING EVM bytecote from Yul diff --git a/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.evm.txt b/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.evm.txt index be9dd03e7e..962de6465e 100644 --- a/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.evm.txt @@ -1,2 +1,2 @@ -package build -v --arch ethereum --d -v package build --arch ethereum +build -v --arch ethereum +-d -v build --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.exp b/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.exp index e463cb2cf8..ce37b1cf91 100644 --- a/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.exp +++ b/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.exp @@ -1,4 +1,4 @@ -Command `package build -v`: +Command `build -v`: BUILDING build_include_exclude_stdlib error[E03002]: unbound module ┌─ ./sources/UseSigner.move:3:7 @@ -12,6 +12,6 @@ error[E03002]: unbound module 6 │ signer::address_of(account) │ ^^^^^^ Unbound module alias 'signer' -Command `-d -v package build`: +Command `-d -v build`: INCLUDING DEPENDENCY MoveStdlib BUILDING build_include_exclude_stdlib diff --git a/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.txt b/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.txt index 67a15c4cde..f604f2da26 100644 --- a/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.txt +++ b/language/tools/move-cli/tests/build_tests/include_exclude_stdlib/args.txt @@ -1,2 +1,2 @@ -package build -v --d -v package build +build -v +-d -v build diff --git a/language/tools/move-cli/tests/build_tests/only_deps/args.exp b/language/tools/move-cli/tests/build_tests/only_deps/args.exp index 0b60ac75b4..be02df39e5 100644 --- a/language/tools/move-cli/tests/build_tests/only_deps/args.exp +++ b/language/tools/move-cli/tests/build_tests/only_deps/args.exp @@ -1,4 +1,4 @@ -Command `package build -v --only-deps`: +Command `build -v --only-deps`: INCLUDING DEPENDENCY MoveStdlib BUILDING OnlyDeps External Command `cat build/OnlyDeps/sources/A.move`: diff --git a/language/tools/move-cli/tests/build_tests/only_deps/args.txt b/language/tools/move-cli/tests/build_tests/only_deps/args.txt index 6495a99be4..2c4394b3e8 100644 --- a/language/tools/move-cli/tests/build_tests/only_deps/args.txt +++ b/language/tools/move-cli/tests/build_tests/only_deps/args.txt @@ -1,3 +1,3 @@ -package build -v --only-deps +build -v --only-deps > cat build/OnlyDeps/sources/A.move > ls build/OnlyDeps/sources/dependencies diff --git a/language/tools/move-cli/tests/build_tests/rebuild_after_adding_new_source/args.evm.exp b/language/tools/move-cli/tests/build_tests/rebuild_after_adding_new_source/args.evm.exp index 8eb37d42e3..0f9d29a140 100644 --- a/language/tools/move-cli/tests/build_tests/rebuild_after_adding_new_source/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/rebuild_after_adding_new_source/args.evm.exp @@ -1,7 +1,7 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul External Command `touch sources/Bar.move`: -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul diff --git a/language/tools/move-cli/tests/build_tests/rebuild_after_adding_new_source/args.evm.txt b/language/tools/move-cli/tests/build_tests/rebuild_after_adding_new_source/args.evm.txt index e031ec7d7f..d8c9efb2a1 100644 --- a/language/tools/move-cli/tests/build_tests/rebuild_after_adding_new_source/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/rebuild_after_adding_new_source/args.evm.txt @@ -1,3 +1,3 @@ -package build -v --arch ethereum +build -v --arch ethereum > touch sources/Bar.move -package build -v --arch ethereum +build -v --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/rebuild_after_deleting_output_artifact/args.evm.exp b/language/tools/move-cli/tests/build_tests/rebuild_after_deleting_output_artifact/args.evm.exp index aa3c74ec7e..ebc203025a 100644 --- a/language/tools/move-cli/tests/build_tests/rebuild_after_deleting_output_artifact/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/rebuild_after_deleting_output_artifact/args.evm.exp @@ -1,17 +1,17 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: CACHED Foo External Command `rm build/evm/Foo.yul`: -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul External Command `rm build/evm/Foo.bin`: -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul External Command `rm build/evm/Foo.abi.json`: -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul diff --git a/language/tools/move-cli/tests/build_tests/rebuild_after_deleting_output_artifact/args.evm.txt b/language/tools/move-cli/tests/build_tests/rebuild_after_deleting_output_artifact/args.evm.txt index 9daa7a79ee..d6a71a7511 100644 --- a/language/tools/move-cli/tests/build_tests/rebuild_after_deleting_output_artifact/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/rebuild_after_deleting_output_artifact/args.evm.txt @@ -1,8 +1,8 @@ -package build -v --arch ethereum -package build -v --arch ethereum +build -v --arch ethereum +build -v --arch ethereum > rm build/evm/Foo.yul -package build -v --arch ethereum +build -v --arch ethereum > rm build/evm/Foo.bin -package build -v --arch ethereum +build -v --arch ethereum > rm build/evm/Foo.abi.json -package build -v --arch ethereum +build -v --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/rebuild_after_touching_manifest/args.evm.exp b/language/tools/move-cli/tests/build_tests/rebuild_after_touching_manifest/args.evm.exp index b7caf1b8f8..fc8d8cecf4 100644 --- a/language/tools/move-cli/tests/build_tests/rebuild_after_touching_manifest/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/rebuild_after_touching_manifest/args.evm.exp @@ -1,7 +1,7 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul External Command `touch Move.toml`: -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul diff --git a/language/tools/move-cli/tests/build_tests/rebuild_after_touching_manifest/args.evm.txt b/language/tools/move-cli/tests/build_tests/rebuild_after_touching_manifest/args.evm.txt index acd1f051ce..bccd3f6d6a 100644 --- a/language/tools/move-cli/tests/build_tests/rebuild_after_touching_manifest/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/rebuild_after_touching_manifest/args.evm.txt @@ -1,3 +1,3 @@ -package build -v --arch ethereum +build -v --arch ethereum > touch Move.toml -package build -v --arch ethereum +build -v --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/rebuild_after_touching_source/args.evm.exp b/language/tools/move-cli/tests/build_tests/rebuild_after_touching_source/args.evm.exp index dd9b19307b..792c93d58f 100644 --- a/language/tools/move-cli/tests/build_tests/rebuild_after_touching_source/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/rebuild_after_touching_source/args.evm.exp @@ -1,7 +1,7 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul External Command `touch sources/Foo.move`: -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul diff --git a/language/tools/move-cli/tests/build_tests/rebuild_after_touching_source/args.evm.txt b/language/tools/move-cli/tests/build_tests/rebuild_after_touching_source/args.evm.txt index b606bb3de1..e9b9bcbf7e 100644 --- a/language/tools/move-cli/tests/build_tests/rebuild_after_touching_source/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/rebuild_after_touching_source/args.evm.txt @@ -1,3 +1,3 @@ -package build -v --arch ethereum +build -v --arch ethereum > touch sources/Foo.move -package build -v --arch ethereum +build -v --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/rebuild_no_modification/args.evm.exp b/language/tools/move-cli/tests/build_tests/rebuild_no_modification/args.evm.exp index 88aa651a80..2e418bb829 100644 --- a/language/tools/move-cli/tests/build_tests/rebuild_no_modification/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/rebuild_no_modification/args.evm.exp @@ -1,5 +1,5 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: COMPILING Foo to Yul GENERATING EVM bytecote from Yul -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: CACHED Foo diff --git a/language/tools/move-cli/tests/build_tests/rebuild_no_modification/args.evm.txt b/language/tools/move-cli/tests/build_tests/rebuild_no_modification/args.evm.txt index e627a34e03..ed83bebe22 100644 --- a/language/tools/move-cli/tests/build_tests/rebuild_no_modification/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/rebuild_no_modification/args.evm.txt @@ -1,2 +1,2 @@ -package build -v --arch ethereum -package build -v --arch ethereum +build -v --arch ethereum +build -v --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/unbound_address/args.evm.exp b/language/tools/move-cli/tests/build_tests/unbound_address/args.evm.exp index 0f7dc987dd..d3c437535e 100644 --- a/language/tools/move-cli/tests/build_tests/unbound_address/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/unbound_address/args.evm.exp @@ -1,4 +1,4 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: Error: Unresolved addresses found: [ Named address 'A' in package 'A' ] diff --git a/language/tools/move-cli/tests/build_tests/unbound_address/args.evm.txt b/language/tools/move-cli/tests/build_tests/unbound_address/args.evm.txt index a57b42cc66..a8c353d3ef 100644 --- a/language/tools/move-cli/tests/build_tests/unbound_address/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/unbound_address/args.evm.txt @@ -1 +1 @@ -package build -v --arch ethereum +build -v --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/unbound_address/args.exp b/language/tools/move-cli/tests/build_tests/unbound_address/args.exp index d96825b8db..a89305d076 100644 --- a/language/tools/move-cli/tests/build_tests/unbound_address/args.exp +++ b/language/tools/move-cli/tests/build_tests/unbound_address/args.exp @@ -1,4 +1,4 @@ -Command `package build -v`: +Command `build -v`: Error: Unresolved addresses found: [ Named address 'A' in package 'A' ] diff --git a/language/tools/move-cli/tests/build_tests/unbound_address/args.txt b/language/tools/move-cli/tests/build_tests/unbound_address/args.txt index 8e772362b2..cc4865c0fe 100644 --- a/language/tools/move-cli/tests/build_tests/unbound_address/args.txt +++ b/language/tools/move-cli/tests/build_tests/unbound_address/args.txt @@ -1 +1 @@ -package build -v +build -v diff --git a/language/tools/move-cli/tests/build_tests/unbound_dependency/args.evm.exp b/language/tools/move-cli/tests/build_tests/unbound_dependency/args.evm.exp index d9c18152b3..5e575847cd 100644 --- a/language/tools/move-cli/tests/build_tests/unbound_dependency/args.evm.exp +++ b/language/tools/move-cli/tests/build_tests/unbound_dependency/args.evm.exp @@ -1,4 +1,4 @@ -Command `package build -v --arch ethereum`: +Command `build -v --arch ethereum`: Error: Unable to resolve packages for package 'A' Caused by: diff --git a/language/tools/move-cli/tests/build_tests/unbound_dependency/args.evm.txt b/language/tools/move-cli/tests/build_tests/unbound_dependency/args.evm.txt index a57b42cc66..a8c353d3ef 100644 --- a/language/tools/move-cli/tests/build_tests/unbound_dependency/args.evm.txt +++ b/language/tools/move-cli/tests/build_tests/unbound_dependency/args.evm.txt @@ -1 +1 @@ -package build -v --arch ethereum +build -v --arch ethereum diff --git a/language/tools/move-cli/tests/build_tests/unbound_dependency/args.exp b/language/tools/move-cli/tests/build_tests/unbound_dependency/args.exp index 572e1becdd..8a9e48f28e 100644 --- a/language/tools/move-cli/tests/build_tests/unbound_dependency/args.exp +++ b/language/tools/move-cli/tests/build_tests/unbound_dependency/args.exp @@ -1,4 +1,4 @@ -Command `package build -v`: +Command `build -v`: Error: Unable to resolve packages for package 'A' Caused by: diff --git a/language/tools/move-cli/tests/build_tests/unbound_dependency/args.txt b/language/tools/move-cli/tests/build_tests/unbound_dependency/args.txt index 8e772362b2..cc4865c0fe 100644 --- a/language/tools/move-cli/tests/build_tests/unbound_dependency/args.txt +++ b/language/tools/move-cli/tests/build_tests/unbound_dependency/args.txt @@ -1 +1 @@ -package build -v +build -v diff --git a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.evm.exp b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.evm.exp index 23447b2104..74e5bcd7ea 100644 --- a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.evm.exp +++ b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.evm.exp @@ -1,4 +1,4 @@ -Command `package test --evm`: +Command `test --evm`: INCLUDING DEPENDENCY Bar INCLUDING DEPENDENCY MoveStdlib BUILDING Foo diff --git a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.evm.txt b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.evm.txt index 80307ce85a..403aa26b9b 100644 --- a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.evm.txt +++ b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.evm.txt @@ -1 +1 @@ -package test --evm +test --evm diff --git a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.exp b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.exp index b76eceb154..1a336b71f5 100644 --- a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.exp +++ b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.exp @@ -1,4 +1,4 @@ -Command `package test`: +Command `test`: INCLUDING DEPENDENCY Bar INCLUDING DEPENDENCY MoveStdlib BUILDING Foo diff --git a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.stackless.exp b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.stackless.exp index 1bc8f5cfbf..f3f295152e 100644 --- a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.stackless.exp +++ b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.stackless.exp @@ -1,4 +1,4 @@ -Command `package test --stackless`: +Command `test --stackless`: INCLUDING DEPENDENCY Bar INCLUDING DEPENDENCY MoveStdlib BUILDING Foo diff --git a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.stackless.txt b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.stackless.txt index b8530d9e6c..5909d654c2 100644 --- a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.stackless.txt +++ b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.stackless.txt @@ -1 +1 @@ -package test --stackless +test --stackless diff --git a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.txt b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.txt index 56e5404079..9daeafb986 100644 --- a/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.txt +++ b/language/tools/move-cli/tests/move_unit_tests/assign_dev_addr_for_dep/args.txt @@ -1 +1 @@ -package test +test diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.evm.exp b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.evm.exp index 13db3cd4f0..fd030cbf88 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.evm.exp +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.evm.exp @@ -1,4 +1,4 @@ -Command `package test --evm`: +Command `test --evm`: INCLUDING DEPENDENCY MoveStdlib BUILDING StandaloneModule Running Move unit tests diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.evm.txt b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.evm.txt index 80307ce85a..403aa26b9b 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.evm.txt +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.evm.txt @@ -1 +1 @@ -package test --evm +test --evm diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.exp b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.exp index 4d574b8ab4..3b23eb8ca5 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.exp +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.exp @@ -1,4 +1,4 @@ -Command `package test`: +Command `test`: INCLUDING DEPENDENCY MoveStdlib BUILDING StandaloneModule Running Move unit tests diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.stackless.exp b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.stackless.exp index 4555855a2a..ae0c6469e1 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.stackless.exp +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.stackless.exp @@ -1,4 +1,4 @@ -Command `package test --stackless`: +Command `test --stackless`: INCLUDING DEPENDENCY MoveStdlib BUILDING StandaloneModule Running Move unit tests diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.stackless.txt b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.stackless.txt index b8530d9e6c..5909d654c2 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.stackless.txt +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.stackless.txt @@ -1 +1 @@ -package test --stackless +test --stackless diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.txt b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.txt index 56e5404079..9daeafb986 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.txt +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_dev_addr_assignment/args.txt @@ -1 +1 @@ -package test +test diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.evm.exp b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.evm.exp index 13db3cd4f0..fd030cbf88 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.evm.exp +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.evm.exp @@ -1,4 +1,4 @@ -Command `package test --evm`: +Command `test --evm`: INCLUDING DEPENDENCY MoveStdlib BUILDING StandaloneModule Running Move unit tests diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.evm.txt b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.evm.txt index 80307ce85a..403aa26b9b 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.evm.txt +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.evm.txt @@ -1 +1 @@ -package test --evm +test --evm diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.exp b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.exp index 4d574b8ab4..3b23eb8ca5 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.exp +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.exp @@ -1,4 +1,4 @@ -Command `package test`: +Command `test`: INCLUDING DEPENDENCY MoveStdlib BUILDING StandaloneModule Running Move unit tests diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.stackless.exp b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.stackless.exp index 4555855a2a..ae0c6469e1 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.stackless.exp +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.stackless.exp @@ -1,4 +1,4 @@ -Command `package test --stackless`: +Command `test --stackless`: INCLUDING DEPENDENCY MoveStdlib BUILDING StandaloneModule Running Move unit tests diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.stackless.txt b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.stackless.txt index b8530d9e6c..5909d654c2 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.stackless.txt +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.stackless.txt @@ -1 +1 @@ -package test --stackless +test --stackless diff --git a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.txt b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.txt index 56e5404079..9daeafb986 100644 --- a/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.txt +++ b/language/tools/move-cli/tests/move_unit_tests/standalone_module_with_regular_addr_assignment/args.txt @@ -1 +1 @@ -package test +test diff --git a/language/tools/move-cli/tests/sandbox_tests/package_basics/args.exp b/language/tools/move-cli/tests/sandbox_tests/package_basics/args.exp index 779a536e1a..2e549b219e 100644 --- a/language/tools/move-cli/tests/sandbox_tests/package_basics/args.exp +++ b/language/tools/move-cli/tests/sandbox_tests/package_basics/args.exp @@ -1,7 +1,7 @@ -Command `package build`: +Command `build`: INCLUDING DEPENDENCY MoveStdlib BUILDING PackageBasics -Command `package test --coverage --threads 1`: +Command `test --coverage --threads 1`: INCLUDING DEPENDENCY MoveStdlib BUILDING PackageBasics Running Move unit tests @@ -12,7 +12,7 @@ Running Move unit tests [ PASS ] 0x1::AModuleTests::double_zero_zero [ PASS ] 0x1::AModuleTests::double_zero_zero_wrong Test result: OK. Total tests: 6; passed: 6; failed: 0 -Command `package coverage summary --summarize-functions`: +Command `coverage summary --summarize-functions`: +-------------------------+ | Move Coverage Summary | +-------------------------+ @@ -25,7 +25,7 @@ Module 00000000000000000000000000000001::AModule +-------------------------+ | % Move Coverage: 100.00 | +-------------------------+ -Command `package coverage source --module AModule`: +Command `coverage source --module AModule`: module std::AModule { /// x was three @@ -47,7 +47,7 @@ module std::AModule { double_except_three(3); } } -Command `package coverage bytecode --module AModule`: +Command `coverage bytecode --module AModule`: // Move bytecode v5 module 1.AModule { @@ -68,7 +68,7 @@ B2: [4] 9: Ret } } -Command `package disassemble --package MoveStdlib --name signer`: +Command `disassemble --package MoveStdlib --name signer`: // Move bytecode v5 module 1.signer { @@ -82,8 +82,8 @@ B0: } native public borrow_address(s: &signer): &address } -Command `package errmap`: -Command `package info`: +Command `errmap`: +Command `info`: PackageBasics ├─ std:0x1 └─ MoveStdlib diff --git a/language/tools/move-cli/tests/sandbox_tests/package_basics/args.txt b/language/tools/move-cli/tests/sandbox_tests/package_basics/args.txt index 32ce8e9aba..fd3509c3c5 100644 --- a/language/tools/move-cli/tests/sandbox_tests/package_basics/args.txt +++ b/language/tools/move-cli/tests/sandbox_tests/package_basics/args.txt @@ -1,8 +1,8 @@ -package build -package test --coverage --threads 1 -package coverage summary --summarize-functions -package coverage source --module AModule -package coverage bytecode --module AModule -package disassemble --package MoveStdlib --name signer -package errmap -package info +build +test --coverage --threads 1 +coverage summary --summarize-functions +coverage source --module AModule +coverage bytecode --module AModule +disassemble --package MoveStdlib --name signer +errmap +info