-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this mean we don't run tests for anything not linux, windows, macos?
@@ -4,6 +4,7 @@ | |||
FEATURES="json-tests,ci-skip-issue" | |||
OPTIONS="--release" | |||
VALIDATE=1 | |||
THREADS=8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason to hardcode the number of threads?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
test.sh
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do they not require a $TARGET?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
test.sh
Outdated
|
||
|
||
# Running the C++ example | ||
echo "________Running the C++ example________" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is only run in win,mac, and linux?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, @tomaka told me that that only makes sense.
test.sh
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
script duplicates a bit here, can we simplify it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I can do that.
exactly, cross-compiled binaries won't be run but only compiled. |
test.sh
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should pass --target $CARGO_TARGET
here as well.
test.sh
Outdated
cd ../.. | ||
|
||
# Running tests | ||
cargo_test $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And --target
here.
@@ -4,6 +4,7 @@ | |||
FEATURES="json-tests,ci-skip-issue" | |||
OPTIONS="--release" | |||
VALIDATE=1 | |||
THREADS=8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.