diff --git a/examples/tests/compilebench.py b/examples/tests/compilebench.py new file mode 100644 index 0000000000000000000000000000000000000000..509d4e3b1098757824ba37f2863c8e7bed9496b7 --- /dev/null +++ b/examples/tests/compilebench.py @@ -0,0 +1,52 @@ +#!/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() diff --git a/examples/tests/compilebench.py.data/compilebench-0.6.tar.bz2 b/examples/tests/compilebench.py.data/compilebench-0.6.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..6d106421c3e514667bd3b5bf98aa1dc63cc6bfad Binary files /dev/null and b/examples/tests/compilebench.py.data/compilebench-0.6.tar.bz2 differ diff --git a/examples/tests/compilebench.py.data/compilebench.yaml b/examples/tests/compilebench.py.data/compilebench.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dbca95553670dfe8a1af13b701c30aa1edece623 --- /dev/null +++ b/examples/tests/compilebench.py.data/compilebench.yaml @@ -0,0 +1,33 @@ +# 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