3 import os, subprocess, sys, time
5 MNTDIR = '/mnt/bluesky'
6 SERVER = 'c09-45.sysnet.ucsd.edu'
9 def setup_client(self, export):
10 print "Mounting file system..."
11 subprocess.check_call(['mount', '-t', 'nfs',
12 '-o', 'vers=3,tcp,rw,soft,intr',
15 def cleanup_client(self):
16 print "Unmounting file system..."
17 subprocess.check_call(['umount', '-f', MNTDIR])
19 def run(self, proc, args=(), export=(SERVER + ":/export")):
20 self.setup_client(export)
21 startdir = os.getcwd()
31 def serial_stat(self):
32 files = ["file-%d" % (i,) for i in range(8)]
38 times.append(time.time() - start)
42 def serial_read(self):
43 files = ["file-%d" % (i,) for i in range(8)]
49 times.append(time.time() - start)
53 def serial_write(self):
54 files = ["write-%d" % (i,) for i in range(8)]
63 times.append(time.time() - start)
67 def large_write(self):
71 fp = open("largefile", 'w')
72 for i in range(128): fp.write(buf)
75 return [time.time() - start]
81 fp = open("largefile")
83 buf = fp.read(1048576)
86 return [time.time() - start]
89 subprocess.call(['/bin/sh'])
91 if __name__ == '__main__':
94 if not cmd.startswith("_"):
95 fun = getattr(TestCommands(), cmd)
97 result = client.run(fun, args)
98 print "Results:", result