public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Stephen Warren <swarren@nvidia.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH 1/2] test/py: Use loop mounts if guestmount fails in filesystem tests
Date: Sun, 27 Jun 2021 15:34:45 +0300	[thread overview]
Message-ID: <0428361a-2148-9911-d10c-3db61d662ffc@gmail.com> (raw)
In-Reply-To: <CAPnjgZ0U=C7B2giT4nx+y2p9bAGJ+0BeJ=EqWWh3iK9zqsE_LA@mail.gmail.com>

On 26/06/2021 21:29, Simon Glass wrote:
> On Fri, 4 Jun 2021 at 13:05, Alper Nebi Yasak <alpernebiyasak@gmail.com> wrote:
>>
>> If guestmount isn't available on the system, filesystem test setup falls
>> back to using loop mounts to prepare its disk images. If guestmount is
>> available but fails to work, the tests are immediately skipped. Instead
>> of giving up on a guestmount failure, try using loop mounts as an
>> attempt to keep tests running.
>>
>> Also stop checking if guestmount is in PATH, as trying to run a missing
>> guestmount can now follow the same failure codepath and fall back to
>> loop mounts anyway.
>>
>> Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
>> ---
>>
>>  test/py/tests/test_fs/conftest.py | 31 +++++++++++++++----------------
>>  1 file changed, 15 insertions(+), 16 deletions(-)
> 
> https://source.denx.de/u-boot/custodians/u-boot-dm/-/jobs/282788
> 
> thoughts below

That CI run doesn't have this patch/series applied.

>>
>> diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py
>> index 410a675b9714..e3c461635f8e 100644
>> --- a/test/py/tests/test_fs/conftest.py
>> +++ b/test/py/tests/test_fs/conftest.py
>> @@ -205,24 +205,23 @@ def mount_fs(fs_type, device, mount_point):
>>      """
>>      global fuse_mounted
>>
>> -    fuse_mounted = False
>>      try:
>> -        if tool_is_in_path('guestmount'):
>> -            fuse_mounted = True
>> -            check_call('guestmount -a %s -m /dev/sda %s'
>> -                % (device, mount_point), shell=True)
>> -        else:
>> -            mount_opt = 'loop,rw'
>> -            if re.match('fat', fs_type):
>> -                mount_opt += ',umask=0000'
>> -
>> -            check_call('sudo mount -o %s %s %s'
>> -                % (mount_opt, device, mount_point), shell=True)
>> -
>> -            # may not be effective for some file systems
>> -            check_call('sudo chmod a+rw %s' % mount_point, shell=True)
>> +        check_call('guestmount -a %s -m /dev/sda %s'
>> +            % (device, mount_point), shell=True)
>> +        fuse_mounted = True
>> +        return
>>      except CalledProcessError:
>> -        raise
>> +        fuse_mounted = False
>> +
>> +    mount_opt = 'loop,rw'
>> +    if re.match('fat', fs_type):
> 
> This seems ambiguous. I think you should use:
> 
>    if 'fat' in fs_type:
> 
> or
> 
>    if fs_type.startswith('fat'):
> 
> or
> 
>   if fs_type == 'fat':
> 
> so it is clear what you mean.

This just unindents existing code. I can send v2 with startswith('fat')
though.

(I think I should rewrite the tests with guestfish and remove these
mount functions instead; but I'm busy with other things for a while.)

>> +        mount_opt += ',umask=0000'
>> +
>> +    check_call('sudo mount -o %s %s %s'
>> +        % (mount_opt, device, mount_point), shell=True)
>> +
>> +    # may not be effective for some file systems
>> +    check_call('sudo chmod a+rw %s' % mount_point, shell=True)
>>
>>  def umount_fs(mount_point):
>>      """Unmount a volume.
>> --
>> 2.32.0.rc2
>>
> 
> Regards,
> Simon
> 

  reply	other threads:[~2021-06-27 12:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04 19:04 [PATCH 1/2] test/py: Use loop mounts if guestmount fails in filesystem tests Alper Nebi Yasak
2021-06-04 19:04 ` [PATCH 2/2] test/py: Wait for guestmount worker to exit after running guestunmount Alper Nebi Yasak
2021-06-26 18:29   ` Simon Glass
2021-06-27 13:54     ` Alper Nebi Yasak
2021-07-06  0:58   ` Tom Rini
2021-06-26 18:29 ` [PATCH 1/2] test/py: Use loop mounts if guestmount fails in filesystem tests Simon Glass
2021-06-27 12:34   ` Alper Nebi Yasak [this message]
2021-07-06  0:58 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0428361a-2148-9911-d10c-3db61d662ffc@gmail.com \
    --to=alpernebiyasak@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=sjg@chromium.org \
    --cc=swarren@nvidia.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox