Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
chore: add text file with current compiler version for CI use
Browse files Browse the repository at this point in the history
Signed-off-by: Dori Medini <[email protected]>
  • Loading branch information
dorimedini-starkware committed May 7, 2024
1 parent ba7cf07 commit 0d4274f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/blockifier/src/test_utils/cairo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ pub fn cairo1_compiler_version() -> String {
}
}

pub fn cairo1_compiler_tag() -> String {
format!("v{}", cairo1_compiler_version())
}

/// Returns the path to the local Cairo1 compiler repository.
fn local_cairo1_compiler_repo_path() -> PathBuf {
// Location of blockifier's Cargo.toml.
Expand Down Expand Up @@ -149,7 +153,7 @@ fn verify_cairo0_compiler_deps() {

fn verify_cairo1_compiler_deps(git_tag_override: Option<String>) {
let cairo_repo_path = local_cairo1_compiler_repo_path();
let tag = git_tag_override.unwrap_or(format!("v{}", cairo1_compiler_version()));
let tag = git_tag_override.unwrap_or(cairo1_compiler_tag());

// Check if the path is a directory.
assert!(
Expand Down
1 change: 1 addition & 0 deletions crates/blockifier/tests/cairo1_compiler_tag.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v2.6.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::fs;

use blockifier::test_utils::cairo_compile::cairo1_compiler_tag;
use blockifier::test_utils::contracts::FeatureContract;
use blockifier::test_utils::CairoVersion;
use pretty_assertions::assert_eq;
Expand Down Expand Up @@ -109,6 +110,12 @@ fn verify_and_get_files(cairo_version: CairoVersion) -> Vec<(String, String, Str
paths
}

#[test]
fn test_cairo1_compiler_version_matches_toml() {
let on_file = include_str!("cairo1_compiler_tag.txt").trim().to_string();
assert_eq!(on_file, cairo1_compiler_tag());
}

#[test]
fn verify_feature_contracts_match_enum() {
let mut compiled_paths_from_enum: Vec<String> = FeatureContract::all_feature_contracts()
Expand Down

0 comments on commit 0d4274f

Please sign in to comment.