[PATCH] test: Fix filesystem tests always being skipped

Tom Rini trini at konsulko.com
Thu May 27 13:42:27 CEST 2021


On Thu, May 20, 2021 at 10:09:46PM +0300, Alper Nebi Yasak wrote:

> Commit 1ba21bb06b08 ("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: 1ba21bb06b08 ("test: Don't unmount not (yet) mounted system")
> Signed-off-by: Alper Nebi Yasak <alpernebiyasak at gmail.com>
> Acked-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210527/1d631695/attachment.sig>


More information about the U-Boot mailing list