Skip to contentSkip to conversation

Changed syntax for dumpimage, failing tests

U-Boot In review Vagrant Cascadian 3 participants 5 messages Feb 14, 2019 – Mar 9, 2019

lore
Share & tools
lore
#0 lore raw

The syntax for dumpimage was changed since v2019.01, but test/image/test-imagetools.sh wasn't updated with the new syntax.

While the change may make sense, it breaks existing behavior, and that has it's drawbacks...

In any case, the tests shouldn't fail.

I believe this is the commit that changed it:

commit 12b831879a765722c1a94ca75c6adb6f80759cd9

Author: Martyn Welch <[email protected]>
Date:   Sat Jan 26 02:31:51 2019 +0000

tools: dumpimage: Simplify arguments

The dump image utility has very confusing syntax. If called to list image contents ("-l") it takes the image name as a positional argument. If the utility is called to extract something from the image, the image must be provided via the optional argument "-i" as well as the positional argument but the value passed in the positional argument will be completely ignored.

Simplify dumpimage by always providing the image as the first positional argument. Assume we want to dump something from the image if we do not provide the "-l" option for now.

live well,
vagrant
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190213/877695f0/attachment.sig>

#1 lore raw

PATCH 1/1 test: Update test-imagetools.sh to match new syntax

The syntax of dumpimage was simplified in commit 12b831879a76 ("tools:
dumpimage: Simplify arguments"), but the test (test/image/test-imagetools.sh) was not updated and is now failing.

Update the test to use the new syntax.

---

 test/image/test-imagetools.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
test/image/test-imagetools.sh +8 -8
index 256af71d42..907f46a7b5 100755
@@ -102,10 +102,10 @@ create_multi_image()
 extract_multi_image()
 {
 	echo -e "\nExtracting multi-file image contents..."
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 0 ${DATAFILE0}
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 1 ${DATAFILE1}
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 2 ${DATAFILE2}
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 2 ${DATAFILE2} -o ${TEST_OUT}
+	do_cmd ${DUMPIMAGE} -T multi -p 0 -o ${DATAFILE0} ${IMAGE_MULTI}
+	do_cmd ${DUMPIMAGE} -T multi -p 1 -o ${DATAFILE1} ${IMAGE_MULTI}
+	do_cmd ${DUMPIMAGE} -T multi -p 2 -o ${DATAFILE2} ${IMAGE_MULTI}
+	do_cmd ${DUMPIMAGE} -T multi -p 2 -o ${TEST_OUT} ${IMAGE_MULTI}
 	echo "done."
 }
 
@@ -166,10 +166,10 @@ create_fit_image()
 extract_fit_image()
 {
 	echo -e "\nExtracting FIT image contents..."
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 0 ${DATAFILE0}
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 1 ${DATAFILE1}
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 2 ${DATAFILE2}
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 2 ${DATAFILE2} -o ${TEST_OUT}
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 0 -o ${DATAFILE0} ${IMAGE_FIT_ITB}
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 1 -o ${DATAFILE1} ${IMAGE_FIT_ITB}
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 2 -o ${DATAFILE2} ${IMAGE_FIT_ITB}
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 2 -o ${TEST_OUT} ${IMAGE_FIT_ITB}
 	echo "done."
 }
 
Signature · 1 line
2.20.1
#2 lore raw

PATCH 1/1 test: Update test-imagetools.sh to match new syntax

Quoted 5 lines · Martyn Welch

The syntax of dumpimage was simplified in commit 12b831879a76 ("tools:
dumpimage: Simplify arguments"), but the test (test/image/test-imagetools.sh) was not updated and is now failing.

Update the test to use the new syntax.

This does fix the tests with the new syntax, so:

It doesn't address the changed syntax of the command. All users of dumpimage outside of u-boot will have to update to the new syntax, and detect the version if they for some reason need to support both old and new dumpimage syntax. Maybe that's not a deal-breaker; I'm not sure how to cleanly handle that.

live well,
vagrant

Quoted 41 lines

---

 test/image/test-imagetools.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
test/image/test-imagetools.sh +8 -8
index 256af71d42..907f46a7b5 100755
@@ -102,10 +102,10 @@ create_multi_image()
 extract_multi_image()
 {
 	echo -e "\nExtracting multi-file image contents..."
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 0 ${DATAFILE0}
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 1 ${DATAFILE1}
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 2 ${DATAFILE2}
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 2 ${DATAFILE2} -o ${TEST_OUT}
+	do_cmd ${DUMPIMAGE} -T multi -p 0 -o ${DATAFILE0} ${IMAGE_MULTI}
+	do_cmd ${DUMPIMAGE} -T multi -p 1 -o ${DATAFILE1} ${IMAGE_MULTI}
+	do_cmd ${DUMPIMAGE} -T multi -p 2 -o ${DATAFILE2} ${IMAGE_MULTI}
+	do_cmd ${DUMPIMAGE} -T multi -p 2 -o ${TEST_OUT} ${IMAGE_MULTI}
 	echo "done."
 }
 
@@ -166,10 +166,10 @@ create_fit_image()
 extract_fit_image()
 {
 	echo -e "\nExtracting FIT image contents..."
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 0 ${DATAFILE0}
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 1 ${DATAFILE1}
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 2 ${DATAFILE2}
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 2 ${DATAFILE2} -o ${TEST_OUT}
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 0 -o ${DATAFILE0} ${IMAGE_FIT_ITB}
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 1 -o ${DATAFILE1} ${IMAGE_FIT_ITB}
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 2 -o ${DATAFILE2} ${IMAGE_FIT_ITB}
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 2 -o ${TEST_OUT} ${IMAGE_FIT_ITB}
 	echo "done."
 }
 
Signature · 1 line
2.20.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190219/d4382210/attachment.sig>

#3 lore raw

PATCH 1/1 test: Update test-imagetools.sh to match new syntax

Quoted 13 lines · Vagrant Cascadian
Quoted 6 lines · Martyn Welch

The syntax of dumpimage was simplified in commit 12b831879a76 ("tools:
dumpimage: Simplify arguments"), but the test (test/image/test-imagetools.sh) was not updated and is now failing.

Update the test to use the new syntax.

This does fix the tests with the new syntax, so:

Quoted 9 lines

It doesn't address the changed syntax of the command. All users of dumpimage outside of u-boot will have to update to the new syntax, and
detect the version if they for some reason need to support both old and
new dumpimage syntax. Maybe that's not a deal-breaker; I'm not sure how
to cleanly handle that.

Thanks for the Tested-by.

The syntax of dumpimage seemed horribly broken to me when I attempted to use it, hence deciding to scratch that itch.

This seems to be a developer tool and I can't think of any uses for this where I'd feel the need to script it. Of course I might be wrong and others may have very different workflows to me. :-)

There's the "-V" option that's been present since the first commit of this tool, so if necessary it would be possible to check that and make decisions based on what it returns.

Martyn

Quoted 61 lines

live well,
vagrant

Quoted 57 lines

---

 test/image/test-imagetools.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
test/image/test- renamed from test/image/test-imagetools.sh +0 -0

imagetools.sh
index 256af71d42..907f46a7b5 100755

test/image/test-imagetools.sh +0 -4
@@ -102,10 +102,10 @@ create_multi_image()
 extract_multi_image()
 {
 	echo -e "\nExtracting multi-file image contents..."
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 0
 ${DATAFILE0}
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 1
 ${DATAFILE1}
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 2
 ${DATAFILE2}
-	do_cmd ${DUMPIMAGE} -T multi -i ${IMAGE_MULTI} -p 2

${DATAFILE2} -o ${TEST_OUT}

test/image/test-imagetools.sh +1 -0
+	do_cmd ${DUMPIMAGE} -T multi -p 0 -o ${DATAFILE0}

${IMAGE_MULTI}

test/image/test-imagetools.sh +1 -0
+	do_cmd ${DUMPIMAGE} -T multi -p 1 -o ${DATAFILE1}

${IMAGE_MULTI}

test/image/test-imagetools.sh +1 -0
+	do_cmd ${DUMPIMAGE} -T multi -p 2 -o ${DATAFILE2}

${IMAGE_MULTI}

test/image/test-imagetools.sh +1 -4
+	do_cmd ${DUMPIMAGE} -T multi -p 2 -o ${TEST_OUT} ${IMAGE_MULTI}
 	echo "done."
 }
@@ -166,10 +166,10 @@ create_fit_image()
 extract_fit_image()
 {
 	echo -e "\nExtracting FIT image contents..."
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 0
 ${DATAFILE0}
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 1
 ${DATAFILE1}
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 2
 ${DATAFILE2}
-	do_cmd ${DUMPIMAGE} -T flat_dt -i ${IMAGE_FIT_ITB} -p 2

${DATAFILE2} -o ${TEST_OUT}

test/image/test-imagetools.sh +1 -0
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 0 -o ${DATAFILE0}

${IMAGE_FIT_ITB}

test/image/test-imagetools.sh +1 -0
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 1 -o ${DATAFILE1}

${IMAGE_FIT_ITB}

test/image/test-imagetools.sh +1 -0
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 2 -o ${DATAFILE2}

${IMAGE_FIT_ITB}

test/image/test-imagetools.sh +1 -0
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 2 -o ${TEST_OUT}

${IMAGE_FIT_ITB}
echo "done."
}

Signature · 1 line
2.20.1
#4 lore raw

[U-Boot] test: Update test-imagetools.sh to match new syntax

In reply to Martyn Welch
Quoted 9 lines · Martyn Welch

The syntax of dumpimage was simplified in commit 12b831879a76 ("tools:
dumpimage: Simplify arguments"), but the test (test/image/test-imagetools.sh) was not updated and is now failing.

Update the test to use the new syntax.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190308/66308323/attachment.sig>