public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] test/fs: error case fixes/enhancements
@ 2015-12-14 22:01 Stephen Warren
  2016-01-13 18:30 ` Stephen Warren
  2016-01-14 13:21 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Warren @ 2015-12-14 22:01 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

- Use "mkdir -p" to avoid errors when intermediate directories are
  missing.
- Fall back to "dd" when "fallocate" fails. For example, fallocate isn't
  supported on ext4.
- Add error checking for test image generation. Without this, the test
  simply plows on spewing all kinds of errors which are hard to
  immediately root-cause.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 test/fs/fs-test.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh
index fc41c04c15e6..043e5d0c0e49 100755
--- a/test/fs/fs-test.sh
+++ b/test/fs/fs-test.sh
@@ -100,7 +100,7 @@ function compile_sandbox() {
 # We save time by not deleting and recreating the file system images
 function prepare_env() {
 	rm -f ${MD5_FILE}.* ${OUT}.*
-	mkdir ${OUT_DIR}
+	mkdir -p ${OUT_DIR}
 }
 
 # 1st parameter is the name of the image file to be created
@@ -115,11 +115,23 @@ function create_image() {
 	fi
 	if [ ! -f "$1" ]; then
 		fallocate -l 3G "$1" &> /dev/null
+		if [ $? -ne 0 ]; then
+			echo fallocate failed - using dd instead
+			dd if=/dev/zero of=$1 bs=1024 count=$((3 * 1024 * 1024))
+			if [ $? -ne 0 ]; then
+				echo Could not create empty disk image
+				exit $?
+			fi
+		fi
 		mkfs -t "$2" $MKFS_OPTION "$1" &> /dev/null
 		if [ $? -ne 0 -a "$2" = "fat" ]; then
 			# If we fail and we did fat, try vfat.
 			mkfs -t vfat $MKFS_OPTION "$1" &> /dev/null
 		fi
+		if [ $? -ne 0 ]; then
+			echo Could not create filesystem
+			exit $?
+		fi
 	fi
 }
 
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-14 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-14 22:01 [U-Boot] [PATCH] test/fs: error case fixes/enhancements Stephen Warren
2016-01-13 18:30 ` Stephen Warren
2016-01-14 13:21 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox