Skip to content

Commit

Permalink
Adding debugging printout on compiler launch (#38)
Browse files Browse the repository at this point in the history
* Add heap_size and call_depth flags to gas_budget attributes

More tests will be added when I wire these to the test case runners.

* Revert "Add heap_size and call_depth flags to gas_budget attributes"

This reverts commit 30e6b81.

* 051024-add-DEBUG-launch_compiler: ini

---------

Co-authored-by: ksolana <[email protected]>
  • Loading branch information
jcivlin and ksolana authored May 11, 2024
1 parent 9145935 commit fd23732
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,43 @@ To debug in VS Code add this config:
"stopOnEntry": false
}

- To print out the compilation command line spawned by tests set env: RUST_LOG=launch_compiler.
For example:
```
> RUST_LOG=launch_compiler cargo test --manifest-path external-crates/move/Cargo.toml -p move-mv-llvm-compiler --test stdlib-with-p-option-tests; echo EOT
Compiling move-mv-llvm-compiler v0.1.0 (/home/sol/work/git/sui-solana-032024/external-crates/move/solana/move-mv-llvm-compiler)
Finished test [unoptimized + debuginfo] target(s) in 1.22s
Running tests/stdlib-with-p-option-tests.rs (external-crates/move/target/debug/deps/stdlib_with_p_option_tests-ffb0765866d3fdd7)
running 1 test
Finished dev [unoptimized + debuginfo] target(s) in 0.29s
Finished dev [unoptimized + debuginfo] target(s) in 0.18s
[2024-05-11T01:06:54Z DEBUG stdlib_with_p_option_tests::test_common] Command {
program: "/home/sol/work/git/sui-solana-032024/external-crates/move/target/debug/move-mv-llvm-compiler",
args: [
"/home/sol/work/git/sui-solana-032024/external-crates/move/target/debug/move-mv-llvm-compiler",
"-c",
"/home/sol/work/git/sui-solana-032024/external-crates/move/solana/move-mv-llvm-compiler/tests/stdlib-with-p-option-tests/hash_tests.move",
"--extension",
"ll.actual",
"-p",
"/home/sol/work/git/sui-solana-032024/external-crates/move/crates/move-stdlib",
"--test",
"--dev",
"-S",
"-o",
"/home/sol/work/git/sui-solana-032024/external-crates/move/solana/move-mv-llvm-compiler/tests/stdlib-with-p-option-tests/hash_tests-build",
],
create_pidfd: false,
}
test run_test::hash_tests.move ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.60s
EOT
```

### Protip

----
Expand Down
10 changes: 7 additions & 3 deletions external-crates/move/solana/move-mv-llvm-compiler/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,13 @@ pub fn resolve_dependency(
lock_file: None, // Option<PathBuf>
fetch_deps_only: true,
skip_fetch_latest_git_deps: true,
default_flavor: None, // todo sui
default_edition: None, // todo sui
deps_as_root: false, // todo sui
// Note: Sui introduced compiler_version and edition/flavor of tool chain,
// they may be set as
// "move build --default-move-edition --default-move-flavor".
// Since Solana uses own compiler and tools, ignore them.
default_flavor: None, // in Sui can be Some(Flavor::GlobalStorage) or set in.
default_edition: None,
deps_as_root: false, // deps_as_root is reserved, not used
silence_warnings: false,
warnings_are_errors: false,
additional_named_addresses: BTreeMap::new(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ pub fn run_move_to_llvm_build(
fs::create_dir_all(test_plan.build_dir.to_str().unwrap()).expect("Directory does not exist");
cmd.args(["-o", test_plan.build_dir.to_str().expect("utf-8")]);

debug!(target: "launch_compiler", "{:#?}", &cmd);

let output = cmd.output()?;

if !output.status.success() {
Expand Down

0 comments on commit fd23732

Please sign in to comment.