From: Eugen Hristev Date: Wed, 9 May 2018 16:28:38 +0300 Subject: [U-Boot] [PATCH v2 2/2] test: fs: fs-test: Modified test 1 to do a ls to a nonexistent dir In-Reply-To: <1525872518-3818-1-git-send-email-eugen.hristev@microchip.com> References: <1525872518-3818-1-git-send-email-eugen.hristev@microchip.com> Message-ID: <1525872518-3818-2-git-send-email-eugen.hristev@microchip.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Added a simple ls to a nonexistent directory for test 1. In case the driver is broken for a nonexistent directory, U-boot might crash. Here is an example failed output: => # Test Case 1 - ls => ext4ls host 0:0 4096 . 4096 .. 16384 lost+found 4096 SUBDIR 2621440000 2.5GB.file 1048576 1MB.file => # In addition, test with a nonexistent directory to see if we crash. => ext4ls host 0:0 invalid_d ** Can not find directory. ** ./test/fs/fs-test.sh: line 161: 25786 Segmentation fault (core dumped) $UBOOT < --- Hello, Not sure whether this is the best test for this case, but I tried to do a separate case and: cannot really tell if it passed or not by just watching the output (several FS show nothing, EXT4 shows "Can not find directory"), so not really any string I can grep for to send to pass_fail function. So, I decided to add another command to test no 1, which is a basic 'ls' test to some 'invalid_d' directory. Like this, we won't see anything in the output, but, if U-boot crashes, the whole test series fails. test/fs/fs-test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh index 20d5dd8..6bb5311 100755 --- a/test/fs/fs-test.sh +++ b/test/fs/fs-test.sh @@ -225,6 +225,8 @@ setenv bind 'if test "\$sb" != sb; then sb bind 0 "$1"; fi' run bind # Test Case 1 - ls ${PREFIX}ls host${SUFFIX} $6 +# In addition, test with a nonexistent directory to see if we crash. +${PREFIX}ls host${SUFFIX} invalid_d # # We want ${PREFIX}size host 0:0 $3 for host commands and # sb size hostfs - $3 for hostfs commands. -- 2.7.4