From: Brian Warner Date: Wed, 19 Sep 2007 19:59:32 +0000 (-0700) Subject: check-memory: add 'receive' mode, for #97 (consumption during share receive X-Git-Tag: allmydata-tahoe-0.6.0~60 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/file/URI:LIT:krugkidfnzsc4/%3C?a=commitdiff_plain;h=bede39a156cf8a7599d3088e3159ebad4cdd264f;p=tahoe-lafs%2Ftahoe-lafs.git check-memory: add 'receive' mode, for #97 (consumption during share receive --- diff --git a/Makefile b/Makefile index 62314200..1fafe694 100644 --- a/Makefile +++ b/Makefile @@ -138,8 +138,8 @@ figleaf-output: # after doing test-figleaf and figleaf-output, point your browser at # coverage-html/index.html -.PHONY: upload-figleaf .figleaf.el pyflakes count-lines check-memory -.PHONY: clean +.PHONY: upload-figleaf .figleaf.el pyflakes count-lines +.PHONY: check-memory check-memory-once clean # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting ifdef UPLOAD_TARGET @@ -193,7 +193,7 @@ check-memory: .built check-memory-once: .built rm -rf _test_memory $(PP) \ - $(PYTHON) src/allmydata/test/check_memory.py $(TYPE) + $(PYTHON) src/allmydata/test/check_memory.py $(MODE) test-darcs-boringfile: diff --git a/src/allmydata/test/check_memory.py b/src/allmydata/test/check_memory.py index bdd50521..e6e0f0e7 100644 --- a/src/allmydata/test/check_memory.py +++ b/src/allmydata/test/check_memory.py @@ -72,10 +72,7 @@ class SystemFramework(testutil.PollMixin): self.proc = None self.tub = foolscap.Tub() self.tub.setServiceParent(self.sparent) - self.discard_shares = True self.mode = mode - if mode in ("download", "download-GET", "download-GET-slow"): - self.discard_shares = False self.failed = False def run(self): @@ -167,13 +164,25 @@ class SystemFramework(testutil.PollMixin): f = open(os.path.join(nodedir, "vdrive.furl"), "w") f.write(self.vdrive_furl) f.close() - if self.discard_shares: - # for this test, we tell the storage servers to throw out all - # their stored data, since we're only testing upload and not - # download. + # the only tests for which we want the internal nodes to actually + # retain shares are the ones where somebody's going to download + # them. + if self.mode in ("download", "download-GET", "download-GET-slow"): + # retain shares + pass + else: + # for these tests, we tell the storage servers to pretend to + # accept shares, but really just throw them out, since we're + # only testing upload and not download. f = open(os.path.join(nodedir, "debug_no_storage"), "w") f.write("no_storage\n") f.close() + if self.mode in ("receive",): + # for this mode, the client-under-test gets all the shares, + # so our internal nodes can refuse requests + f = open(os.path.join(nodedir, "sizelimit"), "w") + f.write("0\n") + f.close() c = self.add_service(client.Client(basedir=nodedir)) self.nodes.append(c) # the peers will start running, eventually they will connect to each @@ -211,18 +220,22 @@ this file are ignored. f.write("tcp:%d:interface=127.0.0.1\n" % webport) f.close() self.webish_url = "http://localhost:%d" % webport - if self.discard_shares: - f = open(os.path.join(clientdir, "debug_no_storage"), "w") - f.write("no_storage\n") + if self.mode in ("upload-self", "receive"): + # accept and store shares, to trigger the memory consumption bugs + pass + else: + # don't accept any shares + f = open(os.path.join(clientdir, "sizelimit"), "w") + f.write("0\n") f.close() + ## also, if we do receive any shares, throw them away + #f = open(os.path.join(clientdir, "debug_no_storage"), "w") + #f.write("no_storage\n") + #f.close() if self.mode == "upload-self": f = open(os.path.join(clientdir, "push_to_ourselves"), "w") f.write("push_to_ourselves\n") f.close() - else: - f = open(os.path.join(clientdir, "sizelimit"), "w") - f.write("0\n") - f.close() self.keepalive_file = os.path.join(clientdir, "suicide_prevention_hotline") # now start updating the mtime. @@ -349,6 +362,12 @@ this file are ignored. data = "a" * size url = "/vdrive/global" d = self.POST(url, t="upload", file=("%d.data" % size, data)) + elif self.mode in ("receive",): + # upload the data from a local peer, so that the + # client-under-test receives and stores the shares + files[name] = self.create_data(name, size) + u = self.nodes[0].getServiceNamed("uploader") + d = u.upload_filename(files[name]) elif self.mode in ("download", "download-GET", "download-GET-slow"): # upload the data from a local peer, then have the # client-under-test download it.