1 2# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import os, shutil, re 7from autotest_lib.client.bin import utils, test 8 9class kernel_fs_Inplace(test.test): 10 version = 2 11 12 13 def setup(self, tarball='kernel_fs_Inplace.tar.gz'): 14 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) 15 utils.extract_tarball_to_dir(tarball, self.srcdir) 16 os.chdir(self.srcdir) 17 utils.system('make build') 18 19 20 def initialize(self): 21 self.job.require_gcc() 22 self.results = [] 23 self.job.drop_caches_between_iterations = True 24 25 26 def run_once(self, dir=None, iosize=4096, num_iter=100000, 27 scratch=None, results_file=None): 28 if not dir: 29 dir = os.path.join(self.srcdir, 'rdir') 30 shutil.rmtree(dir, True) 31 os.mkdir(dir) 32 if not scratch: 33 scratch = dir + '/.scratch' 34 if not results_file: 35 results_file = dir + '/kernel_fs_Inplace.results' 36 args = ' %d' % iosize 37 args += ' %d' % num_iter 38 args += ' ' + scratch 39 args += ' ' + results_file 40 self.results.append(utils.system_output(os.path.join(self.srcdir, 41 'inplace') + ' ' + args)) 42