From 3b6ff514342299410e3fbb869e9f2c218195652c Mon Sep 17 00:00:00 2001 From: Alex Helfet Date: Fri, 29 Dec 2017 01:40:55 +0000 Subject: [PATCH] Re-use bin/decode_typed_test, pass toolchain down through it. --- bin/build_tc | 4 +--- bin/decode_typed | 6 ++++-- bin/decode_typed_test | 14 +++++++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/bin/build_tc b/bin/build_tc index c3d3d31..6811168 100755 --- a/bin/build_tc +++ b/bin/build_tc @@ -32,6 +32,4 @@ cargo +${TC} test -p framed --verbose --lib --features=trace; cargo +${TC} doc -p framed --verbose --no-deps; # TODO: Use correct toolchain. -DECODE_TYPE_CRATE_DIR=${REPO_DIR}/test_type \ - DECODE_TYPE_NAME=framed_test_type::Test \ - ${REPO_DIR}/bin/decode_typed < /dev/null; +TC=${TC} ${REPO_DIR}/bin/decode_typed_test diff --git a/bin/decode_typed b/bin/decode_typed index 316a682..79bda11 100755 --- a/bin/decode_typed +++ b/bin/decode_typed @@ -8,6 +8,8 @@ E.g. \'framed-rs/test_type\'}" DECODE_TYPE_NAME="${DECODE_TYPE_NAME?You must set this environment variable with the full name of your serialized type including its module path. E.g. \'framed_test_type::Test\'}" +TC=${TC:stable} + echo "DECODE_TYPE_CRATE_DIR = '${DECODE_TYPE_CRATE_DIR}'" echo "DECODE_TYPE_NAME = '${DECODE_TYPE_NAME}'" @@ -31,7 +33,7 @@ EOF # Build user type crate. -cargo rustc \ +cargo +${TC} rustc \ --manifest-path "${DECODE_TYPE_CRATE_DIR}/Cargo.toml" \ --lib \ ${DECODE_TYPE_CARGO_FLAGS} \ @@ -42,7 +44,7 @@ cargo rustc \ TYPE_CRATE_RLIB="$(ls "${TMP_DIR}"/lib${TYPE_CRATE_NAME}*.rlib)"; # Build decode bin. -cargo rustc \ +cargo +${TC} rustc \ --manifest-path "${REPO_DIR}/decode/Cargo.toml" \ --bin framed_decode \ ${DECODE_BIN_CARGO_FLAGS} \ diff --git a/bin/decode_typed_test b/bin/decode_typed_test index 1e2a0f8..3486ec4 100755 --- a/bin/decode_typed_test +++ b/bin/decode_typed_test @@ -3,11 +3,15 @@ set -ex # A manual test for framed_decode. -repo_dir="$(cd $(dirname ${BASH_SOURCE[0]} )/..; pwd )" +REPO_DIR="$(cd $(dirname ${BASH_SOURCE[0]} )/..; pwd )" +cd ${REPO_DIR}; -cd ${repo_dir}; +TC=${TC?Supply a toolchain in this environment variable} -cargo run -p framed_test_type > target/test_output; +export DECODE_TYPE_CRATE_DIR=${REPO_DIR}/test_type +export DECODE_TYPE_NAME=framed_test_type::Test + +cargo +${TC} run -p framed_test_type > target/test_output; cat target/test_output | hd; -cat target/test_output | cargo run -p framed_decode; -seq 5 | xargs -I% cat target/test_output | cargo run -p framed_decode; +cat target/test_output | ${REPO_DIR}/bin/decode_typed; +seq 5 | xargs -I% cat target/test_output | ${REPO_DIR}/bin/decode_typed;