Skip to content

Commit 13190d1

Browse files
committed
Test graviola in CI
1 parent 8fc7440 commit 13190d1

File tree

7 files changed

+65
-3
lines changed

7 files changed

+65
-3
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ task:
33
freebsd_instance:
44
image_family: freebsd-15-0-amd64-ufs
55
setup_rust_script:
6-
- pkg install -y git-tiny binutils
6+
- pkg install -y git-tiny binutils cmake
77
- curl https://sh.rustup.rs -sSf --output rustup.sh
88
- sh rustup.sh --default-toolchain none -y --profile=minimal
99
target_cache:

.github/workflows/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
- os: ubuntu-latest
5454
env:
5555
TARGET_TRIPLE: x86_64-unknown-linux-gnu
56+
apt_deps: valgrind
5657
- os: ubuntu-24.04-arm
5758
env:
5859
TARGET_TRIPLE: aarch64-unknown-linux-gnu
@@ -135,6 +136,11 @@ jobs:
135136
- name: Prepare dependencies
136137
run: ./y.sh prepare
137138

139+
- name: Install valgrind
140+
run: |
141+
sudo apt-get update
142+
sudo apt-get install -y valgrind
143+
138144
- name: Disable JIT tests
139145
run: |
140146
sed -i 's/jit./#jit./' config.txt

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: 36 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,29 @@ 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: `aarch64` once intrinsics are in place.
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+
test_cmd.args(["-p", "graviola", "--lib", "--all-features", "--", "-q"]);
230+
spawn_and_wait(test_cmd);
231+
} else {
232+
eprintln!("Cross-Compiling: Not running tests");
233+
let mut build_cmd = GRAVIOLA.build(&runner.target_compiler, &runner.dirs);
234+
build_cmd.args(["-p", "graviola", "--lib", "--all-features"]);
235+
spawn_and_wait(build_cmd);
236+
}
237+
}),
202238
TestCase::custom("test.portable-simd", &|runner| {
203239
apply_patches(
204240
&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

0 commit comments

Comments
 (0)