generation of real benchmark functions for benchmarking v2 (#13224)
* function generation with _name working, need to modify signature * WIP * support custom BenchmarkResult<T> type * full support for BenchmarkResult<T> on benchmark function defs * support () return type for benchmark function defs that don't use ? * uncomment * fix where clause handling * fix benchmark function call bodies * proper parsing of return type * add UI tests for bad return type * fix detection of missing last_stmt with defined return type * UI tests covering missing last_stmt * properly detect and complain about empty benchmark function defs * fix missing Comma in Result<T, BenchmarkError> parsing + test * add additional UI test * allow complex path for BenchmarkResult and BenchmarkError in fn defs * add UI tests covering complex path for BenchmarkResult, BenchmarkError * retain doc comments and attributes * also add attributes to struct * add docs for benchmark function definition support * fix imports on benchmark example * fix issue with unused variables in extrinsic call fn def * fix up docs * remove support for v2::BenchmarkResult because it was confusing * fix typo * remove ability to use custom T for Result<T, BenchmarkError> in v2 * use missing call error instead of empty_fn() * remove unneeded match statement * Add a proper QED Co-authored-by:Keith Yeung <kungfukeith11@gmail.com> * fix other QED Co-authored-by:
Keith Yeung <kungfukeith11@gmail.com> * cargo fmt * add an explicit error for non TypePath as return type * tweak error warning and add a UI test for non TypePath return * remove comment * add docs about T and I generic params * improve docs referring to section "below" * pull out return type checking logic into its own function * pull out params parsing into its own function * pull out call_def parsing into its own function * add doc comment for missing_call() * replace spaces with tabs * add a result-based example to the benchmarking examples --------- Co-authored-by:
Keith Yeung <kungfukeith11@gmail.com>
parent
af25310e
Showing
- substrate/frame/balances/src/benchmarking.rs 3 additions, 1 deletionsubstrate/frame/balances/src/benchmarking.rs
- substrate/frame/benchmarking/src/lib.rs 91 additions, 17 deletionssubstrate/frame/benchmarking/src/lib.rs
- substrate/frame/examples/basic/src/benchmarking.rs 14 additions, 6 deletionssubstrate/frame/examples/basic/src/benchmarking.rs
- substrate/frame/support/procedural/src/benchmark.rs 229 additions, 68 deletionssubstrate/frame/support/procedural/src/benchmark.rs
- substrate/frame/support/test/tests/benchmark_ui/bad_return_non_benchmark_err.rs 19 additions, 0 deletions...t/test/tests/benchmark_ui/bad_return_non_benchmark_err.rs
- substrate/frame/support/test/tests/benchmark_ui/bad_return_non_benchmark_err.stderr 5 additions, 0 deletions...st/tests/benchmark_ui/bad_return_non_benchmark_err.stderr
- substrate/frame/support/test/tests/benchmark_ui/bad_return_non_type_path.rs 17 additions, 0 deletions...pport/test/tests/benchmark_ui/bad_return_non_type_path.rs
- substrate/frame/support/test/tests/benchmark_ui/bad_return_non_type_path.stderr 5 additions, 0 deletions...t/test/tests/benchmark_ui/bad_return_non_type_path.stderr
- substrate/frame/support/test/tests/benchmark_ui/bad_return_non_unit_t.rs 15 additions, 0 deletions.../support/test/tests/benchmark_ui/bad_return_non_unit_t.rs
- substrate/frame/support/test/tests/benchmark_ui/bad_return_non_unit_t.stderr 5 additions, 0 deletions...port/test/tests/benchmark_ui/bad_return_non_unit_t.stderr
- substrate/frame/support/test/tests/benchmark_ui/bad_return_type_blank_with_question.rs 22 additions, 0 deletions...tests/benchmark_ui/bad_return_type_blank_with_question.rs
- substrate/frame/support/test/tests/benchmark_ui/bad_return_type_blank_with_question.stderr 10 additions, 0 deletions...s/benchmark_ui/bad_return_type_blank_with_question.stderr
- substrate/frame/support/test/tests/benchmark_ui/bad_return_type_no_last_stmt.rs 16 additions, 0 deletions...t/test/tests/benchmark_ui/bad_return_type_no_last_stmt.rs
- substrate/frame/support/test/tests/benchmark_ui/bad_return_type_no_last_stmt.stderr 9 additions, 0 deletions...st/tests/benchmark_ui/bad_return_type_no_last_stmt.stderr
- substrate/frame/support/test/tests/benchmark_ui/bad_return_type_non_result.rs 19 additions, 0 deletions...ort/test/tests/benchmark_ui/bad_return_type_non_result.rs
- substrate/frame/support/test/tests/benchmark_ui/bad_return_type_non_result.stderr 5 additions, 0 deletions...test/tests/benchmark_ui/bad_return_type_non_result.stderr
- substrate/frame/support/test/tests/benchmark_ui/bad_return_type_option.rs 18 additions, 0 deletions...support/test/tests/benchmark_ui/bad_return_type_option.rs
- substrate/frame/support/test/tests/benchmark_ui/bad_return_type_option.stderr 5 additions, 0 deletions...ort/test/tests/benchmark_ui/bad_return_type_option.stderr
- substrate/frame/support/test/tests/benchmark_ui/empty_function.rs 13 additions, 0 deletions...e/frame/support/test/tests/benchmark_ui/empty_function.rs
- substrate/frame/support/test/tests/benchmark_ui/empty_function.stderr 5 additions, 0 deletions...ame/support/test/tests/benchmark_ui/empty_function.stderr
Please register or sign in to comment