Skip to content

Commit 4781eb3

Browse files
committed
travis: Add a distcheck target
This commit adds a new entry to the Travis matrix which performs a "distcheck", which basically means that we create a tarball, extract that tarball, and then build/test inside there. This ensures that the tarballs we produce are actually able to be built/tested! Along the way this also updates the rustbuild distcheck definition to propagate the configure args from the top-level invocation. Closes #38691
1 parent d0881ea commit 4781eb3

File tree

6 files changed

+45
-7
lines changed

6 files changed

+45
-7
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ matrix:
2626
- env: IMAGE=x86_64-gnu-make
2727
- env: IMAGE=x86_64-gnu-llvm-3.7 ALLOW_PR=1 RUST_BACKTRACE=1
2828
- env: IMAGE=x86_64-musl
29+
- env: IMAGE=x86_64-gnu-distcheck
2930

3031
# OSX builders
3132
- env: >

src/bootstrap/check.rs

+1
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ pub fn distcheck(build: &Build) {
554554
.current_dir(&dir);
555555
build.run(&mut cmd);
556556
build.run(Command::new("./configure")
557+
.args(&build.config.configure_args)
557558
.current_dir(&dir));
558559
build.run(Command::new(build_helper::make(&build.config.build))
559560
.arg("check")

src/bootstrap/config.rs

+6
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ pub struct Config {
9494
pub nodejs: Option<PathBuf>,
9595
pub gdb: Option<PathBuf>,
9696
pub python: Option<PathBuf>,
97+
pub configure_args: Vec<String>,
9798
}
9899

99100
/// Per-target configuration stored in the global configuration structure.
@@ -519,6 +520,11 @@ impl Config {
519520
"CFG_ENABLE_SCCACHE" if value == "1" => {
520521
self.ccache = Some("sccache".to_string());
521522
}
523+
"CFG_CONFIGURE_ARGS" if value.len() > 0 => {
524+
self.configure_args = value.split_whitespace()
525+
.map(|s| s.to_string())
526+
.collect();
527+
}
522528
_ => {}
523529
}
524530
}

src/bootstrap/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ pub fn cp_r(src: &Path, dst: &Path) {
7676
/// Copies the `src` directory recursively to `dst`. Both are assumed to exist
7777
/// when this function is called. Unwanted files or directories can be skipped
7878
/// by returning `false` from the filter function.
79-
pub fn cp_filtered<F: Fn(&Path) -> bool>(src: &Path, dst: &Path, filter: &F) {
79+
pub fn cp_filtered(src: &Path, dst: &Path, filter: &Fn(&Path) -> bool) {
8080
// Inner function does the actual work
81-
fn recurse<F: Fn(&Path) -> bool>(src: &Path, dst: &Path, relative: &Path, filter: &F) {
81+
fn recurse(src: &Path, dst: &Path, relative: &Path, filter: &Fn(&Path) -> bool) {
8282
for f in t!(fs::read_dir(src)) {
8383
let f = t!(f);
8484
let path = f.path();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
g++ \
5+
make \
6+
file \
7+
curl \
8+
ca-certificates \
9+
python2.7 \
10+
git \
11+
cmake \
12+
sudo \
13+
gdb \
14+
xz-utils
15+
16+
ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783
17+
RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \
18+
tar xJf - -C /usr/local/bin --strip-components=1
19+
20+
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
21+
dpkg -i dumb-init_*.deb && \
22+
rm dumb-init_*.deb
23+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
24+
25+
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu
26+
ENV XPY_RUN test distcheck

src/ci/run.sh

+9-5
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,14 @@ else
4343
ncpus=$(nproc)
4444
fi
4545

46-
make -j $ncpus tidy
47-
make -j $ncpus
48-
if [ ! -z "$XPY_CHECK" ]; then
49-
exec python2.7 $SRC/x.py $XPY_CHECK
46+
if [ ! -z "$XPY_RUN" ]; then
47+
exec python2.7 $SRC/x.py $XPY_RUN
5048
else
51-
exec make $RUST_CHECK_TARGET -j $ncpus
49+
make -j $ncpus tidy
50+
make -j $ncpus
51+
if [ ! -z "$XPY_CHECK" ]; then
52+
exec python2.7 $SRC/x.py $XPY_CHECK
53+
else
54+
exec make $RUST_CHECK_TARGET -j $ncpus
55+
fi
5256
fi

0 commit comments

Comments
 (0)