diff options
author | Carl Lerche <me@carllerche.com> | 2015-07-09 10:00:54 -0700 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2015-07-09 16:28:51 -0700 |
commit | ecbaadde52ed175d25d01f8fb2723a647947d830 (patch) | |
tree | 6994547f0b7c214426826901b841a51ce695681f | |
parent | 1f366ff8285d147cfe3faeb1567c5f047d056a72 (diff) | |
download | nix-ecbaadde52ed175d25d01f8fb2723a647947d830.zip |
Run 32 bit CI builds
-rw-r--r-- | .travis.yml | 14 | ||||
-rw-r--r-- | nix-test/Cargo.toml | 3 | ||||
-rw-r--r-- | nix-test/Makefile | 11 | ||||
-rw-r--r-- | nix-test/build.rs | 28 | ||||
-rw-r--r-- | nix-test/src/const.c | 2 | ||||
-rw-r--r-- | nix-test/src/sizes.c | 3 | ||||
-rw-r--r-- | test/test.rs | 11 |
7 files changed, 57 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml index 2539452a..cad70511 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,17 @@ os: - linux - osx +env: + - ARCH=x86_64 + - ARCH=i686 + script: - - RUST_TEST_THREADS=1 cargo test --features execvpe - - cargo doc --no-deps + - curl -sSL https://raw.githubusercontent.com/carllerche/travis-rust-matrix/master/test | RUST_TEST_THREADS=1 bash + +addons: + apt: + packages: + - gcc-multilib # Deploy documentation to S3 for specific branches. At some # point, it would be nice to also support building docs for @@ -28,7 +36,7 @@ deploy: upload-dir: nix/${TRAVIS_BRANCH}/${TRAVIS_OS_NAME} acl: public_read on: - condition: $TRAVIS_RUST_VERSION == "1.0.0" + condition: "\"$TRAVIS_RUST_VERSION/$ARCH\" == \"1.0.0/x86_64\"" repo: carllerche/nix-rust branch: - master diff --git a/nix-test/Cargo.toml b/nix-test/Cargo.toml index 0082e0e4..e62a8e52 100644 --- a/nix-test/Cargo.toml +++ b/nix-test/Cargo.toml @@ -10,3 +10,6 @@ license = "MIT" [dependencies] libc = "*" + +[build-dependencies] +gcc = "0.3.8" diff --git a/nix-test/Makefile b/nix-test/Makefile deleted file mode 100644 index 67674529..00000000 --- a/nix-test/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -OUT = libnixtest.a -CFLAGS = -fPIC -D$(OS) -OBJS = const.o \ - sizes.o - -$(OUT): $(OBJS) - ar -rcs $@ $^ - -clean: - rm -f $(OBJS) - rm -f $(OUT) diff --git a/nix-test/build.rs b/nix-test/build.rs index b9421014..6717b48c 100644 --- a/nix-test/build.rs +++ b/nix-test/build.rs @@ -1,3 +1,30 @@ +extern crate gcc; + +use std::env; + +pub fn main() { + let target = env::var("TARGET").unwrap(); + + let os = if target.contains("linux") { + "LINUX" + } else if target.contains("darwin") { + "DARWIN" + } else { + "UNKNOWN" + }; + + let mut config = gcc::Config::new(); + + for file in &["src/const.c", "src/sizes.c"] { + config.file(file); + } + + config.define(os, None); + + config.compile("libnixtest.a"); +} + +/* use std::env; use std::process::Command; @@ -28,3 +55,4 @@ pub fn main() { println!("cargo:rustc-flags=-L {}/", out); } +*/ diff --git a/nix-test/src/const.c b/nix-test/src/const.c index 87f6ae5c..42030833 100644 --- a/nix-test/src/const.c +++ b/nix-test/src/const.c @@ -275,8 +275,8 @@ get_int_const(const char* err) { // GET_CONST(SO_PEEK_OFF); GET_CONST(SO_PEERCRED); GET_CONST(SO_SNDBUFFORCE); +#endif return -1; -#endif } diff --git a/nix-test/src/sizes.c b/nix-test/src/sizes.c index 8cf30d20..97a9b4a3 100644 --- a/nix-test/src/sizes.c +++ b/nix-test/src/sizes.c @@ -17,6 +17,9 @@ size_t size_of(const char* type) { + // Builtin + SIZE_OF_T(long); + // sys/socket SIZE_OF_S(sockaddr_storage); diff --git a/test/test.rs b/test/test.rs index 338de581..5a1edf55 100644 --- a/test/test.rs +++ b/test/test.rs @@ -2,6 +2,8 @@ extern crate nix; extern crate libc; extern crate rand; +extern crate nix_test as nixtest; + mod sys; mod test_nix_path; mod test_stat; @@ -33,3 +35,12 @@ mod ports { format!("127.0.0.1:{}", next_port()) } } + +use nixtest::assert_size_of; + +#[test] +pub fn test_size_of_long() { + // This test is mostly here to ensure that 32bit CI is correctly + // functioning + assert_size_of::<usize>("long"); +} |