提交 51af0934 编写于 作者: L Lucas Meneghel Rodrigues

Merge pull request #940 from apahim/port_compilebench

avocado.tests: Port compilebench from autotest [v2]
#!/usr/bin/env python
import os
from avocado import Test
from avocado import main
from avocado.utils import archive
from avocado.utils import process
class Compilebench(Test):
"""
Compilebench tries to age a filesystem by simulating some of the
disk IO common in creating, compiling, patching, stating and
reading kernel trees.
"""
def setUp(self):
"""
Extract compilebench
Source:
https://oss.oracle.com/~mason/compilebench/compilebench-0.6.tar.bz2
"""
cb_tarball = self.params.get('cb_tarball',
default='compilebench-0.6.tar.bz2')
tarball_path = self.get_data_path(cb_tarball)
archive.extract(tarball_path, self.srcdir)
cb_version = cb_tarball.split('.tar.')[0]
self.srcdir = os.path.join(self.srcdir, cb_version)
def test(self):
"""
Run 'compilebench' with its arguments
"""
initial_dirs = self.params.get('INITIAL_DIRS', default=10)
runs = self.params.get('RUNS', default=30)
args = []
args.append('-D %s ' % self.srcdir)
args.append('-s %s ' % self.srcdir)
args.append('-i %d ' % initial_dirs)
args.append('-r %d ' % runs)
# Using python explicitly due to the compilebench current
# shebang set to python2.4
cmd = ('python %s/compilebench %s' % (self.srcdir, " ".join(args)))
process.run(cmd)
if __name__ == "__main__":
main()
# Usage: compilebench [options]
# version: 0.6
#
# Options:
# -h, --help show this help message and exit
# -b BUFFER_SIZE, --buffer-size=BUFFER_SIZE
# buffer size (bytes)
# -i INITIAL_DIRS, --initial-dirs=INITIAL_DIRS
# number of dirs initially created
# -r RUNS, --runs=RUNS number of rand op runs
# -D DIRECTORY, --directory=DIRECTORY
# working directory
# -s SOURCES, --sources=SOURCES
# data set source file directory
# -t TRACE, --trace=TRACE
# blktrace output file
# -d DEVICE, --device=DEVICE
# blktrace device
# -m, --makej simulate a make -j on the initial dirs and exit
# -n, --no-sync don't sync and drop caches between each iteration
# Valid options in avocado test are bellow:
setup:
trees: !mux
default:
INITIAL_DIRS: null
quick:
INITIAL_DIRS: 5
runs: !mux
default:
RUNS: null
minimal:
RUNS: 1
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册