From: robk-tahoe Date: Tue, 21 Oct 2008 00:29:02 +0000 (-0700) Subject: * fuse/runtests: added --catch-up-pause option X-Git-Url: https://git.rkrishnan.org/simplejson/$rel_link?a=commitdiff_plain;h=06b05a868d40bf719fbe2009f8566667089aac6e;p=tahoe-lafs%2Ftahoe-lafs.git * fuse/runtests: added --catch-up-pause option On linux, write tests are failing because data written to fuse isn't showing up in tahoe by the time it's checked. it's not clear where this is originating, since the fuse implementation [should be] waiting for completion of tahoe operations before returning from its calls. This adds an option to control the duration of a pause between the fuse write and the check of tahoe, which is by default set to 2s on linux, which - somewhat inexplicably - seems to 'fix' the problem, in as far as it allows tests to complete. --- diff --git a/contrib/fuse/runtests.py b/contrib/fuse/runtests.py index 38aca2aa..050f066f 100644 --- a/contrib/fuse/runtests.py +++ b/contrib/fuse/runtests.py @@ -81,6 +81,10 @@ if sys.platform == 'darwin': del implementations['impl_a'] del implementations['impl_b'] +default_catch_up_pause = 0 +if sys.platform == 'linux2': + default_catch_up_pause = 2 + class FuseTestsOptions(usage.Options): optParameters = [ ["test-type", None, "both", @@ -102,6 +106,8 @@ class FuseTestsOptions(usage.Options): # Note; this is '/tmp' because on leopard, tempfile.mkdtemp creates # directories in a location which leads paths to exceed what macfuse # can handle without leaking un-umount-able fuse processes. + ["catch-up-pause", None, str(default_catch_up_pause), + "Pause between tahoe operations and fuse tests thereon"], ] optFlags = [ ["debug-wait", None, @@ -126,6 +132,7 @@ class FuseTestsOptions(usage.Options): self.tests = map(str.strip, self['tests'].split(',')) else: self.tests = None + self.catch_up_pause = float(self['catch-up-pause']) ### Main flow control: def main(args): @@ -221,6 +228,9 @@ class SystemTest (object): url += urllib.quote(where) webbrowser.open(url) + def maybe_pause(self): + time.sleep(self.config.catch_up_pause) + def init_cli_layer(self): '''This layer finds the appropriate tahoe executable.''' #self.cliexec = os.path.join('.', 'bin', 'tahoe') @@ -524,6 +534,7 @@ class SystemTest (object): tmpl = 'Could not write to file %r: %r' raise TestFailure(tmpl, path, err) + self.maybe_pause() self._check_write(testcap, name, body) def _check_write(self, testcap, name, expected_body): @@ -557,6 +568,7 @@ class SystemTest (object): tmpl = 'Could not write to file %r: %r' raise TestFailure(tmpl, path, err) + self.maybe_pause() self._check_write(testcap, name, body) @@ -597,6 +609,7 @@ class SystemTest (object): tmpl = 'Could not write to file %r: %r' raise TestFailure(tmpl, path, err) + self.maybe_pause() self._check_write(testcap, name, body) def test_write_partial_overwrite(self, testcap, testdir): @@ -631,6 +644,7 @@ class SystemTest (object): cap = self.webapi_call('PUT', '/uri', body) self.attach_node(testcap, cap, name) + self.maybe_pause() contents = read_file(path) if contents != body: