From: Brian Warner <warner@allmydata.com>
Date: Wed, 26 Sep 2007 01:26:54 +0000 (-0700)
Subject: check_memory: put framework log in a stable place, add debug code to figure
X-Git-Tag: allmydata-tahoe-0.6.1~86
X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/readonly?a=commitdiff_plain;h=8d7368f7480cf9bd4224a96f34bf7061760c93e5;p=tahoe-lafs%2Ftahoe-lafs.git

check_memory: put framework log in a stable place, add debug code to figure
out why the keepalive-file isn't doing its job
---

diff --git a/src/allmydata/test/check_memory.py b/src/allmydata/test/check_memory.py
index 4da8f821..d84dc305 100644
--- a/src/allmydata/test/check_memory.py
+++ b/src/allmydata/test/check_memory.py
@@ -1,6 +1,6 @@
 #! /usr/bin/env python
 
-import os, shutil, sys, urllib
+import os, shutil, sys, urllib, time, stat
 from cStringIO import StringIO
 from twisted.internet import defer, reactor, protocol, error
 from twisted.application import service, internet
@@ -76,8 +76,9 @@ class SystemFramework(testutil.PollMixin):
         self.failed = False
 
     def run(self):
-        log.startLogging(open(os.path.join(self.testdir, "log"), "w"),
-                         setStdout=False)
+        framelog = os.path.join(self.basedir, "driver.log")
+        log.startLogging(open(framelog, "a"), setStdout=False)
+        log.msg("CHECK_MEMORY(mode=%s) STARTING" % self.mode)
         #logfile = open(os.path.join(self.testdir, "log"), "w")
         #flo = log.FileLogObserver(logfile)
         #log.startLoggingWithObserver(flo.emit, setStdout=False)
@@ -99,6 +100,7 @@ class SystemFramework(testutil.PollMixin):
         d.addBoth(_done)
         reactor.run()
         if self.failed:
+            # raiseException doesn't work for CopiedFailures
             self.failed.raiseException()
 
     def setUp(self):
@@ -204,6 +206,9 @@ class SystemFramework(testutil.PollMixin):
         # other and the introducer_and_vdrive
 
     def touch_keepalive(self):
+        if os.path.exists(self.keepalive_file):
+            age = time.time() - os.stat(self.keepalive_file)[stat.ST_MTIME]
+            log.msg("touching keepalive file, was %ds old" % age)
         f = open(self.keepalive_file, "w")
         f.write("""\
 If the node notices this file at startup, it will poll every 5 seconds and