File: test-imagetools-test-fixes

package info (click to toggle)
u-boot 2023.01%2Bdfsg-2%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 167,504 kB
  • sloc: ansic: 2,036,483; python: 39,879; asm: 21,501; makefile: 11,365; perl: 11,111; sh: 3,657; cpp: 1,868; yacc: 1,100; lex: 747; awk: 57; tcl: 28; sed: 24
file content (73 lines) | stat: -rw-r--r-- 2,598 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
This patch allows testing in an alternate directory and also detects
failures to execute commands, treating that as a failure.

--- a/test/image/test-imagetools.sh
+++ b/test/image/test-imagetools.sh
@@ -11,7 +11,7 @@
 # make O=sandbox
 # ./test/image/test-imagetools.sh
 
-BASEDIR=sandbox
+BASEDIR=${BASEDIR:-"sandbox"}
 SRCDIR=${BASEDIR}/boot
 IMAGE_NAME="v1.0-test"
 IMAGE_MULTI=linux.img
@@ -94,7 +94,7 @@
 
 	echo -e "\nBuilding multi-file image..."
 	do_cmd ${MKIMAGE} -A x86 -O linux -T multi -n \"${IMAGE_NAME}\" \
-		-d ${files} ${IMAGE_MULTI}
+		-d ${files} ${IMAGE_MULTI} || exit 1
 	echo "done."
 }
 
@@ -102,10 +102,10 @@
 extract_multi_image()
 {
 	echo -e "\nExtracting multi-file image contents..."
-	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}
+	do_cmd ${DUMPIMAGE} -T multi -p 0 -o ${DATAFILE0} ${IMAGE_MULTI} || exit 1
+	do_cmd ${DUMPIMAGE} -T multi -p 1 -o ${DATAFILE1} ${IMAGE_MULTI} || exit 1
+	do_cmd ${DUMPIMAGE} -T multi -p 2 -o ${DATAFILE2} ${IMAGE_MULTI} || exit 1
+	do_cmd ${DUMPIMAGE} -T multi -p 2 -o ${TEST_OUT} ${IMAGE_MULTI} || exit 1
 	echo "done."
 }
 
@@ -158,7 +158,7 @@
 	" > ${IMAGE_FIT_ITS}
 
 	echo -e "\nBuilding FIT image..."
-	do_cmd ${MKIMAGE} -f ${IMAGE_FIT_ITS} ${IMAGE_FIT_ITB}
+	do_cmd ${MKIMAGE} -f ${IMAGE_FIT_ITS} ${IMAGE_FIT_ITB} || exit 1
 	echo "done."
 }
 
@@ -166,10 +166,10 @@
 extract_fit_image()
 {
 	echo -e "\nExtracting FIT image contents..."
-	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}
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 0 -o ${DATAFILE0} ${IMAGE_FIT_ITB} || exit 1
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 1 -o ${DATAFILE1} ${IMAGE_FIT_ITB} || exit 1
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 2 -o ${DATAFILE2} ${IMAGE_FIT_ITB} || exit 1
+	do_cmd ${DUMPIMAGE} -T flat_dt -p 2 -o ${TEST_OUT} ${IMAGE_FIT_ITB} || exit 1
 	echo "done."
 }
 
@@ -181,8 +181,8 @@
 	local image="$1"
 
 	echo -e "\nListing image contents..."
-	do_cmd_redir ${MKIMAGE_LIST} ${MKIMAGE} -l ${image}
-	do_cmd_redir ${DUMPIMAGE_LIST} ${DUMPIMAGE} -l ${image}
+	do_cmd_redir ${MKIMAGE_LIST} ${MKIMAGE} -l ${image} || exit 1
+	do_cmd_redir ${DUMPIMAGE_LIST} ${DUMPIMAGE} -l ${image} || exit 1
 	echo "done."
 }