Skip to contentSkip to conversation

test: dfu: cleanup before execution

PATCH New Stephen Warren 2 participants 6 messages Jul 1, 2014 – Jul 8, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 test: dfu: cleanup before execution

From: Stephen Warren <[email protected]>

Call cleanup() before running tests too. If a previous test was CTRL-C'd some stale files may have been left around. dfu-util refuses to receive a file to a filename that already exists, which results in false test failures if the files aren't cleaned up first.

---
 test/dfu/dfu_gadget_test.sh | 1 +
 1 file changed, 1 insertion(+)
test/dfu/dfu_gadget_test.sh +1 -0
index c5c5f1d957f1..4133155ae97d 100755
@@ -66,6 +66,7 @@ printf "$COLOUR_GREEN===========================================================
 echo "DFU EP0 transmission test program"
 echo "Trouble shoot -> disable DBG (even the KERN_DEBUG) in the UDC driver"
 echo "@ -> TRATS2 # dfu 0 mmc 0"
+cleanup
 mkdir -p $DIR$RCV_DIR
 touch $LOG_FILE
 
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH 2/3 test: dfu: add some more test cases

From: Stephen Warren <[email protected]>

On Tegra, the DFU buffer size is 1M. Consequently, the 8M test always fails. Add tests for the 1M size, and one byte less as a corner case, so that some large tests are executed and expected to pass.

---
 test/dfu/dfu_gadget_test_init.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/dfu/dfu_gadget_test_init.sh +1 -1
index fb54ad8c55ee..2163a685a55d 100755
@@ -9,7 +9,7 @@ COLOUR_DEFAULT="\33[0m"
 
 LOG_DIR="./log"
 
-TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961 8M"
+TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961 1048575 1048576 8M"
 
 printf "Init script for generating data necessary for DFU test script"
 
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH 2/3 test: dfu: add some more test cases

Hi Stephen,

Quoted 21 lines

From: Stephen Warren <[email protected]>

On Tegra, the DFU buffer size is 1M. Consequently, the 8M test always fails. Add tests for the 1M size, and one byte less as a corner case, so that some large tests are executed and expected to pass.

---
 test/dfu/dfu_gadget_test_init.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/test/dfu/dfu_gadget_test_init.sh index fb54ad8c55ee..2163a685a55d 100755 --- a/test/dfu/dfu_gadget_test_init.sh
+++ b/test/dfu/dfu_gadget_test_init.sh

test/dfu/dfu_gadget_test_init.sh +1 -1
@@ -9,7 +9,7 @@ COLOUR_DEFAULT="\33[0m"
 
 LOG_DIR="./log"
 
-TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961 8M"
+TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961
Quoted 3 lines

1048575 1048576 8M"
printf "Init script for generating data necessary for DFU test
script"

Applied to u-boot-dfu tree.

Stephen, thanks for your support.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#3 lore raw

PATCH 3/3 dfu: fix readback buffer overflow test

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

The buffer is too small if it's < size to read, not if it's <= the size. This fixes the 1MB test case on Tegra, which has a 1MB buffer.

---
 drivers/dfu/dfu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dfu/dfu.c +1 -1
index 6cd3fbb58ae4..3512b149c560 100644
@@ -332,7 +332,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
 		case DFU_RAM_ADDR:
 			break;
 		default:
-			if (dfu->r_left >= dfu_buf_size) {
+			if (dfu->r_left > dfu_buf_size) {
 				printf("%s: File too big for buffer\n",
 				       __func__);
 				return -EOVERFLOW;
Signature · 1 line
1.8.1.5
#4 lore raw

PATCH 3/3 dfu: fix readback buffer overflow test

Hi Stephen,

Quoted 21 lines

From: Stephen Warren <[email protected]>

The buffer is too small if it's < size to read, not if it's <= the size. This fixes the 1MB test case on Tegra, which has a 1MB buffer.

---
 drivers/dfu/dfu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dfu/dfu.c +0 -0
index 6cd3fbb58ae4..3512b149c560 100644
@@ -332,7 +332,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf,

int size, int blk_seq_num) case DFU_RAM_ADDR:

drivers/dfu/dfu.c +1 -1
 			break;
 		default:
-			if (dfu->r_left >= dfu_buf_size) {
+			if (dfu->r_left > dfu_buf_size) {
 				printf("%s: File too big for
Quoted 2 lines

buffer\n", __func__);
return -EOVERFLOW;

Applied to u-boot-dfu tree.

Stephen, thanks for your support.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#5 lore raw

PATCH 1/3 test: dfu: cleanup before execution

In reply to Stephen Warren

Hi Stephen,

Quoted 8 lines

From: Stephen Warren <[email protected]>

Call cleanup() before running tests too. If a previous test was CTRL-C'd some stale files may have been left around. dfu-util refuses to receive a file to a filename that already exists, which results in false test failures if the files aren't cleaned up first.

Applied to u-boot-dfu tree.

Stephen, thanks for your support.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group