Skip to content
Snippets Groups Projects
Commit 6634816b authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix ‘make distcheck’ breakage introduced in r455

This patch fixes the ‘make distcheck’ breakage caused by missing test data in
the archive and missing handling of builddir!=srcdir case.

Reviewed-by: schreiberal
parent b63ed789
No related branches found
No related tags found
No related merge requests found
......@@ -11,5 +11,5 @@ check-am: do-pre-check
do-pre-check:
$(MAKE) -C $(top_builddir) pre-check
EXTRA_DIST = $(TESTS) mocks.py
EXTRA_DIST = $(TESTS) mocks.py data
CLEANFILES = *.py[co]
......@@ -22,6 +22,7 @@
"""Script for unittesting the bdev module"""
import os
import unittest
from ganeti import bdev
......@@ -43,6 +44,21 @@ class TestDRBD8Runner(unittest.TestCase):
)
return retval
@staticmethod
def _get_contents(name):
"""Returns the contents of a file"""
prefix = os.environ.get("srcdir", None)
if prefix:
name = prefix + "/" + name
fh = open(name, "r")
try:
data = fh.read()
finally:
fh.close()
return data
@staticmethod
def _has_net(data, local, remote):
"""Check network connection parameters"""
......@@ -60,7 +76,7 @@ class TestDRBD8Runner(unittest.TestCase):
def testParserBoth(self):
"""Test drbdsetup show parser for disk and network"""
data = open("data/bdev-both.txt").read()
data = self._get_contents("data/bdev-both.txt")
result = bdev.DRBD8._GetDevInfo(data)
self.failUnless(self._has_disk(result, "/dev/xenvg/test.data",
"/dev/xenvg/test.meta"),
......@@ -71,7 +87,7 @@ class TestDRBD8Runner(unittest.TestCase):
def testParserNet(self):
"""Test drbdsetup show parser for disk and network"""
data = open("data/bdev-net.txt").read()
data = self._get_contents("data/bdev-net.txt")
result = bdev.DRBD8._GetDevInfo(data)
self.failUnless(("local_dev" not in result and
"meta_dev" not in result and
......@@ -83,7 +99,7 @@ class TestDRBD8Runner(unittest.TestCase):
def testParserDisk(self):
"""Test drbdsetup show parser for disk and network"""
data = open("data/bdev-disk.txt").read()
data = self._get_contents("data/bdev-disk.txt")
result = bdev.DRBD8._GetDevInfo(data)
self.failUnless(self._has_disk(result, "/dev/xenvg/test.data",
"/dev/xenvg/test.meta"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment