]> git.proxmox.com Git - cargo.git/commitdiff
Prepare for buildbot automation
authorAlex Crichton <alex@alexcrichton.com>
Wed, 25 Jun 2014 23:31:57 +0000 (16:31 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 27 Jun 2014 03:25:30 +0000 (20:25 -0700)
* 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.

.travis.check.style.sh [deleted file]
.travis.install.deps.sh
.travis.yml
Makefile
libs/hammer.rs
libs/toml-rs
tests/check-style.sh [new file with mode: 0755]
tests/support/paths.rs
tests/test_cargo_compile_path_deps.rs
tests/test_shell.rs

diff --git a/.travis.check.style.sh b/.travis.check.style.sh
deleted file mode 100755 (executable)
index 72d7ac6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-echo "checking for lines over 100 characters..."
-find src tests -name '*.rs' | xargs grep '.\{101,\}' && exit 1
-echo "ok"
index 39750a392c253944dfd4efefb453f3ead31e046a..ff4f5007e3139520f57cc4715c30e3a5a336320f 100755 (executable)
@@ -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
index b921ca20dc2a38ba1be4df4a6f029b92dd518883..2737490790bd0b058844001042e81f143a04d913 100644 (file)
@@ -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
index 2e852de1fa777ee6ee6b6f585d75851e675bd3d4..26ea4224d8952b0e155f3420a666c148be3ff390 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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 \
@@ -15,8 +22,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))
@@ -66,7 +73,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
@@ -81,8 +91,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:
 
+
index 0baf235e24d6c3e20f3ae8368d1c0fce08138bd4..d2467aa7a6da51945bce72c3ede891d00b11c78f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0baf235e24d6c3e20f3ae8368d1c0fce08138bd4
+Subproject commit d2467aa7a6da51945bce72c3ede891d00b11c78f
index 66c83483f880c87e44c57617bec2615e945cce14..7ba80c5ac4a3f6bc3801bb4ac86fd65a569a07ba 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 66c83483f880c87e44c57617bec2615e945cce14
+Subproject commit 7ba80c5ac4a3f6bc3801bb4ac86fd65a569a07ba
diff --git a/tests/check-style.sh b/tests/check-style.sh
new file mode 100755 (executable)
index 0000000..72d7ac6
--- /dev/null
@@ -0,0 +1,3 @@
+echo "checking for lines over 100 characters..."
+find src tests -name '*.rs' | xargs grep '.\{101,\}' && exit 1
+echo "ok"
index 99de20a2280e011fa85f3a7cd00cc4729cec7fbe..5dc6c86c3026707c62125f3fb5ee0d170d042a74 100644 (file)
@@ -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()
 }
 
index 635808eb16564a938fe0219e5a5642db87129602..d502da4daaffeb84676835860a22124bd5ae09ec 100644 (file)
@@ -350,7 +350,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(),
index df730a2148027b8d5a4a5e4358c32cf0231b30db..aa6d6bb07ce7b640e84124f81dcfa9afc0e238a6 100644 (file)
@@ -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};
@@ -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);