test: dfu: cleanup before execution
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
@@ -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
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
@@ -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
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.
Signed-off-by Stephen Warren <[email protected]>--- 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.shindexfb54ad8c55ee..2163a685a55d100755 ---a/test/dfu/dfu_gadget_test_init.sh
+++b/test/dfu/dfu_gadget_test_init.shtest/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
PATCH 3/3 dfu: fix readback buffer overflow test
In reply to Stephen WarrenFrom: 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
@@ -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
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.
Signed-off-by Stephen Warren <[email protected]>--- drivers/dfu/dfu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/dfu/dfu.c +0
-0@@ -332,7 +332,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf,int size, int
blk_seq_num) caseDFU_RAM_ADDR:drivers/dfu/dfu.c +1
-1break ;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
PATCH 1/3 test: dfu: cleanup before execution
In reply to Stephen WarrenHi 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.Signed-off-by Stephen Warren <[email protected]>
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