Skip to content

Platform specific file copying #145

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

Merged
merged 13 commits into from
Dec 19, 2018
Merged

Platform specific file copying #145

merged 13 commits into from
Dec 19, 2018

Conversation

juhhov
Copy link
Contributor

@juhhov juhhov commented Nov 13, 2018

Status

READY

Description

Revert back to platform specific file copying as the current implementation is not robust.

In non windows platforms file is now created with flags:
os.O_CREAT | os.O_TRUNC | os.O_RDWR | os.O_SYNC
with the exception of arm machines which stay:
os.O_CREAT | os.O_TRUNC | os.O_RDWR | os.O_DIRECT

http://man7.org/linux/man-pages/man2/open.2.html

https://jira.arm.com/browse/IOTSYSTOOL-1290

@juhhov juhhov requested review from jupe and YifeiZuo01 November 13, 2018 10:59
@YifeiZuo01
Copy link
Contributor

add Jira link to PR desciption?

@jupe
Copy link
Contributor

jupe commented Nov 20, 2018

why py3 fails?

Copy link
Contributor

@jupe jupe left a comment

Choose a reason for hiding this comment

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

something wrong with python3:

test_run_with_file_with_all (hardware.test_flash.FlashTestCaseHW) ... After 10s process did not stop

there was also transfer timeout. I'll re-trig test job to see if there is something unstable..

@jupe jupe mentioned this pull request Dec 13, 2018
2 tasks
@juhhov juhhov changed the title Ignore os.fsync error Platform specific file copying Dec 14, 2018
self.logger.exception("File couldn't be copied")
raise FlashError(message="File couldn't be copied",
return_code=EXIT_CODE_OS_ERROR)

def _copy_file_windows(self, source, destination):
command = "copy \"{}\" \"{}\"".format(os.path.abspath(source), destination)
Copy link
Contributor

Choose a reason for hiding this comment

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

why this os.path.abspath() ?

def _copy_file_windows(self, source, destination):
command = "copy \"{}\" \"{}\"".format(os.path.abspath(source), destination)
self.logger.debug("Copying with command: {}".format(command))
subprocess.check_call(command)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is still an problem, need some change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is it a problem?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you figured out it already 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the purpose to start a new command interpreter, would mind explain a bit?

C:\>cmd /?
Starts a new instance of the Windows XP command interpreter

Copy link
Contributor Author

@juhhov juhhov Dec 14, 2018

Choose a reason for hiding this comment

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

It is one way to avoid using shell=True, which we do not want to use for security reasons.

@RomanSaveljev
Copy link
Contributor

the current implementation is not robust

Once this change is in, what is the plan to measure whether the system is more robust.. less robust.. same robust?

@juhhov
Copy link
Contributor Author

juhhov commented Dec 17, 2018

the current implementation is not robust

That comment is targeted to #143, which does not pass acceptance. The changes this PR brings compared to v0.9.1 are described in description.
Currently there is no other way to measure robustness than acceptance tests and opentmi results to some extent.

@juhhov juhhov merged commit 35b8bff into master Dec 19, 2018
@juhhov juhhov deleted the IOTSYSTOOL-1290 branch December 19, 2018 09:39
@juhhov juhhov added this to the v0.10.0 milestone Dec 20, 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.

4 participants