u-boot/test
Alper Nebi Yasak 77bfaad048 test: Fix filesystem tests always being skipped
Commit 1ba21bb06b ("test: Don't unmount not (yet) mounted system")
fixes an issue in the filesystem tests where the test setup may fail
to mount an image and still attempt to unmount it. However, the commit
unintentionally breaks the test setups in two ways.

The newly created unmounted filesystem images are being immediately
deleted due to some cleanup steps being misplaced into finally blocks,
which makes them always run instead of only on failures. The mount calls
always fail since the images never exist, causing the tests to be always
skipped. This patch moves these cleanup calls into the except blocks to
fix this and makes the tests run again.

There are also unmount calls misplaced into finally blocks, making them
run after the tests instead of before the tests. These unmount calls
make the filesystem image file consistent with the changes made to it as
part of the test setup, and this misplacement is making a number of
tests fail unexpectedly.

The unmount calls must be run before the tests use the image, meaning
before the yield call and not in the finally block. They must also be
run as a cleanup step when the filesystem setup fails, so they can't be
placed as the final call in the try blocks since they would be skipped
on such failures. For these reasons, this patch places the unmount calls
both in the except blocks and the else blocks of the final setup step.
This makes the unexpectedly failing tests to succeed again.

Furthermore, this isolates the mount calls to their own try-except
statement to avoid reintroducing the original issue of unmounting a
not-mounted image while fixing the unmount misplacement.

After these fixes, running "make tests" with guestmount available results
in two test failures not related to the mentioned commit. If the
guestmount executables are unavailable, the mounts fallback to using
sudo and result in no failures.

Fixes: 1ba21bb06b ("test: Don't unmount not (yet) mounted system")
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2021-05-26 17:26:07 -04:00
..
cmd hush: Fix assignments being misinterpreted as commands 2021-04-12 17:17:11 -04:00
dm part: Add check for NULL dev_part_str 2021-05-26 17:26:07 -04:00
env sandbox: add test of CONFIG_ENV_IMPORT_FDT 2021-05-04 12:52:30 -04:00
fs Consistently use nproc for counting the CPUs 2020-01-30 13:30:35 -05:00
image spl: test: Add a test for spl_load_simple_fit() 2021-03-12 09:57:31 -05:00
lib test: lmb: add test for overflow protection in lmb_add_region 2021-04-22 14:09:45 -04:00
log log: Handle line continuation 2021-03-12 17:41:35 -05:00
optee test: Add a macros for finding tests in linker_lists 2021-03-12 09:57:30 -05:00
overlay test: Add a macros for finding tests in linker_lists 2021-03-12 09:57:30 -05:00
py test: Fix filesystem tests always being skipped 2021-05-26 17:26:07 -04:00
stdint Remove <inttypes.h> includes and PRI* usages in printf() entirely 2018-09-10 20:48:17 -04:00
trace SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
bloblist.c test: Add a macros for finding tests in linker_lists 2021-03-12 09:57:30 -05:00
bootm.c test: Add a macros for finding tests in linker_lists 2021-03-12 09:57:30 -05:00
cmd_ut.c Prepare v2021.04-rc4 2021-03-15 12:15:38 -04:00
command_ut.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
common.sh Consistently use nproc for counting the CPUs 2020-01-30 13:30:35 -05:00
compression.c test: Add a macros for finding tests in linker_lists 2021-03-12 09:57:30 -05:00
Kconfig test: linking test/compression.c fails 2020-11-05 09:11:31 -07:00
Makefile spl: test: Add a test for spl_load_simple_fit() 2021-03-12 09:57:31 -05:00
nokia_rx51_test.sh Nokia RX-51: Add test for U-Boot serial console 2021-01-12 10:59:04 +05:30
print_ut.c dm: test: Always include command.h for print_ut 2021-03-28 17:30:35 -04:00
run test: Run sandbox_spl tests on sandbox_noinst 2021-03-26 17:03:09 +13:00
str_ut.c test: Add a macros for finding tests in linker_lists 2021-03-12 09:57:30 -05:00
test-main.c test: Use positive conditional in test_matches() 2021-04-29 03:23:39 -07:00
time_ut.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
unicode_ut.c Prepare v2021.04-rc4 2021-03-15 12:15:38 -04:00
ut.c test: Move delay skipping to test_pre_run() 2021-03-12 09:57:30 -05:00