Skip to content

Commit

Permalink
add build.rs that dlds the test resources
Browse files Browse the repository at this point in the history
To be able to run the unit tests seamlessly on any dev machine, we need
to have the test resources downloaded. This can be achieved by calling
the post-checkout script. Since this does not need to be executed when
running with Buildkite, but all the time, the script is now moved to
.buildkite/download_resources.sh and it is no longer a Buildkite hook,
but rather a regular bash script.

The script is called from build.rs so that it is transparent to the user
when the resources are downloaded. The disadvantage with this approach
is that the resources will be downloaded even when calling cargo build,
and not only for cargo test. This can be updated in the future once
cargo adds support for identifying the build profile in build scripts.
Tracking issue: rust-lang/cargo#4001

Signed-off-by: Andreea Florescu <fandree@amazon.com>
  • Loading branch information
andreeaflorescu committed Dec 30, 2020
1 parent 10e282a commit 194d583
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
File renamed without changes.
10 changes: 10 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use std::process::Command;

fn main() {
let command = "./.buildkite/download_resources.sh";
Command::new(command).status().unwrap();

println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=.buildkite/download_resources.sh");
println!("cargo:rerun-if-changed=src/loader/x86_64/bzimage/bzimage");
}

0 comments on commit 194d583

Please sign in to comment.