Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build_system/abi_cafe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ static ABI_CAFE_REPO: GitRepo = GitRepo::github(
"Gankra",
"abi-cafe",
"94d38030419eb00a1ba80e5e2b4d763dcee58db4",
&[],
"6efb4457893c8670",
"abi-cafe",
);
Expand Down
1 change: 1 addition & 0 deletions build_system/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
"ebobby",
"simple-raytracer",
"804a7a21b9e673a482797aa289a18ed480e4d813",
&[],
"ad6f59a2331a3f56",
"<none>",
);
Expand Down
21 changes: 19 additions & 2 deletions build_system/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ pub(crate) fn prepare(dirs: &Dirs) {
std::fs::create_dir_all(&dirs.download_dir).unwrap();
crate::tests::RAND_REPO.fetch(dirs);
crate::tests::REGEX_REPO.fetch(dirs);
crate::tests::GRAVIOLA_REPO.fetch(dirs);
}

pub(crate) struct GitRepo {
url: GitRepoUrl,
rev: &'static str,
submodules: &'static [&'static str],
content_hash: &'static str,
patch_name: &'static str,
}
Expand Down Expand Up @@ -71,10 +73,17 @@ impl GitRepo {
user: &'static str,
repo: &'static str,
rev: &'static str,
submodules: &'static [&'static str],
content_hash: &'static str,
patch_name: &'static str,
) -> GitRepo {
GitRepo { url: GitRepoUrl::Github { user, repo }, rev, content_hash, patch_name }
GitRepo {
url: GitRepoUrl::Github { user, repo },
rev,
submodules,
content_hash,
patch_name,
}
}

fn download_dir(&self, dirs: &Dirs) -> PathBuf {
Expand Down Expand Up @@ -132,6 +141,7 @@ impl GitRepo {
&download_dir,
&format!("https://github.com/{}/{}.git", user, repo),
self.rev,
self.submodules,
);
}
}
Expand Down Expand Up @@ -160,7 +170,7 @@ impl GitRepo {
}
}

fn clone_repo(download_dir: &Path, repo: &str, rev: &str) {
fn clone_repo(download_dir: &Path, repo: &str, rev: &str, submodules: &[&str]) {
eprintln!("[CLONE] {}", repo);

match fs::remove_dir_all(download_dir) {
Expand All @@ -180,6 +190,13 @@ fn clone_repo(download_dir: &Path, repo: &str, rev: &str) {
checkout_cmd.arg("-q").arg(rev);
spawn_and_wait(checkout_cmd);

if !submodules.is_empty() {
let mut submodule_cmd = git_command(download_dir, "submodule");
submodule_cmd.arg("update").arg("--init");
submodule_cmd.args(submodules);
spawn_and_wait(submodule_cmd);
}

std::fs::remove_dir_all(download_dir.join(".git")).unwrap();
}

Expand Down
52 changes: 52 additions & 0 deletions build_system/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ pub(crate) static RAND_REPO: GitRepo = GitRepo::github(
"rust-random",
"rand",
"1f4507a8e1cf8050e4ceef95eeda8f64645b6719",
&[],
"981f8bf489338978",
"rand",
);
Expand All @@ -135,12 +136,24 @@ pub(crate) static REGEX_REPO: GitRepo = GitRepo::github(
"rust-lang",
"regex",
"061ee815ef2c44101dba7b0b124600fcb03c1912",
&[],
"dc26aefbeeac03ca",
"regex",
);

static REGEX: CargoProject = CargoProject::new(REGEX_REPO.source_dir(), "regex_target");

pub(crate) static GRAVIOLA_REPO: GitRepo = GitRepo::github(
"ctz",
"graviola",
"7f849963651bdd5455fcfab590d813faa525c88d", // v/0.3.2
&["thirdparty/cavp", "thirdparty/wycheproof"],
"087a9f8a3b8597a7",
"graviola",
);

static GRAVIOLA: CargoProject = CargoProject::new(GRAVIOLA_REPO.source_dir(), "graviola_target");

static PORTABLE_SIMD_SRC: RelPath = RelPath::build("portable-simd");

static PORTABLE_SIMD: CargoProject = CargoProject::new(PORTABLE_SIMD_SRC, "portable-simd_target");
Expand Down Expand Up @@ -199,6 +212,45 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
spawn_and_wait(build_cmd);
}
}),
TestCase::custom("test.graviola", &|runner| {
let (arch, _) = runner.target_compiler.triple.split_once('-').unwrap();

// FIXME: Disable `aarch64` until intrinsics are supported.
if !["x86_64"].contains(&arch) {
eprintln!("Skipping `graviola` tests: unsupported target");
return;
}

GRAVIOLA_REPO.patch(&runner.dirs);
GRAVIOLA.clean(&runner.dirs);

if runner.is_native {
let mut test_cmd = GRAVIOLA.test(&runner.target_compiler, &runner.dirs);

// FIXME: Disable AVX-512 until intrinsics are supported.
test_cmd.env("GRAVIOLA_CPU_DISABLE_avx512f", "1");
test_cmd.env("GRAVIOLA_CPU_DISABLE_avx512bw", "1");
test_cmd.env("GRAVIOLA_CPU_DISABLE_avx512vl", "1");

test_cmd.args([
"-p",
"graviola",
"--lib",
"--all-features",
"--",
"-q",
// FIXME: Disable AVX-512 until intrinsics are supported.
"--skip",
"check_counter512",
]);
spawn_and_wait(test_cmd);
} else {
eprintln!("Cross-Compiling: Not running tests");
let mut build_cmd = GRAVIOLA.build(&runner.target_compiler, &runner.dirs);
build_cmd.args(["-p", "graviola", "--lib", "--all-features"]);
spawn_and_wait(build_cmd);
}
}),
TestCase::custom("test.portable-simd", &|runner| {
apply_patches(
&runner.dirs,
Expand Down
1 change: 1 addition & 0 deletions config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ test.sysroot
testsuite.extended_sysroot
test.rust-random/rand
test.regex
test.graviola
test.portable-simd
95 changes: 95 additions & 0 deletions patches/0001-graviola-Disable-crabgrind-and-bump-aws-lc-rs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
From 77505617aa3a99339ea0f03b13198ec1d1c98444 Mon Sep 17 00:00:00 2001
From: Cathal Mullan <contact@cathal.dev>
Date: Tue, 10 Mar 2026 18:21:20 +0000
Subject: [PATCH] Disable crabgrind and bump aws-lc-rs

---
Cargo.lock | 18 ++++--------------
graviola/Cargo.toml | 5 +----
graviola/src/low/ct.rs | 2 +-
3 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 4fe007b1..9b05e186 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -140,9 +140,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"

[[package]]
name = "aws-lc-rs"
-version = "1.15.1"
+version = "1.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b5ce75405893cd713f9ab8e297d8e438f624dde7d706108285f7e17a25a180f"
+checksum = "94bffc006df10ac2a68c83692d734a465f8ee6c5b384d8545a636f81d858f4bf"
dependencies = [
"aws-lc-sys",
"zeroize",
@@ -150,9 +150,9 @@ dependencies = [

[[package]]
name = "aws-lc-sys"
-version = "0.34.0"
+version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "179c3777a8b5e70e90ea426114ffc565b2c1a9f82f6c4a0c5a34aa6ef5e781b6"
+checksum = "4321e568ed89bb5a7d291a7f37997c2c0df89809d7b6d12062c81ddb54aa782e"
dependencies = [
"cc",
"cmake",
@@ -463,15 +463,6 @@ dependencies = [
"libc",
]

-[[package]]
-name = "crabgrind"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bdbd43e4f32a9681a504577db2d4ea7d3f7b1bf2e97955561af98501ab600508"
-dependencies = [
- "cc",
-]
-
[[package]]
name = "criterion"
version = "0.7.0"
@@ -874,7 +865,6 @@ version = "0.3.0"
dependencies = [
"aws-lc-rs",
"cfg-if",
- "crabgrind",
"getrandom 0.3.4",
"hex",
"proptest",
diff --git a/graviola/Cargo.toml b/graviola/Cargo.toml
index b4738b44..16a264f4 100644
--- a/graviola/Cargo.toml
+++ b/graviola/Cargo.toml
@@ -17,11 +17,8 @@ cfg-if = "1"
getrandom = "0.3"

[dev-dependencies]
-aws-lc-rs = { version = "1.13", default-features = false, features = ["alloc", "prebuilt-nasm", "non-fips"] }
+aws-lc-rs = { version = "1.16", default-features = false, features = ["alloc", "prebuilt-nasm", "non-fips"] }
hex = { version = "0.4", features = ["serde"] }
proptest = "1.5.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
-
-[target.'cfg(all(target_os = "linux", target_arch = "x86_64"))'.dev-dependencies]
-crabgrind = "=0.1.9" # compatible with valgrind package on GHA ubuntu-latest
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think upstream would accept putting crabgrind behind a default-on feature? And doing the aws-lc-rs update upstream? That would reduce the maintenance burden of keeping this patch up to date.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine they'd be fine with moving it behind a feature, I'll reach out and see.

diff --git a/graviola/src/low/ct.rs b/graviola/src/low/ct.rs
index 9932fdf5..36320334 100644
--- a/graviola/src/low/ct.rs
+++ b/graviola/src/low/ct.rs
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0

cfg_if::cfg_if! {
- if #[cfg(all(test, target_os = "linux", target_arch = "x86_64"))] {
+ if #[cfg(false)] {
use crabgrind as cg;
use core::mem::size_of_val;

--
2.53.0
Loading