Skip to content

Commit 5457cb7

Browse files
authored
test: fix some tests (foundry-rs#5691)
1 parent a6bd607 commit 5457cb7

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

crates/chisel/src/executor.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,6 @@ impl<'a> Iterator for InstructionIter<'a> {
13431343
mod tests {
13441344
use super::*;
13451345
use ethers_solc::{error::SolcError, Solc};
1346-
use once_cell::sync::Lazy;
13471346
use std::sync::Mutex;
13481347

13491348
#[test]
@@ -1613,25 +1612,31 @@ mod tests {
16131612
#[track_caller]
16141613
fn source() -> SessionSource {
16151614
// synchronize solc install
1616-
static PRE_INSTALL_SOLC_LOCK: Lazy<Mutex<bool>> = Lazy::new(|| Mutex::new(false));
1615+
static PRE_INSTALL_SOLC_LOCK: Mutex<bool> = Mutex::new(false);
16171616

16181617
// on some CI targets installing results in weird malformed solc files, we try installing it
16191618
// multiple times
1619+
let version = "0.8.19";
16201620
for _ in 0..3 {
16211621
let mut is_preinstalled = PRE_INSTALL_SOLC_LOCK.lock().unwrap();
16221622
if !*is_preinstalled {
1623-
let solc =
1624-
Solc::find_or_install_svm_version("0.8.19").and_then(|solc| solc.version());
1625-
if solc.is_err() {
1626-
// try reinstalling
1627-
let solc = Solc::blocking_install(&"0.8.19".parse().unwrap());
1628-
if solc.map_err(SolcError::from).and_then(|solc| solc.version()).is_ok() {
1629-
*is_preinstalled = true;
1623+
let solc = Solc::find_or_install_svm_version(version)
1624+
.and_then(|solc| solc.version().map(|v| (solc, v)));
1625+
match solc {
1626+
Ok((solc, v)) => {
1627+
// successfully installed
1628+
eprintln!("found installed Solc v{v} @ {}", solc.solc.display());
16301629
break
16311630
}
1632-
} else {
1633-
// successfully installed
1634-
break
1631+
Err(e) => {
1632+
// try reinstalling
1633+
eprintln!("error: {e}\n trying to re-install Solc v{version}");
1634+
let solc = Solc::blocking_install(&version.parse().unwrap());
1635+
if solc.map_err(SolcError::from).and_then(|solc| solc.version()).is_ok() {
1636+
*is_preinstalled = true;
1637+
break
1638+
}
1639+
}
16351640
}
16361641
}
16371642
}

crates/forge/tests/cli/script.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ forgetest_async!(
751751
let run_log = re.replace_all(&run_log, "");
752752

753753
// Clean up carriage return OS differences
754-
let re = Regex::new(r"\\r\\n").unwrap();
754+
let re = Regex::new(r"\r\n").unwrap();
755755
let fixtures_log = re.replace_all(&fixtures_log, "\n");
756756
let run_log = re.replace_all(&run_log, "\n");
757757

0 commit comments

Comments
 (0)