Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C66FAC48BC2 for ; Sun, 27 Jun 2021 12:34:59 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D4D7461C17 for ; Sun, 27 Jun 2021 12:34:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4D7461C17 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C72382C54; Sun, 27 Jun 2021 14:34:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UxcILrFz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BCF8382C55; Sun, 27 Jun 2021 14:34:53 +0200 (CEST) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 714CA82C49 for ; Sun, 27 Jun 2021 14:34:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alpernebiyasak@gmail.com Received: by mail-ej1-x629.google.com with SMTP id gn32so24212127ejc.2 for ; Sun, 27 Jun 2021 05:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=A0ICMsCt/RuD5ZAU9405si/Lgiuq1i8KmZOpY61IvwM=; b=UxcILrFz+I5jpajYylhanGXkqHu4+GhQrdoe9fczn+SdwofehQs5A7JcxcSkw2/pUE r7u72NZcrdpsg7HM88/lK6mY3IwqSvY+tzvyA7J9+YMCGHUDL6dUs/jd5AsvoVpZG6FX yqXJoBdXfRv1R3mx0ld0fBg5EfgdUOOHuGEyrs6e4X52J7DEWzWjGiJmyVN78tdiMo/L c5+bPQZ4TwjhV67x/ShGJ3QNg7lCk1QEPANoOsXYHbzFxjEMzY67KyNsyQUrDrJdsJA/ lhke5nUJE3MWu5q3dLb314KaduPSaGoA4hEKNbnN4QqJISavhldjBWYeH8gHidm2VPcF UVrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=A0ICMsCt/RuD5ZAU9405si/Lgiuq1i8KmZOpY61IvwM=; b=r7tq48y1teFUiQKcnGO/TfpyBbncUtCLo2V5RvYwXUK2JKhhfevUS6UEAAE8CrcAMC gRHwcc/f3LXqCwJNKWEdBg1fD8weCmI1kIWAgEdbr8FNOO2eBER62eg+DS1008pAMcD4 NaNeNWZ4vN705JXxNd0QT7h+f3UG6t1OWH2UkwoleqmTqgdNwYg19q6uK2UgmC1T1seM H13tdMT46RVSRqnI/Vw7UadvvXB2FL0LfNaKgNjQbZb26IyV9y5ZcIqxZ9iML1xOLf/Y fyQYVbLQXVrmkN6ZyVKd6M3zPBFe/qb/UTRHgYLYZUCIaTQ0Spq5OEtLyWcNt5nvL481 tTIA== X-Gm-Message-State: AOAM531Q2afO+tltzOL3SNm+UhwmxPzFQJoekGEGbyvPz9hgU5hhHKRJ pytOEW3z1QRb6eQO/gHRFfc= X-Google-Smtp-Source: ABdhPJxKrpCZa65t8Qgft6XGH7qnk9QOwzbYXVEYw7y+c6uYiYgVrlrA4cF6q/twwgWae6/ZmHWMLQ== X-Received: by 2002:a17:906:9d12:: with SMTP id fn18mr19775389ejc.3.1624797290117; Sun, 27 Jun 2021 05:34:50 -0700 (PDT) Received: from [192.168.0.74] ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id i3sm4235319edk.37.2021.06.27.05.34.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Jun 2021 05:34:49 -0700 (PDT) Subject: Re: [PATCH 1/2] test/py: Use loop mounts if guestmount fails in filesystem tests To: Simon Glass Cc: U-Boot Mailing List , Heinrich Schuchardt , Stephen Warren , Andy Shevchenko , Tom Rini References: <20210604190447.45342-1-alpernebiyasak@gmail.com> From: Alper Nebi Yasak Message-ID: <0428361a-2148-9911-d10c-3db61d662ffc@gmail.com> Date: Sun, 27 Jun 2021 15:34:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 26/06/2021 21:29, Simon Glass wrote: > On Fri, 4 Jun 2021 at 13:05, Alper Nebi Yasak 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 >> --- >> >> 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 >