From 660adc0e1cad9fa46d4f689ae9c5c3202041863f Mon Sep 17 00:00:00 2001 From: Omar Sandoval Date: Thu, 29 Mar 2018 00:53:55 -0700 Subject: libbtrfsutil: use local mkfs.btrfs for tests if it exists The system might not have mkfs installed at all. Signed-off-by: Omar Sandoval Signed-off-by: David Sterba --- libbtrfsutil/python/tests/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libbtrfsutil/python') 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) -- cgit v1.2.3