test.sh: use cargo --target for platforms other than linux, win or mac#9650
Conversation
|
It looks like @gabreal signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
16ecefc to
8e1b3bf
Compare
8e1b3bf to
3ed80d9
Compare
5chdn
left a comment
There was a problem hiding this comment.
does this mean we don't run tests for anything not linux, windows, macos?
| FEATURES="json-tests,ci-skip-issue" | ||
| OPTIONS="--release" | ||
| VALIDATE=1 | ||
| THREADS=8 |
There was a problem hiding this comment.
is there a reason to hardcode the number of threads?
There was a problem hiding this comment.
I just set it as a variable here and did not want to change the behaviour in this pr. But generally I think it's okay to have a fixed number - unless we decide not to run jobs concurrently and then dynamically set it to the number of cores available on a runner node.
There was a problem hiding this comment.
Theoretically Cargo is supposed to determine the ideal number of threads. In practice I'm not sure it's better than hardcoding it.
There was a problem hiding this comment.
cargo help test
If you want to control the
number of simultaneous running test cases, pass the --test-threads option
to the test binaries:
cargo test -- --test-threads=1
MB
if darwin -> sysctl -n hw.ncpu
if windows -> echo %NUMBER_OF_PROCESSORS%
if linux -> $(nproc)
| 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" |
There was a problem hiding this comment.
why do they not require a $TARGET?
There was a problem hiding this comment.
They use the default target. I don't want to break the script for those who run it locally and probably don't have the CARGO_TARGET variable set because it's not required and specific to the CI.
|
|
||
|
|
||
| # Running the C++ example | ||
| echo "________Running the C++ example________" |
There was a problem hiding this comment.
this is only run in win,mac, and linux?
There was a problem hiding this comment.
Yes, @tomaka told me that that only makes sense.
| time cargo check --target $CARGO_TARGET --manifest-path util/io/Cargo.toml --features "mio" | ||
|
|
||
| # Validate chainspecs | ||
| echo "________Validate chainspecs________" |
There was a problem hiding this comment.
script duplicates a bit here, can we simplify it?
There was a problem hiding this comment.
Okay, I can do that.
exactly, cross-compiled binaries won't be run but only compiled. |
| case $CARGO_TARGET in | ||
| # native builds | ||
| (x86_64-unknown-linux-gnu|x86_64-apple-darwin|x86_64-pc-windows-msvc|'') | ||
| validate |
There was a problem hiding this comment.
You should pass --target $CARGO_TARGET here as well.
| cd ../.. | ||
|
|
||
| # Running tests | ||
| cargo_test $@ |
| FEATURES="json-tests,ci-skip-issue" | ||
| OPTIONS="--release" | ||
| VALIDATE=1 | ||
| THREADS=8 |
There was a problem hiding this comment.
Theoretically Cargo is supposed to determine the ideal number of threads. In practice I'm not sure it's better than hardcoding it.
…mon-deps * origin/master: CI: Remove unnecessary pipes (#9681) test.sh: use cargo --target for platforms other than linux, win or mac (#9650) ci: fix push script (#9679) Hardfork the testnets (#9562) Calculate sha3 instead of sha256 for push-release. (#9673) ethcore-io retries failed work steal (#9651) fix(light_fetch): avoid race with BlockNumber::Latest (#9665) Test fix for windows cache name... (#9658) refactor(fetch) : light use only one `DNS` thread (#9647)
test runs need cargo --target option for cross-compilation and should then build only but not run the tests.