Skip to content

Commit

Permalink
[WIP] Add image and blake3 simd tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Aug 29, 2024
1 parent 7e4cafb commit fe1404c
Show file tree
Hide file tree
Showing 5 changed files with 2,254 additions and 1 deletion.
2 changes: 2 additions & 0 deletions build_system/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pub(crate) fn prepare(dirs: &Dirs) {
RelPath::DOWNLOAD.ensure_exists(dirs);
crate::tests::RAND_REPO.fetch(dirs);
crate::tests::REGEX_REPO.fetch(dirs);
crate::tests::IMAGE_REPO.fetch(dirs);
crate::tests::BLAKE3_REPO.fetch(dirs);
}

pub(crate) fn prepare_stdlib(dirs: &Dirs, rustc: &Path) {
Expand Down
62 changes: 62 additions & 0 deletions build_system/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,26 @@ static LIBCORE_TESTS_SRC: RelPath = RelPath::BUILD.join("coretests");

static LIBCORE_TESTS: CargoProject = CargoProject::new(&LIBCORE_TESTS_SRC, "coretests_target");

pub(crate) static IMAGE_REPO: GitRepo = GitRepo::github(
"image-rs",
"image",
"c8d67ecc2a9ba42bb105be8cd430bba4248ee974",
"3a7a845a9749123f",
"image",
);

static IMAGE: CargoProject = CargoProject::new(&IMAGE_REPO.source_dir(), "image_target");

pub(crate) static BLAKE3_REPO: GitRepo = GitRepo::github(
"BLAKE3-team",
"BLAKE3",
"8e2e07e0222851a7f071eee9ffaca4c17fb7872c",
"6011bb8c767b053c",
"blake3",
);

static BLAKE3: CargoProject = CargoProject::new(&BLAKE3_REPO.source_dir(), "blake3_target");

const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
TestCase::custom("test.rust-random/rand", &|runner| {
RAND_REPO.patch(&runner.dirs);
Expand Down Expand Up @@ -233,6 +253,48 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
spawn_and_wait(test_cmd);
}
}),
TestCase::custom("test.image-fractal", &|runner| {
IMAGE_REPO.patch(&runner.dirs);

IMAGE.clean(&runner.dirs);

let mut build_cmd = IMAGE.build(&runner.target_compiler, &runner.dirs);
build_cmd
.arg("--example")
.arg("fractal")
.arg("--no-default-features")
.arg("--features")
.arg("png");
spawn_and_wait(build_cmd);

if runner.is_native {
let mut run_cmd = IMAGE.run(&runner.target_compiler, &runner.dirs);
run_cmd
.arg("--example")
.arg("fractal")
.arg("--no-default-features")
.arg("--features")
.arg("png");
run_cmd.current_dir(IMAGE.target_dir(&runner.dirs));

spawn_and_wait(run_cmd);
}
}),
TestCase::custom("test.blake3", &|runner| {
BLAKE3_REPO.patch(&runner.dirs);

BLAKE3.clean(&runner.dirs);

let mut build_cmd = BLAKE3.build(&runner.target_compiler, &runner.dirs);
build_cmd.arg("--all-targets");
spawn_and_wait(build_cmd);

if runner.is_native {
let mut test_cmd = BLAKE3.test(&runner.target_compiler, &runner.dirs);
test_cmd.arg("-q");
spawn_and_wait(test_cmd);
}
}),
];

pub(crate) fn run_tests(
Expand Down
4 changes: 3 additions & 1 deletion config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# the sysroot source hasn't changed. This is useful when the codegen backend hasn't been modified.
# This option can be changed while the build system is already running for as long as sysroot
# building hasn't started yet.
#keep_sysroot
keep_sysroot


# Testsuite
Expand Down Expand Up @@ -52,3 +52,5 @@ test.rust-random/rand
test.libcore
test.regex
test.portable-simd
test.image-fractal
test.blake3
Loading

0 comments on commit fe1404c

Please sign in to comment.