[PATCH] test: Have test_fs work with non-functional guestmount tools

Tom Rini trini at konsulko.com
Tue Jul 7 20:46:30 CEST 2020


On Tue, Jul 07, 2020 at 12:34:19PM -0600, Stephen Warren wrote:
> On 7/7/20 9:53 AM, Tom Rini wrote:
> > Since 2011 Ubuntu has intentionally broken support for guestmount[1] by
> > default and requires sysadmin intervention to re-enable support.  This
> > in turn exposed that in our tests if guestmount is available but fails
> > we do not fall back to trying to use sudo.  Restructure our code to try
> > sudo if guestmount fails rather than only when it is not in our path.
> > Further, only note that we are using fuse on success of the call.
> > 
> > [1]: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
> 
> That is ... an interesting bug!
> 
> This change looks conceptually fine.
> 
> > diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py
> ...
> > @@ -206,10 +206,11 @@ def mount_fs(fs_type, device, mount_point):
> ...> +        try:
> >              mount_opt = 'loop,rw'
> >              if re.match('fat', fs_type):
> >                  mount_opt += ',umask=0000'
> ...
> >  
> >              # may not be effective for some file systems
> >              check_call('sudo chmod a+rw %s' % mount_point, shell=True)
> > +        except CalledProcessError:
> > +            raise
> 
> That last/inner try...except/raise clause doesn't seem useful. Perhaps
> just remote try...except and keep the body?

I don't quite follow, sorry.  What we have today is if/else on
guestmount, but since check_call() throws CalledProcessError when it
fails to run we never try sudo'ing.  That's why I put the inner
try/except/raise in.

-- 
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/20200707/0fda2c9d/attachment.sig>


More information about the U-Boot mailing list