Skip to content

Commit

Permalink
Rollup merge of rust-lang#44603 - SimonSapin:stylo, r=alexcrichton
Browse files Browse the repository at this point in the history
Add Stylo and WebRender to src/tools/cargotest

This is a subset of Servo that takes relatively less time to compile and does not use unstable Rust features.
  • Loading branch information
frewsxcv authored Sep 16, 2017
2 parents c1eb083 + a589684 commit 101db06
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ matrix:
- env: IMAGE=x86_64-gnu
- env: IMAGE=x86_64-gnu-full-bootstrap
- env: IMAGE=x86_64-gnu-aux
- env: IMAGE=x86_64-gnu-cargotest
- env: IMAGE=x86_64-gnu-debug
- env: IMAGE=x86_64-gnu-nopt
- env: IMAGE=x86_64-gnu-distcheck
Expand Down
5 changes: 5 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ environment:
RUST_CHECK_TARGET: check-aux
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc

# MSVC cargotest
- MSYS_BITS: 64
SCRIPT: python x.py src/tools/cargotest
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc

# 32/64-bit MinGW builds.
#
# We are using MinGW with posix threads since LLVM does not compile with
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ check:
$(Q)$(BOOTSTRAP) test $(BOOTSTRAP_ARGS)
check-aux:
$(Q)$(BOOTSTRAP) test \
src/tools/cargotest \
src/tools/cargo \
src/tools/rls \
src/test/pretty \
Expand Down
21 changes: 21 additions & 0 deletions src/ci/docker/x86_64-gnu-cargotest/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ubuntu:16.04

RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
file \
curl \
ca-certificates \
python2.7 \
git \
cmake \
libssl-dev \
sudo \
xz-utils \
pkg-config

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu
ENV SCRIPT python2.7 ../x.py test src/tools/cargotest
37 changes: 33 additions & 4 deletions src/tools/cargotest/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct Test {
name: &'static str,
sha: &'static str,
lock: Option<&'static str>,
packages: &'static [&'static str],
}

const TEST_REPOS: &'static [Test] = &[
Expand All @@ -27,30 +28,51 @@ const TEST_REPOS: &'static [Test] = &[
repo: "https://github.com/iron/iron",
sha: "21c7dae29c3c214c08533c2a55ac649b418f2fe3",
lock: Some(include_str!("lockfiles/iron-Cargo.lock")),
packages: &[],
},
Test {
name: "ripgrep",
repo: "https://github.com/BurntSushi/ripgrep",
sha: "b65bb37b14655e1a89c7cd19c8b011ef3e312791",
lock: None,
packages: &[],
},
Test {
name: "tokei",
repo: "https://github.com/Aaronepower/tokei",
sha: "5e11c4852fe4aa086b0e4fe5885822fbe57ba928",
lock: None,
packages: &[],
},
Test {
name: "treeify",
repo: "https://github.com/dzamlo/treeify",
sha: "999001b223152441198f117a68fb81f57bc086dd",
lock: None,
packages: &[],
},
Test {
name: "xsv",
repo: "https://github.com/BurntSushi/xsv",
sha: "a9a7163f2a2953cea426fee1216bec914fe2f56a",
lock: None,
packages: &[],
},
Test {
name: "servo",
repo: "https://github.com/servo/servo",
sha: "f1da967ef707bbc77f023daf28093201e96e19c5",
lock: None,
// Only test Stylo a.k.a. Quantum CSS, the parts of Servo going into Firefox.
// This takes much less time to build than all of Servo and supports stable Rust.
packages: &["stylo_tests", "selectors"],
},
Test {
name: "webrender",
repo: "https://github.com/servo/webrender",
sha: "2d8d66e1b679b9ce10317ffd043bc87f62e0030c",
lock: None,
packages: &[],
},
];

Expand All @@ -74,7 +96,7 @@ fn test_repo(cargo: &Path, out_dir: &Path, test: &Test) {
.write_all(lockfile.as_bytes())
.expect("");
}
if !run_cargo_test(cargo, &dir) {
if !run_cargo_test(cargo, &dir, test.packages) {
panic!("tests failed for {}", test.repo);
}
}
Expand Down Expand Up @@ -134,9 +156,16 @@ fn clone_repo(test: &Test, out_dir: &Path) -> PathBuf {
out_dir
}

fn run_cargo_test(cargo_path: &Path, crate_path: &Path) -> bool {
let status = Command::new(cargo_path)
.arg("test")
fn run_cargo_test(cargo_path: &Path, crate_path: &Path, packages: &[&str]) -> bool {
let mut command = Command::new(cargo_path);
command.arg("test");
if packages.is_empty() {
command.arg("--all");
}
for name in packages {
command.arg("-p").arg(name);
}
let status = command
// Disable rust-lang/cargo's cross-compile tests
.env("CFG_DISABLE_CROSS_TESTS", "1")
.current_dir(crate_path)
Expand Down

0 comments on commit 101db06

Please sign in to comment.