u-boot-brain/test/py/tests/test_fs
Andy Shevchenko 1ba21bb06b test: Don't unmount not (yet) mounted system
When test suite tries to create a file for a new filesystem test case and fails,
the clean up of the exception tries to unmount the image, that has not yet been
mounted. When it happens, the fuse_mounted global variable is set to False and
inconveniently the test case tries to use sudo, so without this change the
admin of the machine gets an (annoying) email:

  Subject: *** SECURITY information for example.com ***

  example.com : Feb  5 19:43:47 : ... COMMAND=/bin/umount .../build-sandbox/persistent-data/mnt

and second run of the test cases on uncleaned build folder will ask for sudo
which is not what expected.

Besides that there is a double unmount calls during successfully run test case.

All of these due to over engineered Python try-except clause and people didn't
get it properly at all. The rule of thumb is that don't use more keywords than
try-except in the exception handling code. Nevertheless, here we adjust code
to be less intrusive to the initial logic behind that complex and unclear
constructions in the test case, although it adds a lot of lines of the code,
i.e. splits one exception handler to three, so on each step we know what
cleanup shall perform.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-03-31 07:50:17 -04:00
..
test_squashfs test/py: Add tests for LZO and ZSTD 2020-08-24 14:11:31 -04:00
conftest.py test: Don't unmount not (yet) mounted system 2021-03-31 07:50:17 -04:00
fstest_defs.py test: fs: Added tests for symlinks 2019-04-09 20:04:03 -04:00
fstest_helpers.py test.py: Disable fsck for FAT tests for now 2019-04-10 08:15:56 -04:00
test_basic.py test: fs: Add filesystem integrity checks 2019-04-09 15:34:15 -04:00
test_ext.py cmd: fat: Use do_save() for fatwrite 2020-10-23 13:33:07 -04:00
test_fs_cmd.py cmd: fs: Add command to list supported fs types 2020-07-07 15:36:59 -04:00
test_mkdir.py test: fs: Add filesystem integrity checks 2019-04-09 15:34:15 -04:00
test_symlink.py test: fs: Added tests for symlinks 2019-04-09 20:04:03 -04:00
test_unlink.py test: fs: Add filesystem integrity checks 2019-04-09 15:34:15 -04:00