Code review comment for ~sylvain-pineau/checkbox-support:usb_scripts_low_mem

Revision history for this message
Maciej Kisielewski (kissiel) wrote :

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.

review: Abstain

« Back to merge proposal