Files
revive/crates/resolc/src/tests/cli/asm.rs
T
LJ ad61b6e3c9 Implement resolc end-to-end compilation benchmarks (#406)
# Description

Closes [#403](https://github.com/paritytech/revive/issues/403)

Adds compilation time benchmarks for resolc end-to-end.

The benchmarks can be run from the root via:

```sh
make bench-resolc
```

HTML reports will be generated under `target/criterion`, and a summary
of the results at
[crates/resolc/BENCHMARKS_M4PRO.md](https://github.com/paritytech/revive/blob/lj/compilation-benchmarks/crates/resolc/BENCHMARKS_M4PRO.md)
(currently from running on a Mac M4 Pro).
2025-11-19 12:16:07 +01:00

39 lines
1.2 KiB
Rust

//! The tests for running resolc with asm option.
use crate::cli_utils::{
assert_command_failure, assert_command_success, assert_equal_exit_codes, execute_resolc,
execute_solc, SOLIDITY_CONTRACT_PATH,
};
const ASM_OPTION: &str = "--asm";
#[test]
fn runs_with_valid_input_file() {
let arguments = &[SOLIDITY_CONTRACT_PATH, ASM_OPTION];
let resolc_result = execute_resolc(arguments);
assert_command_success(&resolc_result, "Providing a valid input file");
for pattern in &["deploy", "call", "seal_return"] {
assert!(
resolc_result.stdout.contains(pattern),
"Expected the output to contain `{pattern}`."
);
}
let solc_result = execute_solc(arguments);
assert_equal_exit_codes(&solc_result, &resolc_result);
}
#[test]
fn fails_without_input_file() {
let arguments = &[ASM_OPTION];
let resolc_result = execute_resolc(arguments);
assert_command_failure(&resolc_result, "Omitting an input file");
let output = resolc_result.stderr.to_lowercase();
assert!(output.contains("no input sources specified"));
let solc_result = execute_solc(arguments);
assert_equal_exit_codes(&solc_result, &resolc_result);
}