New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rust plugin: fix cargo builds and run tests #2158
Conversation
thanks for the contribution! At first glance this looks good. I have re-triggered travis to take into account the timeout. |
Yes,
|
Codecov Report
@@ Coverage Diff @@
## master #2158 +/- ##
=========================================
Coverage ? 91.25%
=========================================
Files ? 196
Lines ? 12454
Branches ? 1846
=========================================
Hits ? 11365
Misses ? 734
Partials ? 355
Continue to review full report at Codecov.
|
Looks like 'cargo test' doesn't play nice with cross compiling. I'll rework the patch to not run the tests when cross compiling. |
This patch changes it so that we run all instances of cargo using the build environment. Fixes cases where rustc can't be found during the pull step. Also adds 'cargo test' to the build step, to fail the build if the tests aren't passing. We will only run the tests when we aren't cross compiling.
5c5745d
to
b44f103
Compare
Looks like someone else has run into this same problem, and worked around it like I did with a custom rust plugin. https://forum.snapcraft.io/t/snap-of-gutenberg/6080/3 and getzola/zola#322 |
@@ -97,11 +97,24 @@ def __init__(self, name, options, project): | |||
self._rustup = os.path.join(self._rustpath, "rustup.sh") | |||
self._manifest = collections.OrderedDict() | |||
|
|||
def _test(self): | |||
if self.project.is_cross_compiling: |
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.
it would be nice to issue a warning here about skipping the test execution since it is cross compiling.
Travis seems to be confused
|
I have re-created the PR on #2170 |
This patch changes it so that we run all instances of cargo using the build environment. Fixes cases where a snap cleanbuild will error out with rustc being unable to be found during the pull step.
This is the issue I asked for help with on the forum: https://forum.snapcraft.io/t/problem-building-rust-based-snap/5776
Also adds 'cargo test' to the build step, to fail the build if the tests aren't passing.
Rust plugin unittests have been updated.
./runtests.sh static
?./runtests.sh unit
?