test.sh: use cargo --target for platforms other than linux, win or mac (#9650)
* test.sh: use cargo --target for platforms other than linux, win or mac * drying test.sh script * run tests only when not cross-compiling * quote variable value
This commit is contained in:
parent
6496405f30
commit
f3b806b471
@ -53,6 +53,8 @@ cache:
|
|||||||
|
|
||||||
test-linux-rust-stable: &test
|
test-linux-rust-stable: &test
|
||||||
stage: test
|
stage: test
|
||||||
|
variables:
|
||||||
|
RUN_TESTS: "true"
|
||||||
script:
|
script:
|
||||||
- scripts/gitlab/test.sh stable
|
- scripts/gitlab/test.sh stable
|
||||||
tags:
|
tags:
|
||||||
@ -60,6 +62,8 @@ test-linux-rust-stable: &test
|
|||||||
|
|
||||||
test-linux-rust-beta:
|
test-linux-rust-beta:
|
||||||
stage: test
|
stage: test
|
||||||
|
variables:
|
||||||
|
RUN_TESTS: "true"
|
||||||
script:
|
script:
|
||||||
- scripts/gitlab/test.sh beta
|
- scripts/gitlab/test.sh beta
|
||||||
tags:
|
tags:
|
||||||
@ -68,6 +72,8 @@ test-linux-rust-beta:
|
|||||||
|
|
||||||
test-linux-rust-nightly:
|
test-linux-rust-nightly:
|
||||||
stage: test
|
stage: test
|
||||||
|
variables:
|
||||||
|
RUN_TESTS: "true"
|
||||||
script:
|
script:
|
||||||
- scripts/gitlab/test.sh nightly
|
- scripts/gitlab/test.sh nightly
|
||||||
tags:
|
tags:
|
||||||
@ -80,6 +86,7 @@ test-darwin-rust-stable:
|
|||||||
CARGO_TARGET: x86_64-apple-darwin
|
CARGO_TARGET: x86_64-apple-darwin
|
||||||
CC: gcc
|
CC: gcc
|
||||||
CXX: g++
|
CXX: g++
|
||||||
|
RUN_TESTS: "true"
|
||||||
script:
|
script:
|
||||||
- scripts/gitlab/test.sh stable
|
- scripts/gitlab/test.sh stable
|
||||||
tags:
|
tags:
|
||||||
@ -107,6 +114,7 @@ test-windows-rust-stable:
|
|||||||
# No cargo caching, since fetch-locking on Windows gets stuck
|
# No cargo caching, since fetch-locking on Windows gets stuck
|
||||||
variables:
|
variables:
|
||||||
CARGO_TARGET: x86_64-pc-windows-msvc
|
CARGO_TARGET: x86_64-pc-windows-msvc
|
||||||
|
RUN_TESTS: "true"
|
||||||
script:
|
script:
|
||||||
- sh scripts/gitlab/test.sh stable
|
- sh scripts/gitlab/test.sh stable
|
||||||
tags:
|
tags:
|
||||||
|
81
test.sh
81
test.sh
@ -4,6 +4,7 @@
|
|||||||
FEATURES="json-tests,ci-skip-issue"
|
FEATURES="json-tests,ci-skip-issue"
|
||||||
OPTIONS="--release"
|
OPTIONS="--release"
|
||||||
VALIDATE=1
|
VALIDATE=1
|
||||||
|
THREADS=8
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
--no-json)
|
--no-json)
|
||||||
@ -29,31 +30,63 @@ esac
|
|||||||
|
|
||||||
set -e
|
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
|
validate () {
|
||||||
echo "________Validate chainspecs________"
|
if [ "$VALIDATE" -eq "1" ]
|
||||||
time ./scripts/validate_chainspecs.sh
|
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
|
||||||
|
else
|
||||||
|
echo "# not validating due to \$VALIDATE!=1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cpp_test () {
|
||||||
|
# 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 ../..
|
||||||
|
}
|
||||||
|
|
||||||
|
cargo_test () {
|
||||||
|
echo "________Running Parity Full Test Suite________"
|
||||||
|
git submodule update --init --recursive
|
||||||
|
time cargo test $OPTIONS --features "$FEATURES" --all $@ -- --test-threads $THREADS
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$CARGO_TARGET" ]
|
||||||
|
then
|
||||||
|
validate --target $CARGO_TARGET
|
||||||
|
else
|
||||||
|
validate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Running the C++ example
|
test "${RUN_TESTS}" = "true" && cpp_test
|
||||||
echo "________Running the C++ example________"
|
|
||||||
cd parity-clib-examples/cpp && \
|
if [ "$CARGO_TARGET" ]
|
||||||
mkdir -p build && \
|
then
|
||||||
cd build && \
|
|
||||||
cmake .. && \
|
if [ "${RUN_TESTS}" = "true" ]
|
||||||
make -j 8 && \
|
then
|
||||||
./parity-example && \
|
cargo_test --target $CARGO_TARGET $@
|
||||||
cd .. && \
|
else
|
||||||
rm -rf build && \
|
cargo_test --no-run --target $CARGO_TARGET $@
|
||||||
cd ../..
|
fi
|
||||||
|
else
|
||||||
|
cargo_test $@
|
||||||
|
fi
|
||||||
|
|
||||||
# Running tests
|
|
||||||
echo "________Running Parity Full Test Suite________"
|
|
||||||
git submodule update --init --recursive
|
|
||||||
time cargo test $OPTIONS --features "$FEATURES" --all $1 -- --test-threads 8
|
|
||||||
|
Loading…
Reference in New Issue
Block a user