Merge ~sylvain-pineau/checkbox-support:usb_scripts_low_mem into checkbox-support:master
Proposed by
Sylvain Pineau
Status: | Merged |
---|---|
Approved by: | Sylvain Pineau |
Approved revision: | 19b59f5e6f3fcf9cc593f2d0a2b3049fb6c72789 |
Merged at revision: | 4f429e965c29335ff869de199a01b4a441cc18d6 |
Proposed branch: | ~sylvain-pineau/checkbox-support:usb_scripts_low_mem |
Merge into: | checkbox-support:master |
Diff against target: |
178 lines (+23/-27) 2 files modified
checkbox_support/scripts/run_watcher.py (+8/-0) checkbox_support/scripts/usb_read_write.py (+15/-27) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Maciej Kisielewski | Abstain | ||
Review via email: mp+341304@code.launchpad.net |
Description of the change
This MR allows the non udisks2 usb test to run on low memory devices, tested on tillamook where we only have 100M to run checkbox and the storage test.
To post a comment you must log in.
Looks good, +1.
Two subjective, style-related comments in line.
One general thought I have for the whole usb_read_write.py is that I feel like instead of optimizing size of the "test file" we should generate the data on-the-fly and write it to two pipes, one to compute the hash for reference, and one that will be written to the drive.
Or at least generate the random file in a less memory-hungry way.
The reference md5 computation doesn't have to be done on a written file. First thought is to use hashlib from python, block by block. The real solution, however, is to use precomputed hashes. For any given size the hash can be known statically (there is a hardcoded seed).
To sum up: content of RandomData could be written to the target file on the fly without a need of any huge buffer. If the size is known upfront precomputed hash can be used.
I feel bad about circumventing the real problem in the script instead of fixing it.