Skip to content

Commit

Permalink
auto merge of rust-lang#70 : alexcrichton/cargo/buildbot, r=wycats
Browse files Browse the repository at this point in the history
* The installation script was modified to recognize when its running on windows,
  as well as tweaking how it downloads and installs snapshots. The goal here was
  to make the script runnable on buildbot for mac/linux/windows with 32/64 bit
  options on mac/linux.

* The installation script now install rustc to `rustc/bin` in the local
  directory to have parallel builds on buildbot.

* The tests now store all their temporary state locally in the build directory
  to enable parallel builds on buildbot.

* A shell test is ignored which assumed the presence of a TTY output.
  • Loading branch information
bors committed Jun 27, 2014
2 parents a7e560f + ad19a31 commit c919f2f
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 37 deletions.
55 changes: 38 additions & 17 deletions .travis.install.deps.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,50 @@
set -ex
set -x

if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
if [ "${TRAVIS_OS_NAME}" = "osx" ] || [ "${PLATFORM}" = "mac" ]; then
target=apple-darwin
else
elif [ "${TRAVIS_OS_NAME}" = "linux" ] || [ "${PLATFORM}" = "linux" ]; then
target=unknown-linux-gnu
elif [ "${OS}" = "Windows_NT" ] || [ "${PLATFORM}" = "win" ]; then
target=pc-mingw32
windows=1
fi

if [ "${TRAVIS}" = "true" ] && [ "${target}" = "unknown-linux-gnu" ]; then
# Install a 32-bit compiler for linux
sudo apt-get update
sudo apt-get install gcc-multilib
target=unknown-linux-gnu
sudo apt-get install gcc-multilib lib32stdc++6
fi

# Install both 64 and 32 bit libraries. Apparently travis barfs if you try to
# just install the right ones? This should enable cross compilation in the
# future anyway.
curl -O http://static.rust-lang.org/dist/rust-nightly-x86_64-$target.tar.gz
curl -O http://static.rust-lang.org/dist/rust-nightly-i686-$target.tar.gz
tar xfz rust-nightly-x86_64-$target.tar.gz
tar xfz rust-nightly-i686-$target.tar.gz
cp -r rust-nightly-i686-$target/lib/rustlib/i686-$target \
rust-nightly-x86_64-$target/lib/rustlib
(cd rust-nightly-x86_64-$target && \
find lib/rustlib/i686-$target/lib -type f >> \
lib/rustlib/manifest.in)
sudo ./rust-nightly-x86_64-$target/install.sh
if [ -z "${windows}" ]; then
curl -O http://static.rust-lang.org/dist/rust-nightly-i686-$target.tar.gz
tar xfz rust-nightly-i686-$target.tar.gz
curl -O http://static.rust-lang.org/dist/rust-nightly-x86_64-$target.tar.gz
tar xfz rust-nightly-x86_64-$target.tar.gz

export RUSTC="rustc --target=${ARCH}-${target}"
if [ "${BITS}" = "32" ]; then
src=x86_64
dst=i686
else
src=i686
dst=x86_64
fi
cp -r rust-nightly-$src-$target/lib/rustlib/$src-$target \
rust-nightly-$dst-$target/lib/rustlib
(cd rust-nightly-$dst-$target && \
find lib/rustlib/$src-$target/lib -type f >> \
lib/rustlib/manifest.in)

set +ex
./rust-nightly-$dst-$target/install.sh --prefix=rustc
rm -rf rust-nightly-$src-$target
rm -rf rust-nightly-$dst-$target
else
rm -rf *.exe rustc
curl -O http://static.rust-lang.org/dist/rust-nightly-install.exe
innounp -y -x rust-nightly-install.exe
mv '{app}' rustc
fi

set +x
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
language: rust

install:
- . ./.travis.install.deps.sh
- sh ./.travis.install.deps.sh

script:
- ./.travis.check.style.sh
- make CC="$CC" RUSTC="$RUSTC" -j4
- make CC="$CC" RUSTC="$RUSTC" test -j4
- make
- make test -j4
- make install DESTDIR=${PWD}/destdir

env:
- ARCH=i686 CC='cc -m32'
- ARCH=x86_64 CC=cc
- BITS=32
- BITS=64

os:
- linux
Expand Down
21 changes: 16 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
RUSTC ?= rustc
RUSTC_FLAGS ?=
DESTDIR ?=
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin

ifeq ($(wildcard rustc/bin),)
export RUSTC := rustc
else
export RUSTC := $(CURDIR)/rustc/bin/rustc
endif

export PATH := $(PATH):$(CURDIR)/rustc/bin

# Link flags to pull in dependencies
BINS = cargo \
cargo-build \
Expand All @@ -16,8 +23,8 @@ BINS = cargo \
SRC = $(shell find src -name '*.rs' -not -path 'src/bin*')

DEPS = -L libs/hammer.rs/target -L libs/toml-rs/build
TOML = libs/toml-rs/build/$(shell rustc --crate-file-name libs/toml-rs/src/toml.rs)
HAMMER = libs/hammer.rs/target/$(shell rustc --crate-type=lib --crate-file-name libs/hammer.rs/src/hammer.rs)
TOML = libs/toml-rs/build/$(shell $(RUSTC) --crate-file-name libs/toml-rs/src/toml.rs)
HAMMER = libs/hammer.rs/target/$(shell $(RUSTC) --crate-type=lib --crate-file-name libs/hammer.rs/src/hammer.rs)
HAMCREST = libs/hamcrest-rust/target/libhamcrest.timestamp
LIBCARGO = target/libcargo.timestamp
BIN_TARGETS = $(patsubst %,target/%,$(BINS))
Expand Down Expand Up @@ -67,7 +74,10 @@ test-unit: target/tests/test-unit
test-integration: target/tests/test-integration
$< $(only)

test: test-unit test-integration
test: test-unit test-integration style

style:
sh tests/check-style.sh

clean:
rm -rf target
Expand All @@ -82,8 +92,9 @@ install:
install target/cargo target/cargo-* $(DESTDIR)$(BINDIR)

# Setup phony tasks
.PHONY: all clean distclean test test-unit test-integration libcargo
.PHONY: all clean distclean test test-unit test-integration libcargo style

# Disable unnecessary built-in rules
.SUFFIXES:


2 changes: 1 addition & 1 deletion libs/hammer.rs
Submodule hammer.rs updated 1 files
+1 −1 Makefile
2 changes: 1 addition & 1 deletion libs/toml-rs
File renamed without changes.
5 changes: 3 additions & 2 deletions tests/support/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ static mut NEXT_ID: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;

pub fn root() -> Path {
let my_id = *task_id.get().unwrap();
let path = os::tmpdir().join(CARGO_INTEGRATION_TEST_DIR)
.join(format!("test-{}", my_id));
let path = os::self_exe_path().unwrap()
.join(CARGO_INTEGRATION_TEST_DIR)
.join(format!("test-{}", my_id));
realpath(&path).unwrap()
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cargo_compile_path_deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ test!(nested_deps_recompile {
"#).assert();

// This shouldn't recompile `bar`
assert_that(p.process("cargo-build"),
assert_that(p.process(cargo_dir().join("cargo-build")),
execs().with_stdout(format!("{} bar v0.5.0 (file:{})\n\
{} foo v0.5.0 (file:{})\n",
FRESH, bar.display(),
Expand Down
8 changes: 4 additions & 4 deletions tests/test_shell.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#![cfg(not(windows))] // getting the actual colored output is a little different
// on windows, so it's tough to get a reference copy of all
// the color

use support::{ResultTest,Tap,shell_writes};
use hamcrest::{assert_that};
use std::io::{MemWriter, BufWriter, IoResult};
Expand Down Expand Up @@ -37,6 +33,10 @@ test!(color_explicitly_disabled {
})

test!(colored_shell {
let term: Option<TerminfoTerminal<MemWriter>> =
Terminal::new(MemWriter::new());
if term.is_none() { return }

let config = ShellConfig { color: true, verbose: true, tty: true };
let mut buf: Vec<u8> = Vec::from_elem(100, 0 as u8);

Expand Down

0 comments on commit c919f2f

Please sign in to comment.