mbligh | e7a170f | 2006-12-05 07:48:18 +0000 | [diff] [blame^] | 1 | import test |
| 2 | from autotest_utils import * |
| 3 | from subprocess import * |
| 4 | |
| 5 | class bash_shared_mapping(test.test): |
| 6 | version = 3 |
| 7 | |
| 8 | # http://www.zip.com.au/~akpm/linux/patches/stuff/ext3-tools.tar.gz |
| 9 | def setup(self, tarball = 'ext3-tools.tar.gz'): |
| 10 | self.tarball = unmap_url(self.bindir, tarball, self.tmpdir) |
| 11 | extract_tarball_to_dir(self.tarball, self.srcdir) |
| 12 | |
| 13 | os.chdir(self.srcdir) |
| 14 | system('make bash-shared-mapping usemem') |
| 15 | |
| 16 | |
| 17 | def execute(self, testdir = None): |
| 18 | if not testdir: |
| 19 | testdir = self.tmpdir |
| 20 | os.chdir(testdir) |
| 21 | file = os.path.join(testdir, 'foo') |
| 22 | # Want to use twice total memsize |
| 23 | kilobytes = 2 * memtotal() |
| 24 | |
| 25 | # Want two usemem -m megabytes in parallel in background. |
| 26 | # Really need them to loop until they exit. then clean up. |
| 27 | usemem = "%s/usemem -m %d" % (self.srcdir, kilobytes / 1024) |
| 28 | Popen(usemem, shell=True) |
| 29 | Popen(usemem, shell=True) |
| 30 | |
| 31 | cmd = "%s/bash-shared-mapping %s %d -t %d" % \ |
| 32 | (self.srcdir, file, kilobytes, count_cpus()) |
| 33 | Popen(cmd, shell=True) |
| 34 | |