After a few tries at manually verifying partial writes and realizing that it's awfully tedious to do any exhaustive testing, I hastily threw together a shell script to help automate the process. Since there are others on this list doing similar things, I figured it might be helpful to throw it up here.
Note: It's unfinished and probably has bugs, but I figure it's at least a start, even if only to kickstart a conversation about how to test partial writes in a standard and useful manner.
Signed-off-by: David Hendricks dhendrix@google.com
On Tue, Oct 26, 2010 at 4:42 PM, David Hendricks dhendrix@google.comwrote:
After a few tries at manually verifying partial writes and realizing that it's awfully tedious to do any exhaustive testing, I hastily threw together a shell script to help automate the process. Since there are others on this list doing similar things, I figured it might be helpful to throw it up here.
Note: It's unfinished and probably has bugs, but I figure it's at least a start, even if only to kickstart a conversation about how to test partial writes in a standard and useful manner.
idwer already noticed at least one issue, so I attempted to correct it along with a couple others.
- Default path for flashrom binary should be "../flashrom" since that is where a user will typically have built a fresh binary. This can be overridden easily. - Suppressed some annoying output from "dd" command. - Implemented better checks for uuencode and pre-installed (assumed to be stable) flashrom binary.
Signed-off-by: David Hendricks dhendrix@google.com
New version, more bug fixes. Thanks for Carl-Daniel for testing! - Restore the original ROM before beginning the second set of tests. - The last iteration of the second test (un-aligned partial writes) was causing problems on a 128KB part (emulated). I've removed it for now since I'm in a hurry to get out tonight. - Fixed a copy + paste error in the 4k aligned test layout. - Added $FLASHROM_PARAM to the list of parameters passed into Flashrom.
On Tue, Oct 26, 2010 at 5:33 PM, David Hendricks dhendrix@google.comwrote:
On Tue, Oct 26, 2010 at 4:42 PM, David Hendricks dhendrix@google.comwrote:
After a few tries at manually verifying partial writes and realizing that it's awfully tedious to do any exhaustive testing, I hastily threw together a shell script to help automate the process. Since there are others on this list doing similar things, I figured it might be helpful to throw it up here.
Note: It's unfinished and probably has bugs, but I figure it's at least a start, even if only to kickstart a conversation about how to test partial writes in a standard and useful manner.
idwer already noticed at least one issue, so I attempted to correct it along with a couple others.
- Default path for flashrom binary should be "../flashrom" since that is
where a user will typically have built a fresh binary. This can be overridden easily.
- Suppressed some annoying output from "dd" command.
- Implemented better checks for uuencode and pre-installed (assumed to be
stable) flashrom binary.
Signed-off-by: David Hendricks dhendrix@google.com
-- David Hendricks (dhendrix) Systems Software Engineer, Google Inc.
On 29.10.2010 04:58, David Hendricks wrote:
New version, more bug fixes. Thanks for Carl-Daniel for testing!
- Restore the original ROM before beginning the second set of tests.
- The last iteration of the second test (un-aligned partial writes) was
causing problems on a 128KB part (emulated). I've removed it for now since I'm in a hurry to get out tonight.
- Fixed a copy + paste error in the 4k aligned test layout.
- Added $FLASHROM_PARAM to the list of parameters passed into Flashrom.
Thanks! The following change to the second while loop seems to fix the issues with 128kB flash chips for me:
# Protect against too long write writelen=4096 if [ $((${offset} + 4096 + 4096)) -ge 131072 ]; then writelen=$((131072 - $((${offset} + 4096)))) if [ ${writelen} -lt 0 ]; then writelen=0 fi fi dd if=${ZERO_4K} of=${TESTFILE} bs=1 conv=notrunc seek=${offset} 2>/dev/null dd if=${FF_4K} of=${TESTFILE} bs=1 conv=notrunc seek=$((${offset} + 4096)) count=writelen 2>/dev/null
Regards, Carl-Daniel
On Thu, Oct 28, 2010 at 8:35 PM, Carl-Daniel Hailfinger < c-d.hailfinger.devel.2006@gmx.net> wrote:
On 29.10.2010 04:58, David Hendricks wrote:
New version, more bug fixes. Thanks for Carl-Daniel for testing!
- Restore the original ROM before beginning the second set of tests.
- The last iteration of the second test (un-aligned partial writes) was
causing problems on a 128KB part (emulated). I've removed it for now
since
I'm in a hurry to get out tonight.
- Fixed a copy + paste error in the 4k aligned test layout.
- Added $FLASHROM_PARAM to the list of parameters passed into Flashrom.
Thanks! The following change to the second while loop seems to fix the issues with 128kB flash chips for me:
# Protect against too long write writelen=4096 if [ $((${offset} + 4096 + 4096)) -ge 131072 ]; then writelen=$((131072 - $((${offset} + 4096)))) if [ ${writelen} -lt 0 ]; then writelen=0 fi fi dd if=${ZERO_4K} of=${TESTFILE} bs=1 conv=notrunc seek=${offset} 2>/dev/null dd if=${FF_4K} of=${TESTFILE} bs=1 conv=notrunc seek=$((${offset} + 4096)) count=writelen 2>/dev/null
ACKed-by: David Hendricks dhendrix@google.com
Before you commit, add the last range to the unaligned layout and maybe add a note to the comments above. Maybe something like: # 3. The new content must be written at specified offsets. # # Note: The last chunk of 0xff bytes is only 2K as to avoid overrunning a 128KB # test image. echo " ... 0x01e800:0x01f7ff 00_15 0x01f800:0x01ffff ff_15 " > layout_unaligned.txt
Thanks!
On 29.10.2010 21:53, David Hendricks wrote:
Before you commit, add the last range to the unaligned layout and maybe add a note to the comments above. Maybe something like: [...]
Done. Thanks for the torture test script.
Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net and committed in r1218.
Regards, Carl-Daniel
On Fri, Oct 29, 2010 at 1:19 PM, Carl-Daniel Hailfinger < c-d.hailfinger.devel.2006@gmx.net> wrote:
On 29.10.2010 21:53, David Hendricks wrote:
Before you commit, add the last range to the unaligned layout and maybe
add
a note to the comments above. Maybe something like: [...]
Done. Thanks for the torture test script.
Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net and committed in r1218.
Naturally, I already hit a snag.
When running the script, it seems that the added "$FLASHROM_PARAM" can get expanded incorrectly by the shell thus causing flashrom to barf when $FLASHROM_PARAM is empty. I suspect it quietly passes in "".
The attached patch is a simple s/"$FLASHROM_PARAM"/${FLASHROM_PARAM}/g. This seems to work.
My shell-fu is only moderate, perhaps someone with more expertise can verify that this is the -correct- way to do it.
On 29.10.2010 22:51, David Hendricks wrote:
When running the script, it seems that the added "$FLASHROM_PARAM" can get expanded incorrectly by the shell thus causing flashrom to barf when $FLASHROM_PARAM is empty. I suspect it quietly passes in "".
The attached patch is a simple s/"$FLASHROM_PARAM"/${FLASHROM_PARAM}/g. This seems to work.
My shell-fu is only moderate, perhaps someone with more expertise can verify that this is the -correct- way to do it.
If you reply to this with a Signed-off-by line, this is Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Regards, Carl-Daniel
On Fri, Oct 29, 2010 at 2:27 PM, Carl-Daniel Hailfinger < c-d.hailfinger.devel.2006@gmx.net> wrote:
On 29.10.2010 22:51, David Hendricks wrote:
When running the script, it seems that the added "$FLASHROM_PARAM" can
get
expanded incorrectly by the shell thus causing flashrom to barf when $FLASHROM_PARAM is empty. I suspect it quietly passes in "".
The attached patch is a simple s/"$FLASHROM_PARAM"/${FLASHROM_PARAM}/g. This seems to work.
My shell-fu is only moderate, perhaps someone with more expertise can
verify
that this is the -correct- way to do it.
If you reply to this with a Signed-off-by line, this is Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
D'oh! Thanks again for catching my silly mistakes. The fix-parameter-passing-shell-stupidity.patch is: Signed-off-by: David Hendricks dhendrix@google.com
Regards, Carl-Daniel
On 29.10.2010 23:29, David Hendricks wrote:
On Fri, Oct 29, 2010 at 2:27 PM, Carl-Daniel Hailfinger wrote:
On 29.10.2010 22:51, David Hendricks wrote:
When running the script, it seems that the added "$FLASHROM_PARAM" can get expanded incorrectly by the shell thus causing flashrom to barf when $FLASHROM_PARAM is empty. I suspect it quietly passes in "".
The attached patch is a simple s/"$FLASHROM_PARAM"/${FLASHROM_PARAM}/g. This seems to work.
Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Signed-off-by: David Hendricks dhendrix@google.com
Committed in r1219.
Regards, Carl-Daniel