Make x test distcheck more self-contained
This commit is contained in:
parent
ee361e8fca
commit
a3229e4101
3 changed files with 36 additions and 24 deletions
|
|
@ -3117,45 +3117,48 @@ impl Step for Distcheck {
|
|||
///
|
||||
/// FIXME(#136822): dist components are under-tested.
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
builder.info("Distcheck");
|
||||
let dir = builder.tempdir().join("distcheck");
|
||||
let _ = fs::remove_dir_all(&dir);
|
||||
t!(fs::create_dir_all(&dir));
|
||||
// Use a temporary directory completely outside the current checkout, to avoid reusing any
|
||||
// local source code, built artifacts or configuration by accident
|
||||
let root_dir = std::env::temp_dir().join("distcheck");
|
||||
|
||||
// Guarantee that these are built before we begin running.
|
||||
builder.ensure(dist::PlainSourceTarball);
|
||||
builder.ensure(dist::Src);
|
||||
// Check that we can build some basic things from the plain source tarball
|
||||
builder.info("Distcheck plain source tarball");
|
||||
let plain_src_tarball = builder.ensure(dist::PlainSourceTarball);
|
||||
let plain_src_dir = root_dir.join("distcheck-plain-src");
|
||||
builder.clear_dir(&plain_src_dir);
|
||||
|
||||
command("tar")
|
||||
.arg("-xf")
|
||||
.arg(builder.ensure(dist::PlainSourceTarball).tarball())
|
||||
.arg(plain_src_tarball.tarball())
|
||||
.arg("--strip-components=1")
|
||||
.current_dir(&dir)
|
||||
.current_dir(&plain_src_dir)
|
||||
.run(builder);
|
||||
command("./configure")
|
||||
.arg("--set")
|
||||
.arg("rust.omit-git-hash=false")
|
||||
.args(&builder.config.configure_args)
|
||||
.arg("--enable-vendor")
|
||||
.current_dir(&dir)
|
||||
.current_dir(&plain_src_dir)
|
||||
.run(builder);
|
||||
command(helpers::make(&builder.config.host_target.triple))
|
||||
.arg("check")
|
||||
.current_dir(&dir)
|
||||
.current_dir(&plain_src_dir)
|
||||
.run(builder);
|
||||
|
||||
// Now make sure that rust-src has all of libstd's dependencies
|
||||
builder.info("Distcheck rust-src");
|
||||
let dir = builder.tempdir().join("distcheck-src");
|
||||
let _ = fs::remove_dir_all(&dir);
|
||||
t!(fs::create_dir_all(&dir));
|
||||
let src_tarball = builder.ensure(dist::Src);
|
||||
let src_dir = root_dir.join("distcheck-src");
|
||||
builder.clear_dir(&src_dir);
|
||||
|
||||
command("tar")
|
||||
.arg("-xf")
|
||||
.arg(builder.ensure(dist::Src).tarball())
|
||||
.arg(src_tarball.tarball())
|
||||
.arg("--strip-components=1")
|
||||
.current_dir(&dir)
|
||||
.current_dir(&src_dir)
|
||||
.run(builder);
|
||||
|
||||
let toml = dir.join("rust-src/lib/rustlib/src/rust/library/std/Cargo.toml");
|
||||
let toml = src_dir.join("rust-src/lib/rustlib/src/rust/library/std/Cargo.toml");
|
||||
command(&builder.initial_cargo)
|
||||
// Will read the libstd Cargo.toml
|
||||
// which uses the unstable `public-dependency` feature.
|
||||
|
|
@ -3163,7 +3166,7 @@ impl Step for Distcheck {
|
|||
.arg("generate-lockfile")
|
||||
.arg("--manifest-path")
|
||||
.arg(&toml)
|
||||
.current_dir(&dir)
|
||||
.current_dir(&src_dir)
|
||||
.run(builder);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1950,6 +1950,20 @@ impl Build {
|
|||
t!(fs::remove_dir_all(dir))
|
||||
}
|
||||
|
||||
/// Make sure that `dir` will be an empty existing directory after this function ends.
|
||||
/// If it existed before, it will be first deleted.
|
||||
fn clear_dir(&self, dir: &Path) {
|
||||
if self.config.dry_run() {
|
||||
return;
|
||||
}
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
let _span = trace_io!("dir-clear", ?dir);
|
||||
|
||||
let _ = std::fs::remove_dir_all(dir);
|
||||
self.create_dir(dir);
|
||||
}
|
||||
|
||||
fn read_dir(&self, dir: &Path) -> impl Iterator<Item = fs::DirEntry> {
|
||||
let iter = match fs::read_dir(dir) {
|
||||
Ok(v) => v,
|
||||
|
|
|
|||
|
|
@ -33,9 +33,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
# We are disabling CI LLVM since distcheck is an offline build.
|
||||
ENV NO_DOWNLOAD_CI_LLVM 1
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --set rust.omit-git-hash=false
|
||||
ENV SCRIPT python3 ../x.py --stage 2 test distcheck
|
||||
ENV DIST_SRC 1
|
||||
ENV SCRIPT python3 ../x.py test distcheck
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue