提交 27dd6dd3 编写于 作者: A Alex Crichton

Tweak Travis to use GCE

Travis CI has new infrastructure using the Google Compute Engine which has both
faster CPUs and more memory, and we've been encouraged to switch as it should
help our build times! The only downside currently, however, is that IPv6 is
disabled, causing a number of standard library tests to fail.

Consequently this commit tweaks our travis config in a few ways:

* ccache is disabled as it's not working on GCE just yet
* Docker is used to run tests inside which reportedly will get IPv6 working
* A system LLVM installation is used instead of building LLVM itself. This is
  primarily done to reduce build times, but we want automation for this sort of
  behavior anyway and we can extend this in the future with building from source
  as well if needed.
* gcc-specific logic is removed as the docker image for Ubuntu gives us a
  recent-enough gcc by default.
上级 19fe7b6d
# ccache support is disabled unless your language is a C-derivative. However
# `language: C` unconditionally sets `CC=compiler`. If we just set it in our
# `env` it will be overwritten by the default (gcc 4.6).
language: c
compiler: /usr/bin/gcc-4.7
cache: ccache
sudo: false
sudo: required
services:
- docker
# The test suite is in general way too stressful for travis, especially in
# terms of time limit and reliability. In the past we've tried to scale things
# back to only build the stage1 compiler and run a subset of tests, but this
# didn't end up panning out very well.
#
# As a result, we're just using travis to run `make tidy` and *only* build
# stage1 but *not* test it for now (a strict subset of the bootstrap). This will
# catch "obvious" errors like style or not even compiling.
#
# We need gcc4.7 or higher to build LLVM, and travis (well, Ubuntu 12.04)
# currently ships with 4.6. Gotta download our own.
before_script:
- ./configure --enable-ccache
script:
- make tidy && make check -j4
# LLVM takes awhile to check out and otherwise we'll manage the submodules in
# our configure script, so disable auto submodule management.
git:
submodules: false
env:
- CXX=/usr/bin/g++-4.7
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.7
- g++-4.7
before_install:
- docker build -t rust -f src/etc/Dockerfile src/etc
script:
- docker run --privileged -tv `pwd`:/build rust
sh -c "
./configure --llvm-root=/usr/lib/llvm-3.7 &&
make tidy &&
make check -j4
"
# Real testing happens on http://buildbot.rust-lang.org/
#
......
FROM ubuntu:latest
RUN echo 'deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main' | \
sudo tee -a /etc/apt/sources.list
RUN echo 'deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main' | \
sudo tee -a /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y install curl make g++ python2.7 git zlib1g-dev libedit-dev
RUN apt-get -y --force-yes install llvm-3.7-tools
RUN mkdir /build
WORKDIR /build
......@@ -185,14 +185,13 @@ fn each_ip(f: &mut FnMut(SocketAddr, SocketAddr)) {
}
}
// FIXME #11530 this fails on android because tests are run as root
#[cfg_attr(any(windows, target_os = "android"), ignore)]
#[test]
fn bind_error() {
let addr = SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), 1);
match UdpSocket::bind(&addr) {
match UdpSocket::bind("1.1.1.1:9999") {
Ok(..) => panic!(),
Err(e) => assert_eq!(e.kind(), ErrorKind::PermissionDenied),
Err(e) => {
assert_eq!(e.kind(), ErrorKind::AddrNotAvailable)
}
}
}
......
......@@ -625,17 +625,20 @@ fn exit_reported_right() {
drop(p.wait());
}
#[cfg(unix)]
#[cfg(all(unix, not(target_os="android")))]
#[test]
fn signal_reported_right() {
use os::unix::process::ExitStatusExt;
let p = Command::new("/bin/sh").arg("-c").arg("kill -9 $$").spawn();
assert!(p.is_ok());
let mut p = p.unwrap();
let mut p = Command::new("/bin/sh")
.arg("-c").arg("read a")
.stdin(Stdio::piped())
.spawn().unwrap();
p.kill().unwrap();
match p.wait().unwrap().signal() {
Some(9) => {},
result => panic!("not terminated by signal 9 (instead, {:?})", result),
result => panic!("not terminated by signal 9 (instead, {:?})",
result),
}
}
......
......@@ -450,6 +450,15 @@ mod tests {
use slice;
use sys::{self, c, cvt, pipe};
macro_rules! t {
($e:expr) => {
match $e {
Ok(t) => t,
Err(e) => panic!("received error for `{}`: {}", stringify!($e), e),
}
}
}
#[cfg(not(target_os = "android"))]
extern {
#[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
......@@ -473,24 +482,26 @@ fn test_process_mask() {
unsafe {
// Test to make sure that a signal mask does not get inherited.
let cmd = Command::new(OsStr::new("cat"));
let (stdin_read, stdin_write) = sys::pipe::anon_pipe().unwrap();
let (stdout_read, stdout_write) = sys::pipe::anon_pipe().unwrap();
let (stdin_read, stdin_write) = t!(sys::pipe::anon_pipe());
let (stdout_read, stdout_write) = t!(sys::pipe::anon_pipe());
let mut set: c::sigset_t = mem::uninitialized();
let mut old_set: c::sigset_t = mem::uninitialized();
cvt(c::sigemptyset(&mut set)).unwrap();
cvt(sigaddset(&mut set, libc::SIGINT)).unwrap();
cvt(c::pthread_sigmask(c::SIG_SETMASK, &set, &mut old_set)).unwrap();
t!(cvt(c::sigemptyset(&mut set)));
t!(cvt(sigaddset(&mut set, libc::SIGINT)));
t!(cvt(c::pthread_sigmask(c::SIG_SETMASK, &set, &mut old_set)));
let cat = Process::spawn(&cmd, Stdio::Raw(stdin_read.raw()),
Stdio::Raw(stdout_write.raw()),
Stdio::None).unwrap();
let cat = t!(Process::spawn(&cmd, Stdio::Raw(stdin_read.raw()),
Stdio::Raw(stdout_write.raw()),
Stdio::None));
drop(stdin_read);
drop(stdout_write);
cvt(c::pthread_sigmask(c::SIG_SETMASK, &old_set, ptr::null_mut())).unwrap();
t!(cvt(c::pthread_sigmask(c::SIG_SETMASK, &old_set,
ptr::null_mut())));
cvt(libc::funcs::posix88::signal::kill(cat.id() as libc::pid_t, libc::SIGINT)).unwrap();
t!(cvt(libc::funcs::posix88::signal::kill(cat.id() as libc::pid_t,
libc::SIGINT)));
// We need to wait until SIGINT is definitely delivered. The
// easiest way is to write something to cat, and try to read it
// back: if SIGINT is unmasked, it'll get delivered when cat is
......@@ -504,7 +515,7 @@ fn test_process_mask() {
assert!(ret == 0);
}
cat.wait().unwrap();
t!(cat.wait());
}
}
}
Subproject commit 3c88bf78f97d2cd8130b16eecb0eeb84888cd494
Subproject commit 62ad301a2407a7aca50c1d5120c63597d676d29f
......@@ -951,10 +951,5 @@ LLVMRustBuildLandingPad(LLVMBuilderRef Builder,
unsigned NumClauses,
const char* Name,
LLVMValueRef F) {
#if LLVM_VERSION_MINOR >= 7
unwrap<Function>(F)->setPersonalityFn(unwrap<Constant>(PersFn));
return LLVMBuildLandingPad(Builder, Ty, NumClauses, Name);
#else
return LLVMBuildLandingPad(Builder, Ty, PersFn, NumClauses, Name);
#endif
}
......@@ -30,26 +30,25 @@
($e:expr) => (match $e { Ok(e) => e, Err(e) => panic!("error: {}", e) })
}
#[test]
fn test_destroy_once() {
let mut p = sleeper();
match p.kill() {
Ok(()) => {}
Err(e) => panic!("error: {}", e),
}
t!(p.kill());
}
#[cfg(unix)]
pub fn sleeper() -> Child {
Command::new("sleep").arg("1000").spawn().unwrap()
t!(Command::new("sleep").arg("1000").spawn())
}
#[cfg(windows)]
pub fn sleeper() -> Child {
// There's a `timeout` command on windows, but it doesn't like having
// its output piped, so instead just ping ourselves a few times with
// gaps in between so we're sure this process is alive for awhile
Command::new("ping").arg("127.0.0.1").arg("-n").arg("1000").spawn().unwrap()
t!(Command::new("ping").arg("127.0.0.1").arg("-n").arg("1000").spawn())
}
#[test]
fn test_destroy_twice() {
let mut p = sleeper();
t!(p.kill()); // this shouldn't crash...
......@@ -58,21 +57,20 @@ fn test_destroy_twice() {
#[test]
fn test_destroy_actually_kills() {
#[cfg(all(unix,not(target_os="android")))]
static BLOCK_COMMAND: &'static str = "cat";
#[cfg(all(unix,target_os="android"))]
static BLOCK_COMMAND: &'static str = "/system/bin/cat";
#[cfg(windows)]
static BLOCK_COMMAND: &'static str = "cmd";
let cmd = if cfg!(windows) {
"cmd"
} else if cfg!(target_os = "android") {
"/system/bin/cat"
} else {
"cat"
};
// this process will stay alive indefinitely trying to read from stdin
let mut p = Command::new(BLOCK_COMMAND)
.stdin(Stdio::piped())
.spawn().unwrap();
let mut p = t!(Command::new(cmd)
.stdin(Stdio::piped())
.spawn());
p.kill().unwrap();
t!(p.kill());
// Don't let this test time out, this should be quick
let (tx, rx) = channel();
......@@ -82,7 +80,7 @@ fn test_destroy_actually_kills() {
process::exit(1);
}
});
let code = p.wait().unwrap().code();
let code = t!(p.wait()).code();
if cfg!(windows) {
assert!(code.is_some());
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册