leo icon indicating copy to clipboard operation
leo copied to clipboard

[Bug] Benchmark runtime error

Open zamazan4ik opened this issue 11 months ago • 0 comments

🐛 Bug Report

There is a panic in the current benchmark implementation.

Steps to Reproduce

Run cargo bench --workspace -p leo-test-framework --bench leo_compiler command.

Code snippet to reproduce

N/A

Stack trace & error message

Benchmarking parse long_expr: Warming up for 3.0000 sthread 'main' panicked at tests/test-framework/benches/leo_compiler.rs:169:17:
Failed to parse program: ParserError(Formatted(Formatted { span: Span { lo: BytePos(71), hi: BytePos(72) }, backtrace: Backtraced { message: "expected : -- found '='", help: None, code: 5, code_identifier: 37, type_: "PAR", error: true, backtrace:    0: leo_errors::errors::parser::parser_errors::ParserError::unexpected
   1: leo_parser::parser::statement::<impl leo_parser::parser::context::ParserContext>::parse_definition_statement
   2: leo_parser::parser::statement::<impl leo_parser::parser::context::ParserContext>::parse_statement
   3: leo_parser::parser::context::ParserContext::parse_list
   4: leo_parser::parser::statement::<impl leo_parser::parser::context::ParserContext>::parse_block
   5: leo_parser::parser::file::<impl leo_parser::parser::context::ParserContext>::parse_program_scope
   6: leo_parser::parser::file::<impl leo_parser::parser::context::ParserContext>::parse_program
   7: leo_parser::parser::parse
   8: leo_compiler::compiler::Compiler::parse_program_from_string
   9: scoped_tls::ScopedKey<T>::set
  10: <core::time::Duration as core::iter::traits::accum::Sum>::sum
  11: criterion::bencher::Bencher<M>::iter_custom
  12: <criterion::routine::Function<M,F,T> as criterion::routine::Routine<M,T>>::warm_up
  13: criterion::routine::Routine::sample
  14: criterion::analysis::common
  15: criterion::benchmark_group::BenchmarkGroup<M>::bench_function
  16: leo_compiler::Sample::bencher
  17: leo_compiler::main
  18: std::sys_common::backtrace::__rust_begin_short_backtrace
  19: std::rt::lang_start::{{closure}}
  20: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13
      std::panicking::try::do_call
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
      std::panicking::try
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
      std::panic::catch_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48
      std::panicking::try::do_call
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
      std::panicking::try
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
      std::panic::catch_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
      std::rt::lang_start_internal
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20
  21: main
  22: __libc_start_call_main
  23: __libc_start_main_impl
  24: _start
 } }))
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
   3: scoped_tls::ScopedKey<T>::set
   4: <core::time::Duration as core::iter::traits::accum::Sum>::sum
   5: criterion::bencher::Bencher<M>::iter_custom
   6: <criterion::routine::Function<M,F,T> as criterion::routine::Routine<M,T>>::warm_up
   7: criterion::routine::Routine::sample
   8: criterion::analysis::common
   9: criterion::benchmark_group::BenchmarkGroup<M>::bench_function
  10: leo_compiler::Sample::bencher
  11: leo_compiler::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Expected Behavior

Benchmark does not panic.

Your Environment

  • Built from testnet3 branch on 58c18f9bd5a07913d78bfd1ed248652815fa0e45 commit
  • Rust 1.76
  • Fedora 39 (Linux kernel 6.7.4)

zamazan4ik avatar Mar 02 '24 14:03 zamazan4ik