Skip to content

Commit 40ea033

Browse files
committed
Test graviola in CI
1 parent 8fc7440 commit 40ea033

File tree

6 files changed

+163
-2
lines changed

6 files changed

+163
-2
lines changed

build_system/abi_cafe.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ static ABI_CAFE_REPO: GitRepo = GitRepo::github(
77
"Gankra",
88
"abi-cafe",
99
"94d38030419eb00a1ba80e5e2b4d763dcee58db4",
10+
&[],
1011
"6efb4457893c8670",
1112
"abi-cafe",
1213
);

build_system/bench.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
1212
"ebobby",
1313
"simple-raytracer",
1414
"804a7a21b9e673a482797aa289a18ed480e4d813",
15+
&[],
1516
"ad6f59a2331a3f56",
1617
"<none>",
1718
);

build_system/prepare.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ pub(crate) fn prepare(dirs: &Dirs) {
1111
std::fs::create_dir_all(&dirs.download_dir).unwrap();
1212
crate::tests::RAND_REPO.fetch(dirs);
1313
crate::tests::REGEX_REPO.fetch(dirs);
14+
crate::tests::GRAVIOLA_REPO.fetch(dirs);
1415
}
1516

1617
pub(crate) struct GitRepo {
1718
url: GitRepoUrl,
1819
rev: &'static str,
20+
submodules: &'static [&'static str],
1921
content_hash: &'static str,
2022
patch_name: &'static str,
2123
}
@@ -71,10 +73,17 @@ impl GitRepo {
7173
user: &'static str,
7274
repo: &'static str,
7375
rev: &'static str,
76+
submodules: &'static [&'static str],
7477
content_hash: &'static str,
7578
patch_name: &'static str,
7679
) -> GitRepo {
77-
GitRepo { url: GitRepoUrl::Github { user, repo }, rev, content_hash, patch_name }
80+
GitRepo {
81+
url: GitRepoUrl::Github { user, repo },
82+
rev,
83+
submodules,
84+
content_hash,
85+
patch_name,
86+
}
7887
}
7988

8089
fn download_dir(&self, dirs: &Dirs) -> PathBuf {
@@ -132,6 +141,7 @@ impl GitRepo {
132141
&download_dir,
133142
&format!("https://github.com/{}/{}.git", user, repo),
134143
self.rev,
144+
self.submodules,
135145
);
136146
}
137147
}
@@ -160,7 +170,7 @@ impl GitRepo {
160170
}
161171
}
162172

163-
fn clone_repo(download_dir: &Path, repo: &str, rev: &str) {
173+
fn clone_repo(download_dir: &Path, repo: &str, rev: &str, submodules: &[&str]) {
164174
eprintln!("[CLONE] {}", repo);
165175

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

193+
if !submodules.is_empty() {
194+
let mut submodule_cmd = git_command(download_dir, "submodule");
195+
submodule_cmd.arg("update").arg("--init");
196+
submodule_cmd.args(submodules);
197+
spawn_and_wait(submodule_cmd);
198+
}
199+
183200
std::fs::remove_dir_all(download_dir.join(".git")).unwrap();
184201
}
185202

build_system/tests.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ pub(crate) static RAND_REPO: GitRepo = GitRepo::github(
125125
"rust-random",
126126
"rand",
127127
"1f4507a8e1cf8050e4ceef95eeda8f64645b6719",
128+
&[],
128129
"981f8bf489338978",
129130
"rand",
130131
);
@@ -135,12 +136,24 @@ pub(crate) static REGEX_REPO: GitRepo = GitRepo::github(
135136
"rust-lang",
136137
"regex",
137138
"061ee815ef2c44101dba7b0b124600fcb03c1912",
139+
&[],
138140
"dc26aefbeeac03ca",
139141
"regex",
140142
);
141143

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

146+
pub(crate) static GRAVIOLA_REPO: GitRepo = GitRepo::github(
147+
"ctz",
148+
"graviola",
149+
"7f849963651bdd5455fcfab590d813faa525c88d", // v/0.3.2
150+
&["thirdparty/cavp", "thirdparty/wycheproof"],
151+
"087a9f8a3b8597a7",
152+
"graviola",
153+
);
154+
155+
static GRAVIOLA: CargoProject = CargoProject::new(GRAVIOLA_REPO.source_dir(), "graviola_target");
156+
144157
static PORTABLE_SIMD_SRC: RelPath = RelPath::build("portable-simd");
145158

146159
static PORTABLE_SIMD: CargoProject = CargoProject::new(PORTABLE_SIMD_SRC, "portable-simd_target");
@@ -199,6 +212,39 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
199212
spawn_and_wait(build_cmd);
200213
}
201214
}),
215+
TestCase::custom("test.graviola", &|runner| {
216+
let (arch, _) = runner.target_compiler.triple.split_once('-').unwrap();
217+
218+
// FIXME: Disable `aarch64` until intrinsics are supported.
219+
if !["x86_64"].contains(&arch) {
220+
eprintln!("Skipping `graviola` tests: unsupported target");
221+
return;
222+
}
223+
224+
GRAVIOLA_REPO.patch(&runner.dirs);
225+
GRAVIOLA.clean(&runner.dirs);
226+
227+
if runner.is_native {
228+
let mut test_cmd = GRAVIOLA.test(&runner.target_compiler, &runner.dirs);
229+
230+
// FIXME: Disable AVX-512 until intrinsics are supported.
231+
test_cmd.env("GRAVIOLA_CPU_DISABLE_avx512f", "1");
232+
test_cmd.env("GRAVIOLA_CPU_DISABLE_avx512bw", "1");
233+
test_cmd.env("GRAVIOLA_CPU_DISABLE_avx512vl", "1");
234+
235+
test_cmd.args([
236+
"-p", "graviola", "--lib", "--all-features", "--", "-q",
237+
// FIXME: Disable AVX-512 until intrinsics are supported.
238+
"--skip", "check_counter512",
239+
]);
240+
spawn_and_wait(test_cmd);
241+
} else {
242+
eprintln!("Cross-Compiling: Not running tests");
243+
let mut build_cmd = GRAVIOLA.build(&runner.target_compiler, &runner.dirs);
244+
build_cmd.args(["-p", "graviola", "--lib", "--all-features"]);
245+
spawn_and_wait(build_cmd);
246+
}
247+
}),
202248
TestCase::custom("test.portable-simd", &|runner| {
203249
apply_patches(
204250
&runner.dirs,

config.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ test.sysroot
3636
testsuite.extended_sysroot
3737
test.rust-random/rand
3838
test.regex
39+
test.graviola
3940
test.portable-simd
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
From 77505617aa3a99339ea0f03b13198ec1d1c98444 Mon Sep 17 00:00:00 2001
2+
From: Cathal Mullan <contact@cathal.dev>
3+
Date: Tue, 10 Mar 2026 18:21:20 +0000
4+
Subject: [PATCH] Disable crabgrind and bump aws-lc-rs
5+
6+
---
7+
Cargo.lock | 18 ++++--------------
8+
graviola/Cargo.toml | 5 +----
9+
graviola/src/low/ct.rs | 2 +-
10+
3 files changed, 6 insertions(+), 19 deletions(-)
11+
12+
diff --git a/Cargo.lock b/Cargo.lock
13+
index 4fe007b1..9b05e186 100644
14+
--- a/Cargo.lock
15+
+++ b/Cargo.lock
16+
@@ -140,9 +140,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
17+
18+
[[package]]
19+
name = "aws-lc-rs"
20+
-version = "1.15.1"
21+
+version = "1.16.1"
22+
source = "registry+https://github.com/rust-lang/crates.io-index"
23+
-checksum = "6b5ce75405893cd713f9ab8e297d8e438f624dde7d706108285f7e17a25a180f"
24+
+checksum = "94bffc006df10ac2a68c83692d734a465f8ee6c5b384d8545a636f81d858f4bf"
25+
dependencies = [
26+
"aws-lc-sys",
27+
"zeroize",
28+
@@ -150,9 +150,9 @@ dependencies = [
29+
30+
[[package]]
31+
name = "aws-lc-sys"
32+
-version = "0.34.0"
33+
+version = "0.38.0"
34+
source = "registry+https://github.com/rust-lang/crates.io-index"
35+
-checksum = "179c3777a8b5e70e90ea426114ffc565b2c1a9f82f6c4a0c5a34aa6ef5e781b6"
36+
+checksum = "4321e568ed89bb5a7d291a7f37997c2c0df89809d7b6d12062c81ddb54aa782e"
37+
dependencies = [
38+
"cc",
39+
"cmake",
40+
@@ -463,15 +463,6 @@ dependencies = [
41+
"libc",
42+
]
43+
44+
-[[package]]
45+
-name = "crabgrind"
46+
-version = "0.1.9"
47+
-source = "registry+https://github.com/rust-lang/crates.io-index"
48+
-checksum = "bdbd43e4f32a9681a504577db2d4ea7d3f7b1bf2e97955561af98501ab600508"
49+
-dependencies = [
50+
- "cc",
51+
-]
52+
-
53+
[[package]]
54+
name = "criterion"
55+
version = "0.7.0"
56+
@@ -874,7 +865,6 @@ version = "0.3.0"
57+
dependencies = [
58+
"aws-lc-rs",
59+
"cfg-if",
60+
- "crabgrind",
61+
"getrandom 0.3.4",
62+
"hex",
63+
"proptest",
64+
diff --git a/graviola/Cargo.toml b/graviola/Cargo.toml
65+
index b4738b44..16a264f4 100644
66+
--- a/graviola/Cargo.toml
67+
+++ b/graviola/Cargo.toml
68+
@@ -17,11 +17,8 @@ cfg-if = "1"
69+
getrandom = "0.3"
70+
71+
[dev-dependencies]
72+
-aws-lc-rs = { version = "1.13", default-features = false, features = ["alloc", "prebuilt-nasm", "non-fips"] }
73+
+aws-lc-rs = { version = "1.16", default-features = false, features = ["alloc", "prebuilt-nasm", "non-fips"] }
74+
hex = { version = "0.4", features = ["serde"] }
75+
proptest = "1.5.0"
76+
serde = { version = "1", features = ["derive"] }
77+
serde_json = "1"
78+
-
79+
-[target.'cfg(all(target_os = "linux", target_arch = "x86_64"))'.dev-dependencies]
80+
-crabgrind = "=0.1.9" # compatible with valgrind package on GHA ubuntu-latest
81+
diff --git a/graviola/src/low/ct.rs b/graviola/src/low/ct.rs
82+
index 9932fdf5..36320334 100644
83+
--- a/graviola/src/low/ct.rs
84+
+++ b/graviola/src/low/ct.rs
85+
@@ -2,7 +2,7 @@
86+
// SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0
87+
88+
cfg_if::cfg_if! {
89+
- if #[cfg(all(test, target_os = "linux", target_arch = "x86_64"))] {
90+
+ if #[cfg(false)] {
91+
use crabgrind as cg;
92+
use core::mem::size_of_val;
93+
94+
--
95+
2.53.0

0 commit comments

Comments
 (0)