From 3ed80d9bc0c74aa536ebd9870d8de6fd7a96acae Mon Sep 17 00:00:00 2001 From: gabriel Date: Tue, 25 Sep 2018 20:51:01 +0100 Subject: [PATCH] test.sh: use cargo --target for platforms other than linux, win or mac --- test.sh | 84 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 28 deletions(-) diff --git a/test.sh b/test.sh index a3ed39e8d2c..131ffc23126 100755 --- a/test.sh +++ b/test.sh @@ -4,6 +4,7 @@ FEATURES="json-tests,ci-skip-issue" OPTIONS="--release" VALIDATE=1 +THREADS=8 case $1 in --no-json) @@ -29,31 +30,58 @@ esac set -e -if [ "$VALIDATE" -eq "1" ]; then -# Validate --no-default-features build -echo "________Validate build________" -time cargo check --no-default-features -time cargo check --manifest-path util/io/Cargo.toml --no-default-features -time cargo check --manifest-path util/io/Cargo.toml --features "mio" - -# Validate chainspecs -echo "________Validate chainspecs________" -time ./scripts/validate_chainspecs.sh -fi - -# Running the C++ example -echo "________Running the C++ example________" -cd parity-clib-examples/cpp && \ - mkdir -p build && \ - cd build && \ - cmake .. && \ - make -j 8 && \ - ./parity-example && \ - cd .. && \ - rm -rf build && \ - cd ../.. - -# Running tests -echo "________Running Parity Full Test Suite________" -git submodule update --init --recursive -time cargo test $OPTIONS --features "$FEATURES" --all $1 -- --test-threads 8 + + +case $CARGO_TARGET in + (x86_64-unknown-linux-gnu|x86_64-apple-darwin|x86_64-pc-windows-msvc|'') + # native builds + if [ "$VALIDATE" -eq "1" ] + then + echo "________Validate build________" + time cargo check --no-default-features + time cargo check --manifest-path util/io/Cargo.toml --no-default-features + time cargo check --manifest-path util/io/Cargo.toml --features "mio" + + # Validate chainspecs + echo "________Validate chainspecs________" + time ./scripts/validate_chainspecs.sh + fi + + + # Running the C++ example + echo "________Running the C++ example________" + cd parity-clib-examples/cpp && \ + mkdir -p build && \ + cd build && \ + cmake .. && \ + make -j $THREADS && \ + ./parity-example && \ + cd .. && \ + rm -rf build && \ + cd ../.. + + # Running tests + echo "________Running Parity Full Test Suite________" + git submodule update --init --recursive + time cargo test $OPTIONS --features "$FEATURES" --all $@ -- --test-threads $THREADS + ;; + (*) + if [ "$VALIDATE" -eq "1" ] + then + echo "________Validate build________" + time cargo check --target $CARGO_TARGET --no-default-features + time cargo check --target $CARGO_TARGET --manifest-path util/io/Cargo.toml --no-default-features + time cargo check --target $CARGO_TARGET --manifest-path util/io/Cargo.toml --features "mio" + + # Validate chainspecs + echo "________Validate chainspecs________" + time ./scripts/validate_chainspecs.sh + fi + + # Per default only build but not run the tests + echo "________Building Parity Full Test Suite________" + git submodule update --init --recursive + time cargo test --no-run --target $CARGO_TARGET $OPTIONS --features "$FEATURES" --all $@ -- --test-threads $THREADS + ;; +esac +