Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print profile name in finished targets message #1587

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions extensions/scarb-cairo-run/tests/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn valid_number_of_args() {
.success()
.stdout_matches(indoc! {r#"
Compiling hello v0.1.0 ([..]/Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello
Run completed successfully, returning [987]
"#});
Expand Down Expand Up @@ -65,7 +65,7 @@ fn can_deserialize_big_number() {
.success()
.stdout_matches(indoc! {r#"
Compiling hello v0.1.0 ([..]/Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello
Run completed successfully, returning [1129815197211541481934112806673325772687763881719835256646064516195041515616]
"#});
Expand All @@ -87,7 +87,7 @@ fn invalid_number_of_args() {
#[cfg(windows)]
snapbox.stdout_matches(indoc! {r#"
Compiling hello v0.1.0 ([..]/Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello
error: failed to run the function

Expand All @@ -98,7 +98,7 @@ fn invalid_number_of_args() {
#[cfg(not(windows))]
snapbox.stdout_matches(indoc! {r#"
Compiling hello v0.1.0 ([..]/Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello
error: failed to run the function

Expand All @@ -123,7 +123,7 @@ fn array_instead_of_felt() {
#[cfg(windows)]
snapbox.stdout_matches(indoc! {r#"
Compiling hello v0.1.0 ([..]Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello
error: failed to run the function

Expand All @@ -134,7 +134,7 @@ fn array_instead_of_felt() {
#[cfg(not(windows))]
snapbox.stdout_matches(indoc! {r#"
Compiling hello v0.1.0 ([..]Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello
error: failed to run the function

Expand Down Expand Up @@ -219,7 +219,7 @@ fn struct_deserialization() {
.success()
.stdout_matches(indoc! {r#"
Compiling hello v0.1.0 ([..]/Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello
Run completed successfully, returning [1, 2, 3, 15]
"#});
Expand Down Expand Up @@ -267,7 +267,7 @@ fn invalid_struct_deserialization() {
#[cfg(windows)]
snapbox.stdout_matches(indoc! {r#"
Compiling hello v0.1.0 ([..]Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello
error: failed to run the function

Expand All @@ -278,7 +278,7 @@ fn invalid_struct_deserialization() {
#[cfg(not(windows))]
snapbox.stdout_matches(indoc! {r#"
Compiling hello v0.1.0 ([..]Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello
error: failed to run the function

Expand Down Expand Up @@ -309,7 +309,7 @@ fn can_accept_nested_array() {
.success()
.stdout_matches(indoc! {r#"
[..] Compiling hello v0.1.0 ([..]Scarb.toml)
[..] Finished release target(s) in [..]
[..] Finished `dev` profile target(s) in [..]
[..] Running hello
[..][0, 1, [[17], [1, 15, 3], [42]]]
[..]Run completed successfully, returning []
Expand Down
20 changes: 10 additions & 10 deletions extensions/scarb-cairo-run/tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn can_run_default_main_function() {
.success()
.stdout_matches(indoc! {r#"
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
[..]Running hello
Run completed successfully, returning [42]
"#});
Expand All @@ -50,7 +50,7 @@ fn can_run_default_main_function_with_plugin() {
.success()
.stdout_matches(indoc! {r#"
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
[..]Running hello
Run completed successfully, returning [42]
"#});
Expand All @@ -77,7 +77,7 @@ fn no_entrypoint_fails() {
.failure(),
indoc! {r#"
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
[..]Running hello
error: Function with suffix `::main` to run not found.
"#},
Expand Down Expand Up @@ -109,7 +109,7 @@ fn no_debug_build_fails() {
.failure(),
indoc! {r#"
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
[..]Running hello
error: Function with suffix `::main` to run not found.
"#},
Expand Down Expand Up @@ -142,7 +142,7 @@ fn can_run_executable() {
.success()
.stdout_matches(indoc! {r#"
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
[..]Running hello
Run completed successfully, returning [42]
"#});
Expand Down Expand Up @@ -174,7 +174,7 @@ fn ambiguous_executables_will_fail() {
.failure(),
indoc! {r#"
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
[..]Running hello
error: multiple executable functions found
please choose a function to run from the list:
Expand Down Expand Up @@ -214,7 +214,7 @@ fn ambiguous_executables_will_fail_no_debug_names() {
// Note that we cannot list available executables, as we don't know their debug names.
indoc! {r#"
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
[..]Running hello
error: multiple executable functions found
please only mark a single function as executable or enable debug ids and choose function by name
Expand Down Expand Up @@ -296,7 +296,7 @@ fn cannot_choose_non_executable_if_any_present() {
.failure(),
indoc! {r#"
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
[..]Running hello
error: Function with suffix `::a` to run not found.
"#},
Expand Down Expand Up @@ -335,7 +335,7 @@ fn can_choose_executable_to_run() {
.success()
.stdout_matches(indoc! {r#"
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
[..]Running hello
Run completed successfully, returning [42]
"#});
Expand Down Expand Up @@ -363,7 +363,7 @@ fn choose_not_existing_function() {
.failure(),
indoc! {r#"
[..]Compiling hello v0.1.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
[..]Running hello
[..]error: Function with suffix `::b` to run not found.
"#},
Expand Down
8 changes: 4 additions & 4 deletions extensions/scarb-cairo-run/tests/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn scarb_build_is_called() {
.success()
.stdout_matches(indoc! {r#"
Compiling hello_world v0.1.0 ([..]/Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello_world
Run completed successfully, returning [987]
"#});
Expand Down Expand Up @@ -94,7 +94,7 @@ fn can_limit_gas() {
.success()
.stdout_matches(indoc! {r#"
Compiling hello_world v0.1.0 ([..]/Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello_world
Run completed successfully, returning [987]
Remaining gas: 58060
Expand Down Expand Up @@ -128,15 +128,15 @@ fn can_disable_gas() {
#[cfg(windows)]
snapbox.stdout_matches(indoc! {r#"
Compiling hello_world v0.1.0 ([..]Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello_world
error: program requires gas counter, please provide `--available-gas` argument
error: process did not exit successfully: exit code: 1
"#});
#[cfg(not(windows))]
snapbox.stdout_matches(indoc! {r#"
Compiling hello_world v0.1.0 ([..]Scarb.toml)
Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
Running hello_world
error: program requires gas counter, please provide `--available-gas` argument
"#});
Expand Down
14 changes: 7 additions & 7 deletions extensions/scarb-cairo-test/tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn can_test_without_gas() {
.success()
.stdout_matches(indoc! {r#"
[..]Compiling test(hello_unittest) hello v1.0.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
testing hello ...
running 1 test
test hello::tests::test_foo ... ok
Expand Down Expand Up @@ -97,7 +97,7 @@ fn can_print_test_resources() {
.success()
.stdout_matches(indoc! {r#"
[..]Compiling test(hello_unittest) hello v1.0.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
testing hello ...
running 1 test
test hello::tests::it_works ... ok (gas usage est.: [..])
Expand Down Expand Up @@ -149,7 +149,7 @@ fn features_test_build_success() {
.stdout_matches(indoc! {r#"
[..]Running cairo-test hello
[..]Compiling test(hello_unittest) hello v1.0.0 ([..])
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
testing hello ...
running 1 test
test hello::tests::it_works ... ok[..]
Expand Down Expand Up @@ -234,7 +234,7 @@ fn integration_tests() {
.stdout_matches(indoc! {r#"
[..]Compiling test(hello_unittest) hello v1.0.0 ([..]Scarb.toml)
[..]Compiling test(hello_integrationtest) hello_integrationtest v1.0.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
testing hello ...
running 2 tests
test hello_integrationtest::[..]::tests::it_works ... ok (gas usage est.: 42440)
Expand Down Expand Up @@ -281,7 +281,7 @@ fn warn_if_cairo_test_plugin_missing() {
```

[..]Compiling test(hello_unittest) hello v1.0.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
testing hello ...
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 filtered out;
Expand Down Expand Up @@ -333,7 +333,7 @@ fn can_choose_test_kind_to_run() {
.success()
.stdout_matches(indoc! {r#"
[..]Compiling test(hello_unittest) hello v1.0.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
testing hello ...
running 1 test
test hello::tests::it_works ... ok (gas usage est.: 42440)
Expand All @@ -349,7 +349,7 @@ fn can_choose_test_kind_to_run() {
.success()
.stdout_matches(indoc! {r#"
[..]Compiling test(hello_integrationtest) hello_integrationtest v1.0.0 ([..]Scarb.toml)
[..]Finished release target(s) in [..]
[..]Finished `dev` profile target(s) in [..]
testing hello ...
running 2 tests
test hello_integrationtest::[..]::tests::it_works ... ok (gas usage est.: 42440)
Expand Down
5 changes: 3 additions & 2 deletions scarb/src/ops/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ where
}

let elapsed_time = HumanDuration(ws.config().elapsed_time());
let profile = ws.current_profile()?;
let formatted_message = match operation_type {
Some(op) => format!("{op} release target(s) in {elapsed_time}"),
None => format!("release target(s) in {elapsed_time}"),
Some(op) => format!("{op} `{profile}` profile target(s) in {elapsed_time}"),
None => format!("`{profile}` profile target(s) in {elapsed_time}"),
};
ws.config()
.ui()
Expand Down
12 changes: 6 additions & 6 deletions scarb/tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ fn compile_multiple_packages() {
.success()
.stdout_matches(indoc! {r#"
[..] Compiling fib v1.0.0 ([..]Scarb.toml)
[..] Finished release target(s) in [..]
[..] Finished `dev` profile target(s) in [..]
"#});

t.child("target/dev/fib.sierra.json")
Expand Down Expand Up @@ -489,7 +489,7 @@ fn compile_with_nested_deps() {
.success()
.stdout_matches(indoc! {r#"
[..] Compiling x v1.0.0 ([..]Scarb.toml)
[..] Finished release target(s) in [..]
[..] Finished `dev` profile target(s) in [..]
"#});

t.child("target/dev/x.sierra.json")
Expand Down Expand Up @@ -756,7 +756,7 @@ fn dev_dep_inside_test() {
.success()
.stdout_matches(indoc! {r#"
[..] Compiling x v1.0.0 ([..])
[..] Finished release target(s) in [..]
[..] Finished `dev` profile target(s) in [..]
"#});
}

Expand Down Expand Up @@ -798,7 +798,7 @@ fn build_test_without_compiling_tests_from_dependencies() {
.success()
.stdout_matches(indoc! {r#"
[..] Compiling test(x_unittest) x v1.0.0 ([..])
[..] Finished release target(s) in [..]
[..] Finished `dev` profile target(s) in [..]
"#});
}

Expand Down Expand Up @@ -827,7 +827,7 @@ fn warnings_allowed_by_default() {
let a = 41;
^

Finished release target(s) in [..]
Finished `dev` profile target(s) in [..]
"#});
}

Expand Down Expand Up @@ -988,7 +988,7 @@ fn error_codes_shown_in_json_output() {
.stdout_matches(indoc! {r#"
{"status":"compiling","message":"[..] v1.0.0 ([..]Scarb.toml)"}
{"type":"warn","message":"Unused variable. Consider ignoring by prefixing with `_`./n --> [..]lib.cairo:2:9/n let a = 41;/n ^/n","code":"E0001"}
{"status":"finished","message":"release target(s) in [..]"}
{"status":"finished","message":"`dev` profile target(s) in [..]"}
"#});
}

Expand Down
Loading
Loading