mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Move all downloaded repos to the downloads/ dir
This commit is contained in:
parent
f1dc206c4f
commit
24198ce6b4
7
.gitignore
vendored
7
.gitignore
vendored
@ -15,9 +15,4 @@ perf.data.old
|
||||
/build_sysroot/compiler-builtins
|
||||
/build_sysroot/rustc_version
|
||||
/rust
|
||||
/rand
|
||||
/regex
|
||||
/simple-raytracer
|
||||
/portable-simd
|
||||
/abi-cafe
|
||||
/abi-checker
|
||||
/download
|
||||
|
@ -3,6 +3,7 @@ use std::path::Path;
|
||||
|
||||
use super::build_sysroot;
|
||||
use super::config;
|
||||
use super::prepare;
|
||||
use super::utils::{cargo_command, spawn_and_wait};
|
||||
use super::SysrootKind;
|
||||
|
||||
@ -35,9 +36,8 @@ pub(crate) fn run(
|
||||
);
|
||||
|
||||
eprintln!("Running abi-cafe");
|
||||
let mut abi_cafe_path = env::current_dir().unwrap();
|
||||
abi_cafe_path.push("abi-cafe");
|
||||
env::set_current_dir(&abi_cafe_path.clone()).unwrap();
|
||||
let abi_cafe_path = prepare::ABI_CAFE.source_dir();
|
||||
env::set_current_dir(abi_cafe_path.clone()).unwrap();
|
||||
|
||||
let pairs = ["rustc_calls_cgclif", "cgclif_calls_rustc", "cgclif_calls_cc", "cc_calls_cgclif"];
|
||||
|
||||
|
@ -35,6 +35,11 @@ pub(crate) const SIMPLE_RAYTRACER: GitRepo = GitRepo::github(
|
||||
);
|
||||
|
||||
pub(crate) fn prepare() {
|
||||
if Path::new("download").exists() {
|
||||
std::fs::remove_dir_all(Path::new("download")).unwrap();
|
||||
}
|
||||
std::fs::create_dir_all(Path::new("download")).unwrap();
|
||||
|
||||
prepare_sysroot();
|
||||
|
||||
// FIXME maybe install this only locally?
|
||||
@ -48,11 +53,15 @@ pub(crate) fn prepare() {
|
||||
SIMPLE_RAYTRACER.fetch();
|
||||
|
||||
eprintln!("[LLVM BUILD] simple-raytracer");
|
||||
let build_cmd = cargo_command("cargo", "build", None, Path::new("simple-raytracer"));
|
||||
let build_cmd = cargo_command("cargo", "build", None, &SIMPLE_RAYTRACER.source_dir());
|
||||
spawn_and_wait(build_cmd);
|
||||
fs::copy(
|
||||
Path::new("simple-raytracer/target/debug").join(get_file_name("main", "bin")),
|
||||
Path::new("simple-raytracer").join(get_file_name("raytracer_cg_llvm", "bin")),
|
||||
SIMPLE_RAYTRACER
|
||||
.source_dir()
|
||||
.join("target")
|
||||
.join("debug")
|
||||
.join(get_file_name("main", "bin")),
|
||||
SIMPLE_RAYTRACER.source_dir().join(get_file_name("raytracer_cg_llvm", "bin")),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
@ -106,7 +115,9 @@ impl GitRepo {
|
||||
|
||||
pub(crate) fn source_dir(&self) -> PathBuf {
|
||||
match self.url {
|
||||
GitRepoUrl::Github { user: _, repo } => PathBuf::from(format!("{}", repo)),
|
||||
GitRepoUrl::Github { user: _, repo } => {
|
||||
std::env::current_dir().unwrap().join("download").join(repo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,9 +153,11 @@ fn clone_repo_shallow_github(download_dir: &Path, user: &str, repo: &str, rev: &
|
||||
return;
|
||||
}
|
||||
|
||||
let downloads_dir = std::env::current_dir().unwrap().join("download");
|
||||
|
||||
let archive_url = format!("https://github.com/{}/{}/archive/{}.tar.gz", user, repo, rev);
|
||||
let archive_file = format!("{}.tar.gz", rev);
|
||||
let archive_dir = format!("{}-{}", repo, rev);
|
||||
let archive_file = downloads_dir.join(format!("{}.tar.gz", rev));
|
||||
let archive_dir = downloads_dir.join(format!("{}-{}", repo, rev));
|
||||
|
||||
eprintln!("[DOWNLOAD] {}/{} from {}", user, repo, archive_url);
|
||||
|
||||
@ -160,7 +173,7 @@ fn clone_repo_shallow_github(download_dir: &Path, user: &str, repo: &str, rev: &
|
||||
|
||||
// Unpack tar archive
|
||||
let mut unpack_cmd = Command::new("tar");
|
||||
unpack_cmd.arg("xf").arg(&archive_file);
|
||||
unpack_cmd.arg("xf").arg(&archive_file).current_dir(downloads_dir);
|
||||
spawn_and_wait(unpack_cmd);
|
||||
|
||||
// Rename unpacked dir to the expected name
|
||||
|
@ -1,5 +1,6 @@
|
||||
use super::build_sysroot;
|
||||
use super::config;
|
||||
use super::prepare;
|
||||
use super::rustc_info::get_wrapper_file_name;
|
||||
use super::utils::{cargo_command, hyperfine_command, spawn_and_wait, spawn_and_wait_with_input};
|
||||
use build_system::SysrootKind;
|
||||
@ -217,7 +218,7 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
|
||||
|
||||
const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
||||
TestCase::new("test.rust-random/rand", &|runner| {
|
||||
runner.in_dir(["rand"], |runner| {
|
||||
runner.in_dir(prepare::RAND.source_dir(), |runner| {
|
||||
runner.run_cargo("clean", []);
|
||||
|
||||
if runner.host_triple == runner.target_triple {
|
||||
@ -230,7 +231,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
||||
});
|
||||
}),
|
||||
TestCase::new("bench.simple-raytracer", &|runner| {
|
||||
runner.in_dir(["simple-raytracer"], |runner| {
|
||||
runner.in_dir(prepare::SIMPLE_RAYTRACER.source_dir(), |runner| {
|
||||
let run_runs = env::var("RUN_RUNS").unwrap_or("10".to_string()).parse().unwrap();
|
||||
|
||||
if runner.host_triple == runner.target_triple {
|
||||
@ -273,19 +274,28 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
||||
});
|
||||
}),
|
||||
TestCase::new("test.libcore", &|runner| {
|
||||
runner.in_dir(["build_sysroot", "sysroot_src", "library", "core", "tests"], |runner| {
|
||||
runner.run_cargo("clean", []);
|
||||
runner.in_dir(
|
||||
std::env::current_dir()
|
||||
.unwrap()
|
||||
.join("build_sysroot")
|
||||
.join("sysroot_src")
|
||||
.join("library")
|
||||
.join("core")
|
||||
.join("tests"),
|
||||
|runner| {
|
||||
runner.run_cargo("clean", []);
|
||||
|
||||
if runner.host_triple == runner.target_triple {
|
||||
runner.run_cargo("test", []);
|
||||
} else {
|
||||
eprintln!("Cross-Compiling: Not running tests");
|
||||
runner.run_cargo("build", ["--tests"]);
|
||||
}
|
||||
});
|
||||
if runner.host_triple == runner.target_triple {
|
||||
runner.run_cargo("test", []);
|
||||
} else {
|
||||
eprintln!("Cross-Compiling: Not running tests");
|
||||
runner.run_cargo("build", ["--tests"]);
|
||||
}
|
||||
},
|
||||
);
|
||||
}),
|
||||
TestCase::new("test.regex-shootout-regex-dna", &|runner| {
|
||||
runner.in_dir(["regex"], |runner| {
|
||||
runner.in_dir(prepare::REGEX.source_dir(), |runner| {
|
||||
runner.run_cargo("clean", []);
|
||||
|
||||
// newer aho_corasick versions throw a deprecation warning
|
||||
@ -336,7 +346,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
||||
});
|
||||
}),
|
||||
TestCase::new("test.regex", &|runner| {
|
||||
runner.in_dir(["regex"], |runner| {
|
||||
runner.in_dir(prepare::REGEX.source_dir(), |runner| {
|
||||
runner.run_cargo("clean", []);
|
||||
|
||||
// newer aho_corasick versions throw a deprecation warning
|
||||
@ -367,7 +377,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
||||
});
|
||||
}),
|
||||
TestCase::new("test.portable-simd", &|runner| {
|
||||
runner.in_dir(["portable-simd"], |runner| {
|
||||
runner.in_dir(prepare::PORTABLE_SIMD.source_dir(), |runner| {
|
||||
runner.run_cargo("clean", []);
|
||||
runner.run_cargo("build", ["--all-targets", "--target", &runner.target_triple]);
|
||||
|
||||
@ -506,16 +516,8 @@ impl TestRunner {
|
||||
}
|
||||
}
|
||||
|
||||
fn in_dir<'a, I, F>(&self, dir: I, callback: F)
|
||||
where
|
||||
I: IntoIterator<Item = &'a str>,
|
||||
F: FnOnce(&TestRunner),
|
||||
{
|
||||
fn in_dir(&self, new: impl AsRef<Path>, callback: impl FnOnce(&TestRunner)) {
|
||||
let current = env::current_dir().unwrap();
|
||||
let mut new = current.clone();
|
||||
for d in dir {
|
||||
new.push(d);
|
||||
}
|
||||
|
||||
env::set_current_dir(new).unwrap();
|
||||
callback(self);
|
||||
|
@ -3,4 +3,8 @@ set -e
|
||||
|
||||
rm -rf build_sysroot/{sysroot_src/,target/,compiler-builtins/,rustc_version}
|
||||
rm -rf target/ build/ perf.data{,.old} y.bin
|
||||
rm -rf download/
|
||||
|
||||
# Kept for now in case someone updates their checkout of cg_clif before running clean_all.sh
|
||||
# FIXME remove at some point in the future
|
||||
rm -rf rand/ regex/ simple-raytracer/ portable-simd/ abi-checker/ abi-cafe/
|
||||
|
Loading…
Reference in New Issue
Block a user