From 027954b88b0f2985e0025684199b0ec18e2a32eb Mon Sep 17 00:00:00 2001 From: maciektr Date: Fri, 22 Mar 2024 20:14:02 +0100 Subject: [PATCH] =?UTF-8?q?Downstream=20cairo-test=20option=20to=20print?= =?UTF-8?q?=20used=20resources=20for=20tests=20(cairo=E2=80=A6=20(#1221)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …#5266) commit-id:3c5ee860 --- **Stack**: - #1220 - #1219 - #1218 - #1217 - #1216 - #1215 - #1214 - #1221 ⬅ ⚠️ *Part of a stack created by [spr](https://github.com/ejoffe/spr). Do not merge manually using the UI - doing so may have unexpected results.* --- Cargo.lock | 58 +++++++++++----------- Cargo.toml | 44 ++++++++-------- extensions/scarb-cairo-test/src/main.rs | 5 ++ extensions/scarb-cairo-test/tests/build.rs | 53 ++++++++++++++++++++ 4 files changed, 109 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ce04ca958..fd21250b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -554,7 +554,7 @@ dependencies = [ [[package]] name = "cairo-lang-casm" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-utils", "indoc", @@ -567,7 +567,7 @@ dependencies = [ [[package]] name = "cairo-lang-compiler" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "anyhow", "cairo-lang-defs", @@ -589,7 +589,7 @@ dependencies = [ [[package]] name = "cairo-lang-debug" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-utils", ] @@ -597,7 +597,7 @@ dependencies = [ [[package]] name = "cairo-lang-defs" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-debug", "cairo-lang-diagnostics", @@ -613,7 +613,7 @@ dependencies = [ [[package]] name = "cairo-lang-diagnostics" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -624,7 +624,7 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-utils", "good_lp", @@ -633,7 +633,7 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-debug", "cairo-lang-utils", @@ -646,7 +646,7 @@ dependencies = [ [[package]] name = "cairo-lang-formatter" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "anyhow", "cairo-lang-diagnostics", @@ -666,7 +666,7 @@ dependencies = [ [[package]] name = "cairo-lang-language-server" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -696,7 +696,7 @@ dependencies = [ [[package]] name = "cairo-lang-lowering" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -743,7 +743,7 @@ version = "1.0.0" [[package]] name = "cairo-lang-parser" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-diagnostics", "cairo-lang-filesystem", @@ -762,7 +762,7 @@ dependencies = [ [[package]] name = "cairo-lang-plugins" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", @@ -780,7 +780,7 @@ dependencies = [ [[package]] name = "cairo-lang-proc-macros" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-debug", "quote", @@ -790,7 +790,7 @@ dependencies = [ [[package]] name = "cairo-lang-project" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", @@ -803,7 +803,7 @@ dependencies = [ [[package]] name = "cairo-lang-runner" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "ark-ff", "ark-secp256k1", @@ -833,7 +833,7 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -857,7 +857,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "anyhow", "cairo-felt", @@ -882,7 +882,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-ap-change" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -896,7 +896,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-gas" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -910,7 +910,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-generator" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -932,7 +932,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-to-casm" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "assert_matches", "cairo-felt", @@ -952,7 +952,7 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-type-size" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-sierra", "cairo-lang-utils", @@ -961,7 +961,7 @@ dependencies = [ [[package]] name = "cairo-lang-starknet" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "anyhow", "cairo-felt", @@ -991,7 +991,7 @@ dependencies = [ [[package]] name = "cairo-lang-starknet-classes" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-felt", "cairo-lang-casm", @@ -1015,7 +1015,7 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -1030,7 +1030,7 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "genco", "xshell", @@ -1039,7 +1039,7 @@ dependencies = [ [[package]] name = "cairo-lang-test-plugin" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "anyhow", "cairo-felt", @@ -1066,7 +1066,7 @@ dependencies = [ [[package]] name = "cairo-lang-test-runner" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "anyhow", "cairo-felt", @@ -1088,7 +1088,7 @@ dependencies = [ [[package]] name = "cairo-lang-utils" version = "2.6.3" -source = "git+https://github.com/starkware-libs/cairo?rev=53db45434c501e56ac84f1b27fac311183f14dbe#53db45434c501e56ac84f1b27fac311183f14dbe" +source = "git+https://github.com/starkware-libs/cairo?rev=4471a55923663eb8150ea6cd636d5c1038b137d1#4471a55923663eb8150ea6cd636d5c1038b137d1" dependencies = [ "env_logger", "hashbrown 0.14.3", diff --git a/Cargo.toml b/Cargo.toml index 2373e1db0..c4e1d82ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,28 +35,28 @@ assert_fs = "1" async-trait = "0.1" axum = { version = "0.6", features = ["http2"] } cairo-felt = "0.9.1" -cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-language-server = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-sierra-type-size = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe" } -cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "53db45434c501e56ac84f1b27fac311183f14dbe", features = ["env_logger"] } +cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-language-server = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-sierra-type-size = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1" } +cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "4471a55923663eb8150ea6cd636d5c1038b137d1", features = ["env_logger"] } camino = { version = "1", features = ["serde1"] } cargo_metadata = ">=0.18" clap = { version = "4", features = ["derive", "env", "string"] } diff --git a/extensions/scarb-cairo-test/src/main.rs b/extensions/scarb-cairo-test/src/main.rs index 27b407082..1777baad6 100644 --- a/extensions/scarb-cairo-test/src/main.rs +++ b/extensions/scarb-cairo-test/src/main.rs @@ -28,6 +28,10 @@ struct Args { /// Run only ignored tests. #[arg(long, default_value_t = false)] ignored: bool, + + /// Whether to print resource usage after each test. + #[arg(long, default_value_t = false)] + print_resource_usage: bool, } fn main() -> Result<()> { @@ -70,6 +74,7 @@ fn main() -> Result<()> { ignored: args.ignored, run_profiler: RunProfilerConfig::None, gas_enabled: is_gas_enabled(&metadata, &package.id, target), + print_resource_usage: args.print_resource_usage, }; let runner = CompiledTestRunner::new(test_compilation, config); runner.run(None)?; diff --git a/extensions/scarb-cairo-test/tests/build.rs b/extensions/scarb-cairo-test/tests/build.rs index 2b8f01f58..84dd06718 100644 --- a/extensions/scarb-cairo-test/tests/build.rs +++ b/extensions/scarb-cairo-test/tests/build.rs @@ -53,3 +53,56 @@ fn can_test_without_gas() { "#}); } + +#[test] +fn can_print_test_resources() { + let t = TempDir::new().unwrap(); + ProjectBuilder::start() + .name("hello") + .lib_cairo(indoc! {r#" + fn main() -> u32 { + fib(16) + } + + fn fib(mut n: u32) -> u32 { + let mut a: u32 = 0; + let mut b: u32 = 1; + while n != 0 { + n = n - 1; + let temp = b; + b = a + b; + a = temp; + }; + a + } + + #[cfg(test)] + mod tests { + use super::fib; + + #[test] + fn it_works() { + assert(fib(16) == 987, 'it works!'); + } + } + "#}) + .build(&t); + Scarb::quick_snapbox() + .arg("cairo-test") + .arg("--print-resource-usage") + .current_dir(&t) + .assert() + .success() + .stdout_matches(indoc! {r#" + [..]Compiling test(hello_unittest) hello v1.0.0 ([..]Scarb.toml) + [..]Finished release target(s) in [..] + testing hello ... + running 1 test + test hello::tests::it_works ... ok (gas usage est.: [..]) + steps: [..] + memory holes: [..] + builtins: ("range_check_builtin": [..]) + test result: ok. 1 passed; 0 failed; 0 ignored; 0 filtered out; + + "#}); +}