mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
Add a line of output for each iteration of the torture test
This serves as a sort of progress indicator. The output looks like this:: localhost ~ # flashrom="./flashrom" sh flashrom_partial_write_test.sh testing flashrom binary: ./flashrom Running test in /tmp/tmp.4xPejwaADU ffh pattern written in ff_4k.bin 00h pattern written in 00_4k.bin Reading BIOS image Original image saved as bios.bin aligned region 0 test: passed ... aligned region 15 test: passed unaligned region 0 test: passed ... unaligned region 15 test: passed Result: PASSED restoring original bios image using system's flashrom test files remain in /tmp/tmp.4xPejwaADU Corresponding to flashrom svn r1222. Signed-off-by: David Hendricks <dhendrix@google.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
parent
eb6337f752
commit
738f8e2756
@ -92,6 +92,12 @@ echo "Original image saved as ${BIOS}"
|
|||||||
|
|
||||||
# $1: exit code
|
# $1: exit code
|
||||||
do_exit() {
|
do_exit() {
|
||||||
|
if [ ${1} -eq ${EXIT_FAILURE} ] ; then
|
||||||
|
echo "Result: FAILED"
|
||||||
|
else
|
||||||
|
echo "Result: PASSED"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "restoring original bios image using system's flashrom"
|
echo "restoring original bios image using system's flashrom"
|
||||||
flashrom ${FLASHROM_PARAM} -w "$BIOS"
|
flashrom ${FLASHROM_PARAM} -w "$BIOS"
|
||||||
echo "test files remain in ${TMPDIR}"
|
echo "test files remain in ${TMPDIR}"
|
||||||
@ -159,14 +165,14 @@ echo "
|
|||||||
cp "$BIOS" "$TESTFILE"
|
cp "$BIOS" "$TESTFILE"
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt $NUM_REGIONS ] ; do
|
while [ $i -lt $NUM_REGIONS ] ; do
|
||||||
|
echo -n "aligned region ${i} test: "
|
||||||
offset=$((${i} * 8192))
|
offset=$((${i} * 8192))
|
||||||
dd if=${ZERO_4K} of=${TESTFILE} bs=1 conv=notrunc seek=${offset} 2> /dev/null
|
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)) 2> /dev/null
|
dd if=${FF_4K} of=${TESTFILE} bs=1 conv=notrunc seek=$((${offset} + 4096)) 2> /dev/null
|
||||||
|
|
||||||
./flashrom ${FLASHROM_PARAM} -l layout_4k_aligned.txt -i 00_${i} -i ff_${i} -w "$TESTFILE" > /dev/null
|
./flashrom ${FLASHROM_PARAM} -l layout_4k_aligned.txt -i 00_${i} -i ff_${i} -w "$TESTFILE" > /dev/null
|
||||||
if [ "$?" != "0" ] ; then
|
if [ "$?" != "0" ] ; then
|
||||||
echo "partial flash failed on iteration ${i}"
|
echo "failed to flash region"
|
||||||
echo "Result: FAIL"
|
|
||||||
do_exit "$EXIT_FAILURE"
|
do_exit "$EXIT_FAILURE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -175,13 +181,13 @@ while [ $i -lt $NUM_REGIONS ] ; do
|
|||||||
flashrom ${FLASHROM_PARAM} -r difftest.bin > /dev/null
|
flashrom ${FLASHROM_PARAM} -r difftest.bin > /dev/null
|
||||||
diff -q difftest.bin "$TESTFILE"
|
diff -q difftest.bin "$TESTFILE"
|
||||||
if [ "$?" != "0" ] ; then
|
if [ "$?" != "0" ] ; then
|
||||||
echo "diff test failed on iteration ${i}"
|
echo "failed diff test"
|
||||||
echo "Result: FAIL"
|
|
||||||
do_exit "$EXIT_FAILURE"
|
do_exit "$EXIT_FAILURE"
|
||||||
fi
|
fi
|
||||||
rm -f difftest.bin
|
rm -f difftest.bin
|
||||||
|
|
||||||
i=$((${i} + 1))
|
i=$((${i} + 1))
|
||||||
|
echo "passed"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Make a layout - 4K regions on 4.5K boundaries. This will help find problems
|
# Make a layout - 4K regions on 4.5K boundaries. This will help find problems
|
||||||
@ -245,11 +251,13 @@ echo "
|
|||||||
" > layout_unaligned.txt
|
" > layout_unaligned.txt
|
||||||
|
|
||||||
# reset the test file and ROM to the original state
|
# reset the test file and ROM to the original state
|
||||||
flashrom ${FLASHROM_PARAM} -w "$BIOS"
|
flashrom ${FLASHROM_PARAM} -w "$BIOS" > /dev/null
|
||||||
cp "$BIOS" "$TESTFILE"
|
cp "$BIOS" "$TESTFILE"
|
||||||
|
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt $NUM_REGIONS ] ; do
|
while [ $i -lt $NUM_REGIONS ] ; do
|
||||||
|
echo -n "unaligned region ${i} test: "
|
||||||
|
|
||||||
offset=$(($((${i} * 8192)) + 2048))
|
offset=$(($((${i} * 8192)) + 2048))
|
||||||
# Protect against too long write
|
# Protect against too long write
|
||||||
writelen=4096
|
writelen=4096
|
||||||
@ -264,8 +272,7 @@ while [ $i -lt $NUM_REGIONS ] ; do
|
|||||||
|
|
||||||
./flashrom ${FLASHROM_PARAM} -l layout_unaligned.txt -i 00_${i} -i ff_${i} -w "$TESTFILE" > /dev/null
|
./flashrom ${FLASHROM_PARAM} -l layout_unaligned.txt -i 00_${i} -i ff_${i} -w "$TESTFILE" > /dev/null
|
||||||
if [ "$?" != "0" ] ; then
|
if [ "$?" != "0" ] ; then
|
||||||
echo "partial flash failed on iteration ${i}"
|
echo "failed to flash region"
|
||||||
echo "Result: FAIL"
|
|
||||||
do_exit "$EXIT_FAILURE"
|
do_exit "$EXIT_FAILURE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -274,14 +281,13 @@ while [ $i -lt $NUM_REGIONS ] ; do
|
|||||||
flashrom ${FLASHROM_PARAM} -r difftest.bin > /dev/null
|
flashrom ${FLASHROM_PARAM} -r difftest.bin > /dev/null
|
||||||
diff -q difftest.bin "$TESTFILE"
|
diff -q difftest.bin "$TESTFILE"
|
||||||
if [ "$?" != "0" ] ; then
|
if [ "$?" != "0" ] ; then
|
||||||
echo "diff test failed on iteration ${i}"
|
echo "failed diff test"
|
||||||
echo "Result: FAIL"
|
|
||||||
do_exit "$EXIT_FAILURE"
|
do_exit "$EXIT_FAILURE"
|
||||||
fi
|
fi
|
||||||
rm -f difftest.bin
|
rm -f difftest.bin
|
||||||
|
|
||||||
i=$((${i} + 1))
|
i=$((${i} + 1))
|
||||||
|
echo "passed"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Result: PASS"
|
|
||||||
do_exit "$EXIT_SUCCESS"
|
do_exit "$EXIT_SUCCESS"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user