Message saying that we couldn't find bin/tahoe should say where we looked

This commit is contained in:
david-sarah 2010-01-16 12:45:56 -08:00
parent 5c04fd689a
commit 174d356692

View File

@ -13,20 +13,27 @@ from allmydata.test import common_util
import allmydata import allmydata
bintahoe = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(allmydata.__file__))), 'bin', 'tahoe') bintahoe = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(allmydata.__file__))), 'bin', 'tahoe')
if sys.platform == "win32": if sys.platform == "win32": # TODO: should this include cygwin?
bintahoe += ".exe" bintahoe += ".exe"
class SkipOnCygwinMixin:
def skip_on_cygwin(self): class SkipMixin:
def skip_if_cannot_run_bintahoe(self):
if "cygwin" in sys.platform.lower(): if "cygwin" in sys.platform.lower():
raise unittest.SkipTest("We don't know how to make this test work on cygwin: spawnProcess seems to hang forever. We don't know if 'bin/tahoe start' can be run on cygwin.") raise unittest.SkipTest("We don't know how to make this test work on cygwin: spawnProcess seems to hang forever. We don't know if 'bin/tahoe start' can be run on cygwin.")
class TheRightCode(common_util.SignalMixin, unittest.TestCase,
SkipOnCygwinMixin):
def test_path(self):
self.skip_on_cygwin()
if not os.path.exists(bintahoe): if not os.path.exists(bintahoe):
raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.") raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location (%s), and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of Tahoe. Perhaps running 'setup.py build' again will help." % (bintahoe,))
def skip_if_cannot_daemonize(self):
self.skip_if_cannot_run_bintahoe()
if runtime.platformType == "win32":
# twistd on windows doesn't daemonize. cygwin should work normally.
raise unittest.SkipTest("twistd does not fork under windows")
class TheRightCode(common_util.SignalMixin, unittest.TestCase, SkipMixin):
def test_path(self):
self.skip_if_cannot_run_bintahoe()
d = utils.getProcessOutputAndValue(bintahoe, args=["--version-and-path"], env=os.environ) d = utils.getProcessOutputAndValue(bintahoe, args=["--version-and-path"], env=os.environ)
def _cb(res): def _cb(res):
out, err, rc_or_sig = res out, err, rc_or_sig = res
@ -41,6 +48,7 @@ class TheRightCode(common_util.SignalMixin, unittest.TestCase,
d.addCallback(_cb) d.addCallback(_cb)
return d return d
class CreateNode(unittest.TestCase): class CreateNode(unittest.TestCase):
# exercise "tahoe create-node", create-introducer, # exercise "tahoe create-node", create-introducer,
# create-key-generator, and create-stats-gatherer, by calling the # create-key-generator, and create-stats-gatherer, by calling the
@ -227,7 +235,7 @@ class CreateNode(unittest.TestCase):
class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin, class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin,
SkipOnCygwinMixin): SkipMixin):
# exercise "tahoe start", for both introducer, client node, and # exercise "tahoe start", for both introducer, client node, and
# key-generator, by spawning "tahoe start" as a subprocess. This doesn't # key-generator, by spawning "tahoe start" as a subprocess. This doesn't
# get us figleaf-based line-level coverage, but it does a better job of # get us figleaf-based line-level coverage, but it does a better job of
@ -246,12 +254,7 @@ class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin,
return basedir return basedir
def test_introducer(self): def test_introducer(self):
self.skip_on_cygwin() self.skip_if_cannot_daemonize()
if not os.path.exists(bintahoe):
raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.")
if runtime.platformType == "win32":
# twistd on windows doesn't daemonize. cygwin works normally.
raise unittest.SkipTest("twistd does not fork under windows")
basedir = self.workdir("test_introducer") basedir = self.workdir("test_introducer")
c1 = os.path.join(basedir, "c1") c1 = os.path.join(basedir, "c1")
HOTLINE_FILE = os.path.join(c1, "suicide_prevention_hotline") HOTLINE_FILE = os.path.join(c1, "suicide_prevention_hotline")
@ -349,12 +352,7 @@ class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin,
test_introducer.timeout = 480 # This hit the 120-second timeout on "François Lenny-armv5tel", then it hit a 240-second timeout on our feisty2.5 buildslave: http://allmydata.org/buildbot/builders/feisty2.5/builds/2381/steps/test/logs/test.log test_introducer.timeout = 480 # This hit the 120-second timeout on "François Lenny-armv5tel", then it hit a 240-second timeout on our feisty2.5 buildslave: http://allmydata.org/buildbot/builders/feisty2.5/builds/2381/steps/test/logs/test.log
def test_client(self): def test_client(self):
self.skip_on_cygwin() self.skip_if_cannot_daemonize()
if not os.path.exists(bintahoe):
raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.")
if runtime.platformType == "win32":
# twistd on windows doesn't daemonize. cygwin works normally.
raise unittest.SkipTest("twistd does not fork under windows")
basedir = self.workdir("test_client") basedir = self.workdir("test_client")
c1 = os.path.join(basedir, "c1") c1 = os.path.join(basedir, "c1")
HOTLINE_FILE = os.path.join(c1, "suicide_prevention_hotline") HOTLINE_FILE = os.path.join(c1, "suicide_prevention_hotline")
@ -452,9 +450,7 @@ class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin,
return d return d
def test_baddir(self): def test_baddir(self):
self.skip_on_cygwin() self.skip_if_cannot_daemonize()
if not os.path.exists(bintahoe):
raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.")
basedir = self.workdir("test_baddir") basedir = self.workdir("test_baddir")
fileutil.make_dirs(basedir) fileutil.make_dirs(basedir)
@ -488,12 +484,7 @@ class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin,
return d return d
def test_keygen(self): def test_keygen(self):
self.skip_on_cygwin() self.skip_if_cannot_daemonize()
if not os.path.exists(bintahoe):
raise unittest.SkipTest("The bin/tahoe script isn't to be found in the expected location, and I don't want to test a 'tahoe' executable that I find somewhere else, in case it isn't the right executable for this version of tahoe.")
if runtime.platformType == "win32":
# twistd on windows doesn't daemonize. cygwin works normally.
raise unittest.SkipTest("twistd does not fork under windows")
basedir = self.workdir("test_keygen") basedir = self.workdir("test_keygen")
c1 = os.path.join(basedir, "c1") c1 = os.path.join(basedir, "c1")
TWISTD_PID_FILE = os.path.join(c1, "twistd.pid") TWISTD_PID_FILE = os.path.join(c1, "twistd.pid")