Skip to content

Commit 8870f45

Browse files
committed
[WIP] Add image and blake3 simd tests
1 parent 7988b8c commit 8870f45

File tree

5 files changed

+2254
-1
lines changed

5 files changed

+2254
-1
lines changed

build_system/prepare.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ 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::IMAGE_REPO.fetch(dirs);
15+
crate::tests::BLAKE3_REPO.fetch(dirs);
1416
}
1517

1618
pub(crate) struct GitRepo {

build_system/tests.rs

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,26 @@ static SYSROOT_TESTS_SRC: RelPath = RelPath::build("sysroot_tests");
157157

158158
static SYSROOT_TESTS: CargoProject = CargoProject::new(&SYSROOT_TESTS_SRC, "sysroot_tests_target");
159159

160+
pub(crate) static IMAGE_REPO: GitRepo = GitRepo::github(
161+
"image-rs",
162+
"image",
163+
"c8d67ecc2a9ba42bb105be8cd430bba4248ee974",
164+
"3a7a845a9749123f",
165+
"image",
166+
);
167+
168+
static IMAGE: CargoProject = CargoProject::new(&IMAGE_REPO.source_dir(), "image_target");
169+
170+
pub(crate) static BLAKE3_REPO: GitRepo = GitRepo::github(
171+
"BLAKE3-team",
172+
"BLAKE3",
173+
"8e2e07e0222851a7f071eee9ffaca4c17fb7872c",
174+
"6011bb8c767b053c",
175+
"blake3",
176+
);
177+
178+
static BLAKE3: CargoProject = CargoProject::new(&BLAKE3_REPO.source_dir(), "blake3_target");
179+
160180
const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
161181
TestCase::custom("test.rust-random/rand", &|runner| {
162182
RAND_REPO.patch(&runner.dirs);
@@ -227,6 +247,48 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
227247
spawn_and_wait(test_cmd);
228248
}
229249
}),
250+
TestCase::custom("test.image-fractal", &|runner| {
251+
IMAGE_REPO.patch(&runner.dirs);
252+
253+
IMAGE.clean(&runner.dirs);
254+
255+
let mut build_cmd = IMAGE.build(&runner.target_compiler, &runner.dirs);
256+
build_cmd
257+
.arg("--example")
258+
.arg("fractal")
259+
.arg("--no-default-features")
260+
.arg("--features")
261+
.arg("png");
262+
spawn_and_wait(build_cmd);
263+
264+
if runner.is_native {
265+
let mut run_cmd = IMAGE.run(&runner.target_compiler, &runner.dirs);
266+
run_cmd
267+
.arg("--example")
268+
.arg("fractal")
269+
.arg("--no-default-features")
270+
.arg("--features")
271+
.arg("png");
272+
run_cmd.current_dir(IMAGE.target_dir(&runner.dirs));
273+
274+
spawn_and_wait(run_cmd);
275+
}
276+
}),
277+
TestCase::custom("test.blake3", &|runner| {
278+
BLAKE3_REPO.patch(&runner.dirs);
279+
280+
BLAKE3.clean(&runner.dirs);
281+
282+
let mut build_cmd = BLAKE3.build(&runner.target_compiler, &runner.dirs);
283+
build_cmd.arg("--all-targets");
284+
spawn_and_wait(build_cmd);
285+
286+
if runner.is_native {
287+
let mut test_cmd = BLAKE3.test(&runner.target_compiler, &runner.dirs);
288+
test_cmd.arg("-q");
289+
spawn_and_wait(test_cmd);
290+
}
291+
}),
230292
];
231293

232294
pub(crate) fn run_tests(

config.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# the sysroot source hasn't changed. This is useful when the codegen backend hasn't been modified.
55
# This option can be changed while the build system is already running for as long as sysroot
66
# building hasn't started yet.
7-
#keep_sysroot
7+
keep_sysroot
88

99

1010
# Testsuite
@@ -38,3 +38,5 @@ testsuite.extended_sysroot
3838
test.rust-random/rand
3939
test.regex
4040
test.portable-simd
41+
test.image-fractal
42+
test.blake3

0 commit comments

Comments
 (0)