]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
check-memory: add 'receive' mode, for #97 (consumption during share receive
authorBrian Warner <warner@allmydata.com>
Wed, 19 Sep 2007 19:59:32 +0000 (12:59 -0700)
committerBrian Warner <warner@allmydata.com>
Wed, 19 Sep 2007 19:59:32 +0000 (12:59 -0700)
Makefile
src/allmydata/test/check_memory.py

index 6231420039a6a629e15a00b9d09a71775949338c..1fafe6948f3d68a433d3c0cef945c154ca3eccbf 100644 (file)
--- 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:
index bdd505214d352ef07eea3650fa7ca5a4fbcf46d2..e6e0f0e7e620cd9a2222e688e09edf6d52322376 100644 (file)
@@ -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.