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=-15.7 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,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 65FC0C4743C for ; Fri, 4 Jun 2021 19:05:19 +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 B8F056140C for ; Fri, 4 Jun 2021 19:05:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8F056140C 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 E99A682F0D; Fri, 4 Jun 2021 21:05:16 +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="nnj/h+I7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CB29C82F0D; Fri, 4 Jun 2021 21:05:15 +0200 (CEST) Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (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 8420882EC9 for ; Fri, 4 Jun 2021 21:05:11 +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-x633.google.com with SMTP id k25so10551430eja.9 for ; Fri, 04 Jun 2021 12:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GBMexwEvn0T0G8+ZtlymWVvOe7fTGKQCYRpGfzRaJN4=; b=nnj/h+I7q2srTNZmLbtv/yQ0BoHFO6zrzmvqH5u5ip4ZS21jzXbuWlW6iwBi+CKuGI 4IEViAe/hESxgzdgejXTH3srEiTB75b3BxoqWEXhAt6hZdfI11Ka6lYO/fr6VtvCiODo fMYM+IPFW/CUwv9df/4DvNP6fKTPToQ929Swhlsnb/HWCsAahVeLsNHEKvyPSWaFNe1Y 9IYgQyLo9i/ixDENC5v9lMNAMZELJKlCeHS3RsvQSBgBYIR4OUEpZ+/osr+RE4VNYyoZ 0ZZka7zIg06MAPLAwKy/DK5ZlwS9Ct4jwcvNS981DRT5TM9EockvFyaJDQX+zW0/djTx AHYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GBMexwEvn0T0G8+ZtlymWVvOe7fTGKQCYRpGfzRaJN4=; b=oNj/o1G2XNhpnvGMfdjfbQsV803Ce0OF+PKd2cz42CFXa1elvHo89nMyzKKGu/+KBs WQiGS/JTqR69zTFAGku+GbZ+QxKuaNp6xvivYPVsHXXKOqqsLRBLj9aURP9oaYYzlIWY CMTXPd2hz7mXWIZL0lGuRxSB3hur5RMYQVnVTc9Y9h1K489jr0DxhloNOdxob1tO2K3w yyaHPC81pgx6Zlj8tpW2HhEu8VwKnBC/jjCk4vvPfblsjLs3iZ6FjDTBnh7LiXePJF1d uzRoQ6KwsxeelcJ8ErAmU2EP4qcs2DYR4YLWc4yoQlMKCSHFA/4XzYAA05AQF1SPhOyF qkKg== X-Gm-Message-State: AOAM5312SknWlvcFPq+c62FYP4lqe6I17T+umUvBcQ9OL7HBu+vyZsX5 e8T2uSQUVJRmJ60NrJntcqeO4tyq6O4= X-Google-Smtp-Source: ABdhPJwSK7ypHB2KHMHDqF2ms6bCo3gv6/896jXwkaj3MUs9OZD+bb/QE5EpJPZGqigHnXBkxe24Tw== X-Received: by 2002:a17:906:2456:: with SMTP id a22mr5522289ejb.496.1622833510261; Fri, 04 Jun 2021 12:05:10 -0700 (PDT) Received: from localhost.localdomain ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id d24sm3112484ejr.51.2021.06.04.12.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 12:05:09 -0700 (PDT) From: Alper Nebi Yasak To: u-boot@lists.denx.de Cc: Simon Glass , Heinrich Schuchardt , Stephen Warren , Andy Shevchenko , Tom Rini , Alper Nebi Yasak Subject: [PATCH 1/2] test/py: Use loop mounts if guestmount fails in filesystem tests Date: Fri, 4 Jun 2021 22:04:45 +0300 Message-Id: <20210604190447.45342-1-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.32.0.rc2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.102.4 at phobos.denx.de X-Virus-Status: Clean 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(-) 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): + 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