summaryrefslogtreecommitdiff
path: root/libbtrfsutil/python
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2018-03-29 00:53:55 -0700
committerDavid Sterba <dsterba@suse.com>2018-03-30 22:54:41 +0200
commit660adc0e1cad9fa46d4f689ae9c5c3202041863f (patch)
tree507579b6bdb0a21ba5ea9337d4d63d786805469b /libbtrfsutil/python
parentf5dd778f5299088f89d380ce922a84d77a98b9d6 (diff)
libbtrfsutil: use local mkfs.btrfs for tests if it exists
The system might not have mkfs installed at all. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'libbtrfsutil/python')
-rw-r--r--libbtrfsutil/python/tests/__init__.py6
1 files changed, 5 insertions, 1 deletions
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)