Skip to content

Commit

Permalink
test: ensure latest solc is provided by svm (foundry-rs#3089)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Sep 5, 2022
1 parent c138b5d commit f195b85
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ pretty_assertions = "1.0.0"
toml = "0.5"
serial_test = "0.9.0"
criterion = "0.3"
svm = { package = "svm-rs", version = "0.2.16", default-features = false, features = ["rustls"] }

[features]
default = ["rustls"]
Expand Down
1 change: 1 addition & 0 deletions cli/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod config;
mod create;
#[cfg(not(feature = "external-integration-tests"))]
mod script;
mod svm;
#[cfg(not(feature = "external-integration-tests"))]
mod test_cmd;
#[cfg(not(feature = "external-integration-tests"))]
Expand Down
45 changes: 45 additions & 0 deletions cli/tests/it/svm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//! svm sanity checks
use semver::Version;
use svm::{self, Platform};

/// The latest solc release
///
/// solc to foundry release process:
/// 1. new solc release
/// 2. svm updated with all build info
/// 3. svm bumped in ethers-rs
/// 4. ethers bumped in foundry + update the `LATEST_SOLC`
const LATEST_SOLC: Version = Version::new(0, 8, 16);

macro_rules! ensure_svm_releases {
($($test:ident => $platform:ident),*) => {
$(
#[tokio::test]
async fn $test() {
ensure_latest_release(Platform::$platform).await
}
)*
};
}

async fn ensure_latest_release(platform: Platform) {
let releases = svm::all_releases(platform)
.await
.unwrap_or_else(|err| panic!("Could not fetch releases for {}: {:?}", platform, err));
assert!(
releases.releases.contains_key(&LATEST_SOLC),
"platform {:?} is missing solc info {}",
platform,
LATEST_SOLC
);
}

// ensures all platform have the latest solc release version
ensure_svm_releases!(
test_svm_releases_linux_amd64 => LinuxAmd64,
test_svm_releases_linux_aarch64 => LinuxAarch64,
test_svm_releases_macos_amd64 => MacOsAmd64,
test_svm_releases_macos_aarch64 => MacOsAarch64,
test_svm_releases_windows_amd64 => WindowsAmd64
);

0 comments on commit f195b85

Please sign in to comment.