Commit Graph

23 Commits

Author SHA1 Message Date
AKASHI Takahiro
9461fcce37 fs-test: update the test result as of v2018.09
As far as this patch series has been applied, all the tests should
pass. So update the test result summary.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23 21:55:30 +02:00
AKASHI Takahiro
e75996ce54 fs-test: fix false positive error at Test Case 12
The error message to be matched is wrong. Fix it.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-23 21:55:30 +02:00
Tom Rini
f437fea01c fs-test.sh: Update expected result output
Given 0dc1bfb730 ("fs: fat: cannot write to subdirectories") we have
changed how the FAT code works from creating the illegal file "./file"
and instead rejecting the path.  The correct behavior would be to write
"file" to "." but not writing an illegal file is a step in the right
direction.  For now, update the expected output to account for the
failure.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-07-30 19:56:44 -04:00
Eugen Hristev
78ccbd1395 test: fs: fs-test: Modified test 1 to do a ls to a nonexistent dir
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
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>       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  <<EOF

Subsequent tests will fail if U-boot crashes.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2018-05-23 17:30:04 -04:00
Tom Rini
f739fcd831 SPDX: Convert a few files that were missed before
As part of the main conversion a few files were missed.  These files had
additional whitespace after the '*' and before the SPDX tag and my
previous regex was too strict.  This time I did a grep for all SPDX tags
and then filtered out anything that matched the correct styles.

Fixes: 83d290c56f ("SPDX: Convert all of our single license tags to Linux Kernel style")
Reported-by: Heinrich Schuchardt <xypron.debian@gmx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-10 20:38:35 -04:00
Tom Rini
83d290c56f SPDX: Convert all of our single license tags to Linux Kernel style
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents.  There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07 09:34:12 -04:00
Tuomas Tynkkynen
7c890f149d fs-test: Add test for a filename using '..' to go back to the root
The previous commit fixed a problem in FAT code where going back to the
root directory using '..' wouldn't work correctly on FAT12 or FAT16.
Add a test to exercise this case (which was once fixed in commit
18a10d46f2 "fat: handle paths that include ../" but reintroduced due to
the directory iterator refactoring).

This test only very barely catches the problem - without the fix the
size command still gives valid output but the additional spurious
"Invalid FAT entry" error message makes it not get caught in the
'egrep -A3 ' output. I tried to make a proper test that grows the root
directory to two clusters lots of with dummy files but that causes the
write tests to crash the sandbox totally...

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-10-06 11:28:19 -04:00
Tuomas Tynkkynen
edce588a45 fs-test: Add FAT16 support
Currently we can only test FAT32 which is the default FAT version that
mkfs.vfat creates by default. Instead make it explicitly create either a
FAT16 or a FAT32 volume. This allows us to exercise more code, for
instance the root directory handling is done differently in FAT32 than
the older FATs.

Adding FAT12 support is a much bigger job since the test creates a 2.5GB
file and the FAT12 maximum partition size is way smaller than that.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Tom Rini <trini@konsulko.com>
2017-10-06 11:28:18 -04:00
Stefan Brüns
b18491520f fs-test.sh: Update expected results
After the latest changes, ext4 no longer has any fails.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
2016-11-21 14:07:28 -05:00
Tom Rini
df9e4cdabb fs-test.sh: Update expected results
Thanks to Stefan Brüns we have more tests and a few more passes too,
update the expected output now.

Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-23 09:29:49 -04:00
Stefan Brüns
2365a4b8ea test/fs: Check writes using "." (same dir) relative path
<path>/<fname> and <path>/./<fname> should reference the same file.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2016-09-23 08:57:44 -04:00
Stefan Brüns
14678b3c62 test/fs: Check ext4 behaviour if dirent is first entry in directory block
This is a regression test for a crash happening if the first dirent
in the block matches. Code tried to access a predecessor entry which
does not exist.
The crash happened for any block, but "." is always the first entry in
the first directory block and thus easy to check for.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2016-09-23 08:57:44 -04:00
Stefan Brüns
d9554b7f4b test/fs: strip noise from filesystem code prior to checking results
ext4 and fat code emit some diagnostic messages during command execution.
These additional lines force a match window size which strictly is not
necessary.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2016-09-23 08:57:43 -04:00
Stefan Brüns
06806e38d8 test/fs: remove use of undefined WRITE_FILE variable
The write file is created from $SMALL_FILE by appending ".w" on all
other occurences in the code.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2016-09-23 08:57:42 -04:00
Stefan Brüns
86853568ae test/fs: Restructure file path specification to allow some flexibility
Instead of providing the full path, specify directory and filename
separately. This allows to specify intermediate directories, required
for some additional tests.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2016-09-23 08:57:41 -04:00
Tom Rini
10ba92f69e fs-test.sh: Correct check_md5() test with newlines
The fs-test.sh script expected there to be a \n\r style newline at the
end of the output. This is no longer the case, so use 'tr' to remove the
\r that we get.

Fixes: (c5917b4b05 "dm: serial-uclass: Move a carriage return before a
        line feed")
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-08-22 19:37:56 -04:00
Stephen Warren
08eee2718a test/fs: error case fixes/enhancements
- 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>
2016-01-13 21:05:21 -05:00
Stephen Warren
34a60d9bc8 test: fat: add error-checking to non-contig test
Check the result code of all command that are executed. Without this,
if the fallocate invocation fails (this feature is not supported on ext3
filesystems for example) then a zero-length output file will be created,
and subsequent the mkfs and mount invocations will fail, which will cause
the subsequent dd invocation to attempt to fill up the host's entire free
disk space. That's not a nice user experience!

Related, if fallocate does fail, try to create the test disk image using
dd instead. That should work everywhere.

Fixes: 4a28274227 ("test: fat: add test of non-contiguous file reads")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2015-11-18 15:28:59 -05:00
Stephen Warren
47b7164450 fs-test.sh: fix pre-requisite detection
In the following snippet:

if [ ! -x `which $prereq` ]; then

When $prereq does not exist, `which $prereq` evaluates to the empty string,
which results in *no* argument being passed to the -x operator, which then
evaluates to true, which is the equivalent of the prereq having been found. In
order for this to fail as expected, we must pass an empty argument, which then
causes -x to fail. Do this by wrapping the `` in quotes so there's always an
argument to -x, even if the value of the argument is zero-length.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2015-10-24 13:50:34 -04:00
Stephen Warren
4a28274227 test: fat: add test of non-contiguous file reads
In my patch series to replace fs/fat with "ff.c", I enhanced ff.c to
optimize file reading, so that reads of contiguous clusters are submitted
to the IO device as a single read. This test attempts to torture-test
edge-cases of that enhancement.

BTW, the only way I found to validate that this script actually does
create non-contiguous files was to manually inspect the FAT bitmap in a
hex dump of the FAT image. hdparm --fibmap doesn't work on loop-mounted
filesystems. filefrag -v -e seems to lie about files being contiguous
when they aren't.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2015-10-24 13:50:34 -04:00
Tom Rini
e8de6d7b4a test/fs/fs-test.sh: Update expected results and TC10 logic
With the changes in 7a3e70c we now get read(2) behavior so trying to
read 2MB with 1MB left in the file results in 1MB read and a warning.
We update the test logic here to make sure we read back 1MB as expected.
This change however changes the overall summary as while EXT4 continues
to not have offset support the test now fails when expected to pass
rather than fails when expected to fail (and we report that as pass).

Signed-off-by: Tom Rini <trini@konsulko.com>
2015-10-11 17:12:14 -04:00
Stephen Warren
04812605f3 fs-test.sh: minor fixes
- Re-direct stderr into the log files, so any errors U-Boot emits are
  visible in the logs. This is relevant if the "reset" shell command
  attempts to report that it's not supported on the sandbox board.
- Fix test_fs_nonfs() to name the files it created differently for each
  invocation. Otherwise, the logs from different tests overwrite
  each-other.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Suriyan Ramasami <suriyan.r@gmail.com>
2015-08-18 13:45:59 -04:00
Suriyan Ramasami
6c016485a6 sandbox: script for testing sandbox/ext4/fat/fs commands
Test size/read/write commands in a sandbox environment.

Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com>

Acked-by: Simon Glass <sjg@chromium.org>
2014-11-23 06:49:05 -05:00