2017-11-13 14:33:12 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-10-11 12:21:40 -07:00
|
|
|
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2017-01-28 13:38:06 -08:00
|
|
|
if [ "$NO_CHANGE_USER" = "" ]; then
|
|
|
|
if [ "$LOCAL_USER_ID" != "" ]; then
|
|
|
|
useradd --shell /bin/bash -u $LOCAL_USER_ID -o -c "" -m user
|
|
|
|
export HOME=/home/user
|
|
|
|
unset LOCAL_USER_ID
|
|
|
|
exec su --preserve-environment -c "env PATH=$PATH \"$0\"" user
|
|
|
|
fi
|
2016-10-11 12:21:40 -07:00
|
|
|
fi
|
|
|
|
|
2017-02-25 00:00:47 -08:00
|
|
|
ci_dir=`cd $(dirname $0) && pwd`
|
|
|
|
source "$ci_dir/shared.sh"
|
|
|
|
|
2017-06-01 09:48:48 -06:00
|
|
|
if [ "$TRAVIS" == "true" ] && [ "$TRAVIS_BRANCH" != "auto" ]; then
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-quiet-tests"
|
|
|
|
fi
|
|
|
|
|
2017-01-13 15:35:58 -08:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-sccache"
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-manage-submodules"
|
2017-02-10 22:59:40 +02:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-locked-deps"
|
2017-02-15 15:57:06 -08:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-cargo-openssl-static"
|
2017-01-13 15:35:58 -08:00
|
|
|
|
2017-02-14 09:54:58 -08:00
|
|
|
if [ "$DIST_SRC" = "" ]; then
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-dist-src"
|
|
|
|
fi
|
|
|
|
|
2017-01-13 15:35:58 -08:00
|
|
|
# If we're deploying artifacts then we set the release channel, otherwise if
|
2017-11-21 15:33:45 +01:00
|
|
|
# we're not deploying then we want to be sure to enable all assertions because
|
2017-01-13 15:35:58 -08:00
|
|
|
# we'll be running tests
|
|
|
|
#
|
|
|
|
# FIXME: need a scheme for changing this `nightly` value to `beta` and `stable`
|
|
|
|
# either automatically or manually.
|
2017-11-30 18:21:11 +08:00
|
|
|
export RUST_RELEASE_CHANNEL=nightly
|
2017-02-11 17:28:29 -08:00
|
|
|
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
|
2017-11-30 18:21:11 +08:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
|
2017-01-15 18:50:22 -08:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
|
2017-01-13 15:35:58 -08:00
|
|
|
|
|
|
|
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
|
2017-02-11 17:28:29 -08:00
|
|
|
elif [ "$DEPLOY_ALT" != "" ]; then
|
2017-11-06 18:57:51 +01:00
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-assertions"
|
2017-01-13 15:35:58 -08:00
|
|
|
fi
|
2017-01-18 16:04:22 -08:00
|
|
|
else
|
2017-09-16 17:25:12 -07:00
|
|
|
# We almost always want debug assertions enabled, but sometimes this takes too
|
|
|
|
# long for too little benefit, so we just turn them off.
|
|
|
|
if [ "$NO_DEBUG_ASSERTIONS" = "" ]; then
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-debug-assertions"
|
|
|
|
fi
|
2017-01-18 16:04:22 -08:00
|
|
|
|
|
|
|
# In general we always want to run tests with LLVM assertions enabled, but not
|
|
|
|
# all platforms currently support that, so we have an option to disable.
|
|
|
|
if [ "$NO_LLVM_ASSERTIONS" = "" ]; then
|
|
|
|
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-assertions"
|
|
|
|
fi
|
2016-11-16 12:31:19 -08:00
|
|
|
fi
|
|
|
|
|
2017-05-18 00:33:20 +08:00
|
|
|
travis_fold start configure
|
|
|
|
travis_time_start
|
2017-01-13 15:35:58 -08:00
|
|
|
$SRC/configure $RUST_CONFIGURE_ARGS
|
2017-05-18 00:33:20 +08:00
|
|
|
travis_fold end configure
|
|
|
|
travis_time_finish
|
|
|
|
|
|
|
|
travis_fold start make-prepare
|
|
|
|
travis_time_start
|
2017-02-25 00:00:47 -08:00
|
|
|
retry make prepare
|
2017-05-18 00:33:20 +08:00
|
|
|
travis_fold end make-prepare
|
|
|
|
travis_time_finish
|
2016-10-11 12:21:40 -07:00
|
|
|
|
2017-07-02 23:32:42 -05:00
|
|
|
travis_fold start check-bootstrap
|
|
|
|
travis_time_start
|
|
|
|
make check-bootstrap
|
|
|
|
travis_fold end check-bootstrap
|
|
|
|
travis_time_finish
|
|
|
|
|
2016-10-11 12:21:40 -07:00
|
|
|
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
|
|
|
ncpus=$(sysctl -n hw.ncpu)
|
|
|
|
else
|
2017-01-18 16:04:22 -08:00
|
|
|
ncpus=$(grep processor /proc/cpuinfo | wc -l)
|
2016-10-11 12:21:40 -07:00
|
|
|
fi
|
|
|
|
|
2016-12-31 17:42:40 -08:00
|
|
|
if [ ! -z "$SCRIPT" ]; then
|
|
|
|
sh -x -c "$SCRIPT"
|
2016-11-16 12:31:19 -08:00
|
|
|
else
|
2017-05-18 00:33:20 +08:00
|
|
|
do_make() {
|
|
|
|
travis_fold start "make-$1"
|
|
|
|
travis_time_start
|
|
|
|
echo "make -j $ncpus $1"
|
|
|
|
make -j $ncpus "$1"
|
|
|
|
local retval=$?
|
|
|
|
travis_fold end "make-$1"
|
|
|
|
travis_time_finish
|
|
|
|
return $retval
|
|
|
|
}
|
|
|
|
|
|
|
|
do_make tidy
|
|
|
|
do_make all
|
|
|
|
do_make "$RUST_CHECK_TARGET"
|
2016-11-16 12:31:19 -08:00
|
|
|
fi
|