Skip to content
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

Fix spellcheck and missing timeout in sshdriver #286

Merged
merged 6 commits into from Aug 13, 2018
Merged

Fix spellcheck and missing timeout in sshdriver #286

merged 6 commits into from Aug 13, 2018

Conversation

kjeldflarup
Copy link
Contributor

Fix errors introduced with commit 1f89ed9

Signed-off-by: Kjeld Flarup kfa@deif.com

@codecov
Copy link

codecov bot commented Jul 10, 2018

Codecov Report

Merging #286 into master will not change coverage.
The diff coverage is 83.3%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #286   +/-   ##
======================================
  Coverage    54.9%   54.9%           
======================================
  Files         106     106           
  Lines        6294    6294           
======================================
  Hits         3459    3459           
  Misses       2835    2835
Impacted Files Coverage Δ
labgrid/driver/commandmixin.py 80% <100%> (ø) ⬆️
labgrid/driver/sshdriver.py 49% <100%> (ø) ⬆️
labgrid/driver/bareboxdriver.py 61.6% <100%> (ø) ⬆️
labgrid/driver/ubootdriver.py 47.7% <50%> (ø) ⬆️
labgrid/driver/smallubootdriver.py 42.4% <50%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 792b4ea...944a4d7. Read the comment docs.

@@ -101,9 +101,9 @@ def _check_master(self):
@Driver.check_active
@step(args=['cmd'], result=True)
def run(self, cmd, codec="utf-8", decodeerrors="strict", timeout=None): # pylint: disable=unused-argument
return self._run(cmd, codec=codec, decodererrors=decodeerrors)
return self._run(cmd, codec=codec, decodeerrors=decodeerrors)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we pass on the timeout value to _run() here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout is actually ignored. commandmixin just happen to pass it to sshdriver.
The new is that commandmixin now calls _run instead of run, so actually it could be removed here, but that would not be backwards compatible.


def _run(self, cmd, codec, decodeerrors): # pylint: disable=unused-argument
def _run(self, cmd, codec="utf-8", decodeerrors="strict", timeout=None): # pylint: disable=unused-argument
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If timeout value is passed on from run() to _run(), I don't see why any default values are needed here.

Copy link
Member

@Bastian-Krause Bastian-Krause left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for trying to fix this. I guess the SSHDriver is not widely used yet..

@@ -34,14 +34,14 @@ def _run_check(self, cmd: str, timeout=30):
Returns:
List[str]: stdout of the executed command
"""
stdout, stderr, exitcode = self._run(cmd, timeout=timeout)
stdout, stderr, exitcode = self._run(cmd, timeout=timeout, codec=codec, decodeerrors=decodeerrors)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are the variables codec and decodeerrors supposed to come from? I guess you missed updating
def _run_check(self, cmd: str, timeout=30):
with these arguments, right?

The problem is not every _run() methods knows about codec and decodeerrors, so this breaks everywhere else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should either transform the _run() method of BareboxDriver, UBootDriver and SmallUBootDriver or go without CommandMixin's convenience function run_check on targets with decode errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I hope that these run functions will be stable soon and not have more special options.
I will add these but as unused parameters, because I don't see any use for codec's in these drivers.
Better test functions would help a lot. In my PR for the remote_tmpdir I actually have a test case which covers the SSH driver better.

@Bastian-Krause
Copy link
Member

I fixed this while already on it:

  • driver/commandmixin: fix missing arguments and force kwarg for timeout, codec, decodeeror
  • driver/sshdriver: adjust remotepath kwarg in put()
  • use same _run() signature everywhere

Bastian-Krause
Bastian-Krause previously approved these changes Jul 26, 2018
Emantor
Emantor previously approved these changes Jul 26, 2018
@kjeldflarup
Copy link
Contributor Author

Thanks @BastianStender

@Bastian-Krause Bastian-Krause dismissed stale reviews from Emantor and themself via 9b96e15 August 8, 2018 07:00
@Bastian-Krause
Copy link
Member

Squashed the fixup. @jluebbe could you review/merge this?

Emantor
Emantor previously approved these changes Aug 13, 2018
kjeldflarup and others added 6 commits August 13, 2018 10:05
Signed-off-by: Kjeld Flarup <kfa@deif.com>
Having None as default leads to

  user@hostname:None

This does not make sense, make the default an empty string instead.

Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Kjeld Flarup <kfa@deif.com>
The "FIXME: Handle pexpect Timeout" is outdated and is now removed.

Signed-off-by: Bastian Stender <bst@pengutronix.de>
…d honor timeout

Signed-off-by: Bastian Stender <bst@pengutronix.de>
…or timeout

Signed-off-by: Bastian Stender <bst@pengutronix.de>
@Emantor Emantor merged commit 4fa4c32 into labgrid-project:master Aug 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants