From patchwork Thu Mar 29 07:53:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 10314657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B57CF60212 for ; Thu, 29 Mar 2018 07:54:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABBFB2A176 for ; Thu, 29 Mar 2018 07:54:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A06102A1D6; Thu, 29 Mar 2018 07:54:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EAA92A176 for ; Thu, 29 Mar 2018 07:54:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752080AbeC2HyJ (ORCPT ); Thu, 29 Mar 2018 03:54:09 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34121 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbeC2HyG (ORCPT ); Thu, 29 Mar 2018 03:54:06 -0400 Received: by mail-pg0-f68.google.com with SMTP id y16so2025943pgv.1 for ; Thu, 29 Mar 2018 00:54:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=9Ny09xE/VTEkTFuFmMtn3kR+wICjL18WLwTBUSvgz/U=; b=LFyLuO/l39uNAWcRlTWiTKRHeFVFPJEBEkCU5+mvDhIHAjN7Jm4SCWWchHbuFILDux t/d/yryNtllTKiyCDN2L7PYp2Iqk6BLRvicOx76ftGOBP9bZqp6i0eSqldubTesfS0Pe tceUXhn5n+nx4CHQXdiEQQcTr5oHu0LS1WigszU7UgGr0zWqwlXDqf0DhXpYbkgT+N4K ZV776GXEbkPBq1/R+LS0AoikUV8KkwvDcAgcT8t2HJUpOi0cbE91qD2+dQi3FV4qRzgq OW89yl0vLw1Zya46QxUFC296EV8gmD1Co2L+1rGhZ+1sna91sKnItpYh49D2o0KHwoSd Q9Lw== 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:in-reply-to :references:in-reply-to:references; bh=9Ny09xE/VTEkTFuFmMtn3kR+wICjL18WLwTBUSvgz/U=; b=jrZJI9zvrtoHuQwOJ7wvKKRQG+TATmxrMrw30mGjUt/j9eii3600xkqvEv09F/5Er/ NPe4ngZVJByTr4hRCPtO9VZJHWTiKuuJb9NkcyLl2frD8C6Rgqp1/Y1gj2FjPvVY1URV v13lH/IhXwcqjqAqIH4Frur31tVcPjT3A5bY1q/DXrXaIBIfhx+JFUdyLRLH/YDWrAj3 G86ewmK1QwJiPwHiUjpS3gqLIFn32telbQM7/R5hi5MsqZz9WilrxYtuYG15xZvMvVnY PSHyWW4bUR7qCqC41hkarLyEPi2nnDIBNXjXDg/OJeln+gPbCN9N0NbHtnXFFkJBLJGq V4CQ== X-Gm-Message-State: AElRT7H1TyUiAYatoKU0/ScO14L+G7lRdZzzm0JYhelNKRdTGSS22nJd aeVg2NX3Hh+obtQj0WtWBOZ/obXsEqo= X-Google-Smtp-Source: AIpwx4/WE2UavqUS+tij9Ju+F6zRMdvKszRM6f17zbCl/Z/KWknhWu0TvYOZGgeHnVAnGm22iBry/w== X-Received: by 10.98.156.16 with SMTP id f16mr5552079pfe.180.1522310045829; Thu, 29 Mar 2018 00:54:05 -0700 (PDT) Received: from localhost.localdomain ([2601:602:8801:8110:e6a7:a0ff:fe0b:c9a8]) by smtp.gmail.com with ESMTPSA id j65sm9763790pge.58.2018.03.29.00.54.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 00:54:05 -0700 (PDT) From: Omar Sandoval To: linux-btrfs@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH 3/5] libbtrfsutil: use local mkfs.btrfs for tests if it exists Date: Thu, 29 Mar 2018 00:53:55 -0700 Message-Id: <17179692e153c54e92591a728b7a28b9c2127bce.1522309741.git.osandov@fb.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval The system might not have mkfs installed at all. Signed-off-by: Omar Sandoval --- Makefile | 2 +- libbtrfsutil/python/tests/__init__.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8afc8f6e..699f864d 100644 --- a/Makefile +++ b/Makefile @@ -357,7 +357,7 @@ testsuite: btrfs-corrupt-block fssum $(Q)cd tests && ./export-testsuite.sh ifeq ($(PYTHON_BINDINGS),1) -test-libbtrfsutil: libbtrfsutil_python +test-libbtrfsutil: libbtrfsutil_python mkfs.btrfs $(Q)cd libbtrfsutil/python; \ LD_LIBRARY_PATH=../.. $(PYTHON) -m unittest discover -v tests diff --git a/libbtrfsutil/python/tests/__init__.py b/libbtrfsutil/python/tests/__init__.py index d2c6ff28..35550e0a 100644 --- a/libbtrfsutil/python/tests/__init__.py +++ b/libbtrfsutil/python/tests/__init__.py @@ -37,8 +37,12 @@ class BtrfsTestCase(unittest.TestCase): os.rmdir(self.mountpoint) raise e + if os.path.exists('../../mkfs.btrfs'): + mkfs = '../../mkfs.btrfs' + else: + mkfs = 'mkfs.btrfs' try: - subprocess.check_call(['mkfs.btrfs', '-q', self.image]) + subprocess.check_call([mkfs, '-q', self.image]) subprocess.check_call(['mount', '-o', 'loop', '--', self.image, self.mountpoint]) except Exception as e: os.remove(self.image)