Author: gnichols
Date: 2010-08-06 01:32:42 +0000 (Fri, 06 Aug 2010)
New Revision: 623
Modified:
trunk/v7/test.py
Log:
621056 - v7 failed after reboot test
Modified: trunk/v7/test.py
===================================================================
--- trunk/v7/test.py 2010-08-06 01:32:17 UTC (rev 622)
+++ trunk/v7/test.py 2010-08-06 01:32:42 UTC (rev 623)
@@ -13,12 +13,13 @@
#
# Author: Greg Nichols
#
-import string, os, sys, copy, commands
+import string, os, sys, copy, commands, time
from v7.tags import Constants
from v7.commandLineUI import CommandLineUI
from v7.hal import Hal
+from v7.command import Command, V7CommandException
class Test(CommandLineUI):
@@ -436,4 +437,38 @@
def runOnServer(self, args, outFile):
outFile.write("Server side test for %s not implemented\n" %
self.Name())
+ def getLoadAvg(self):
+ loadAvgFile = "/proc/loadavg"
+ if os.path.exists(loadAvgFile):
+ file = open(loadAvgFile)
+ line = file.readline()
+ if len(line.strip()) > 0:
+ params = line.strip().split()
+ loadAvg = float(params[0])
+ print "Current load average: %s" % loadAvg
+ sys.stdout.flush
+ return loadAvg
+ else:
+ return 0
+
+
+ def syncDisks(self):
+ try:
+ command = Command("/bin/sync")
+ command.echo()
+ except V7CommandException, e:
+ print "Warning: v7 attempt to sync failed"
+ print e
+
+
+ def waitForLull(self):
+ waitTime = 5
+ retryLimit = 20
+
+ self.syncDisks()
+
+ retryCount = 0
+ while self.getLoadAvg() > 1 and retryCount < retryLimit:
+ time.sleep(waitTime)
+ retryCount = retryCount + 1
Show replies by date