Skip to content

WIP: Run tensorflow-sys' test under valgrind #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f9d3df3
Add a 'nightly' feature (disabled by default) for using the system al…
nbigaouette-eai Mar 15, 2017
4704a62
Make sure to compile the -sys test, even if we don't run them.
nbigaouette-eai Mar 15, 2017
1f597a9
Run the tensorflow-sys tests through valgrind
nbigaouette-eai Mar 15, 2017
2ab2a8c
Travis: Make sure to run nightly too
nbigaouette-eai Mar 15, 2017
517034f
Run 'tree' to get a whole picture of the directory tree
nbigaouette-eai Mar 15, 2017
fccd1c7
Disable bazel for now; let's use the pre-built binary.
nbigaouette-eai Mar 15, 2017
c10fcc0
Use a variable to store valgrind arguments
nbigaouette-eai Mar 15, 2017
e5b56b8
Move tests on `tensorflow` crate after those on `tensorflow-sys`
nbigaouette-eai Mar 15, 2017
24fcc60
Also run tests on main crate through valgrind
nbigaouette-eai Mar 15, 2017
cad14a1
Revert "Run 'tree' to get a whole picture of the directory tree"
nbigaouette-eai Mar 15, 2017
981b474
Valgrind obviously needs to be installed
nbigaouette-eai Mar 15, 2017
cab1fc0
Export the path to where prebuilt tensorflow library was extracted
nbigaouette-eai Mar 15, 2017
0990db7
Instead of running tests using valgrind+cargo, call the binaries dire…
nbigaouette-eai Mar 15, 2017
08765a6
Fix: Don't use echo
nbigaouette-eai Mar 15, 2017
36dd657
Print prebuilt directory content
nbigaouette-eai Mar 15, 2017
da6e3d6
Bug fix: Make sure $TFSO resolves to the directory containing the .so
nbigaouette-eai Mar 15, 2017
e241063
Disable running the linking test as valgrind loops with the same error.
nbigaouette-eai Mar 15, 2017
680fc93
Just export LD_LIBRARY_PATH as Travis can't find the lib
nbigaouette-eai Mar 15, 2017
ab27927
Disable running valgrind on main crate since it doesn't support night…
nbigaouette-eai Mar 15, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 57 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,73 @@ dist: trusty # still in beta, but required for the prebuilt TF binaries

cache:
cargo: true
directories:
- $HOME/.cache/bazel
# FIXME: We don't need bazel for now
# directories:
# - $HOME/.cache/bazel

rust: stable
env:
- valgrind="valgrind --error-exitcode=42 --leak-check=full"

rust:
- stable
# FIXME: Should nightly be allowed to fail? Should a specific nightly
# be pinned and _not_ allowed to fail?
- nightly

install:
- export CC="gcc-4.9" CXX="g++-4.9"
- source travis-ci/install.sh
# FIXME: We don't need bazel for now
# - source travis-ci/install.sh

script:
- export RUST_BACKTRACE=1
# Build and test the tensorflow-sys crate first
# Compile the tests, but don't run them. This makes sure the prebuilt tensorflow.so
# is downloaded and available (if required).
- (cd tensorflow-sys && cargo test --no-run -vv -j 1)
# FIXME: Make sure this does not fail the CI when pre-built binaries are used.
- export TFSO=$(ls -d $TRAVIS_BUILD_DIR/tensorflow-sys/target/libtensorflow-*-*-*-*/lib/)
- ls -d $TFSO
- find $TFSO
- export LD_LIBRARY_PATH=$TFSO
- # TODO(#66): Re-enable: (cd tensorflow-sys && cargo test -vv -j 1)
- (cd tensorflow-sys && cargo doc -vv)
# Run tests through valgrind, but only on nightly since Rust's standard allocator (jemalloc)
# does not work with valgrind. One has to use the system allocator (`alloc_system`) which
# is only available on nightly.
# Clean the stable artifacts
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then (cd tensorflow-sys && cargo clean); fi
# Compile the tests using the 'nightly' feature, but don't run them.
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then (cd tensorflow-sys && cargo test --no-run -vv -j 1 --features=nightly); fi
# Run the tests using valgrind.
# FIXME: Running valgrind on cargo will catch "errors" inside cargo, not the binary to test. One could use
# valgrind's `--trace-children=yes` but valgrind would still fail on cargo. Maybe suppressions could be
# used. Meanwhile, just call the binaries directly.
# - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then (cd tensorflow-sys && $valgrind cargo test -vv -j 1 --features=nightly); fi
- export TEST_LIB_LINK=$(ls $TRAVIS_BUILD_DIR/target/debug/deps/lib-*)
- export TEST_LIB_SYS=$(ls $TRAVIS_BUILD_DIR/target/debug/deps/tensorflow_sys-*)
# FIXME: Disable for now since valgrind just loop like crazy. See https://travis-ci.org/tensorflow/rust/jobs/211495588#L759
# - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then $valgrind $TEST_LIB_LINK ; fi
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then $valgrind $TEST_LIB_SYS ; fi
# Now build and test the main crate
- cargo test -vv -j 2 --features tensorflow_unstable
- cargo run --example regression
- cargo run --features tensorflow_unstable --example expressions
# Run the tests through valgrind
# FIXME: Add `nightly` feature to main crate (to enable `alloc_system` feature)
# # Clean the stable artifacts
# - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo clean; fi
# # Compile the tests using the 'nightly' feature, then run them through valgrind
# # FIXME: Add suppressions to ignore "errors" in cargo.
# - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo test --no-run -vv -j 2 --features tensorflow_unstable --features=nightly; fi
# - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then $valgrind cargo test -vv -j 2 --features tensorflow_unstable --features=nightly; fi
# - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo build --example regression --features=nightly; fi
# - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then $valgrind cargo run --example regression --features=nightly; fi
# - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo build --features tensorflow_unstable --example expressions --features=nightly; fi
# - if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then $valgrind cargo run --features tensorflow_unstable --example expressions --features=nightly; fi
# Now build the doc
- cargo doc -vv --features tensorflow_unstable
- # TODO(#66): Re-enable: (cd tensorflow-sys && cargo test -vv -j 1)
- (cd tensorflow-sys && cargo doc -vv)


addons:
apt:
Expand All @@ -33,6 +83,7 @@ addons:
- oracle-java8-installer
- python-numpy
- swig
- valgrind

notifications:
email: false
1 change: 1 addition & 0 deletions tensorflow-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ tar = "0.4"

[features]
tensorflow_gpu = []
nightly = []
4 changes: 4 additions & 0 deletions tensorflow-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]

#![cfg_attr(feature="nightly", feature(alloc_system))]
#[cfg(feature="nightly")]
extern crate alloc_system;

include!("bindgen.rs");

pub use TF_Code::*;
Expand Down