mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-16 23:41:01 +00:00
Separate compilation and linker phases (#376)
Separate between compilation and linker phases to allow deploy time linking and back-porting era compiler changes to fix #91. Unlinked contract binaries (caused by missing libraries or missing factory dependencies in turn) are emitted as raw ELF object. Few drive by fixes: - #98 - A compiler panic on missing libraries definitions. - Fixes some incosistent type forwarding in JSON output (empty string vs. null object). - Remove the unused fallback for size optimization setting. - Remove the broken `--lvm-ir` mode. - CI workflow fixes. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com> Signed-off-by: xermicus <bigcyrill@hotmail.com> Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -1,44 +1,32 @@
|
||||
//! The tests for running resolc with yul option.
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
use crate::tests::cli::utils;
|
||||
|
||||
pub const YUL_OPTION: &str = "--yul";
|
||||
/// The `--yul` option was deprecated in Solidity 0.8.27 in favor of `--strict-assembly`.
|
||||
/// See section `--strict-assembly vs. --yul` in https://soliditylang.org/blog/2024/09/04/solidity-0.8.27-release-announcement/
|
||||
const SOLC_YUL_OPTION: &str = "--strict-assembly";
|
||||
use crate::tests::cli::utils::{
|
||||
assert_command_success, assert_equal_exit_codes, execute_resolc, execute_solc, RESOLC_YUL_FLAG,
|
||||
SOLC_YUL_FLAG, YUL_CONTRACT_PATH,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn runs_with_valid_input_file() {
|
||||
let arguments = &[utils::YUL_CONTRACT_PATH, YUL_OPTION];
|
||||
let resolc_result = utils::execute_resolc(arguments);
|
||||
utils::assert_command_success(&resolc_result, "Providing a valid input file");
|
||||
let resolc_result = execute_resolc(&[YUL_CONTRACT_PATH, RESOLC_YUL_FLAG]);
|
||||
assert_command_success(&resolc_result, "Providing a valid input file");
|
||||
|
||||
assert!(
|
||||
resolc_result
|
||||
.stderr
|
||||
.contains("Compiler run successful. No output requested"),
|
||||
"Expected the output to contain a success message."
|
||||
);
|
||||
assert!(resolc_result
|
||||
.stderr
|
||||
.contains("Compiler run successful. No output requested"));
|
||||
|
||||
let solc_arguments = &[utils::YUL_CONTRACT_PATH, SOLC_YUL_OPTION];
|
||||
let solc_result = utils::execute_solc(solc_arguments);
|
||||
utils::assert_equal_exit_codes(&solc_result, &resolc_result);
|
||||
let solc_result = execute_solc(&[YUL_CONTRACT_PATH, SOLC_YUL_FLAG]);
|
||||
assert_equal_exit_codes(&solc_result, &resolc_result);
|
||||
}
|
||||
|
||||
/// While the `solc` Solidity mode requires output selection,
|
||||
/// the strict-assembly mode does not.
|
||||
///
|
||||
/// `resolc` exhibits consistent behavior for both modes.
|
||||
#[test]
|
||||
fn fails_without_input_file() {
|
||||
let arguments = &[YUL_OPTION];
|
||||
let resolc_result = utils::execute_resolc(arguments);
|
||||
utils::assert_command_failure(&resolc_result, "Omitting an input file");
|
||||
|
||||
assert!(
|
||||
resolc_result.stderr.contains("The input file is missing"),
|
||||
"Expected the output to contain a specific error message."
|
||||
);
|
||||
|
||||
let solc_arguments = &[SOLC_YUL_OPTION];
|
||||
let solc_result = utils::execute_solc(solc_arguments);
|
||||
utils::assert_equal_exit_codes(&solc_result, &resolc_result);
|
||||
fn runs_without_input_file() {
|
||||
let resolc_result = execute_resolc(&[RESOLC_YUL_FLAG]);
|
||||
assert_command_success(&resolc_result, "Omitting an input file");
|
||||
assert!(resolc_result
|
||||
.stderr
|
||||
.contains("Compiler run successful. No output requested"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user