diff --git a/examples/tests/bonnie.py b/examples/tests/bonnie.py new file mode 100644 index 0000000000000000000000000000000000000000..705ecf5013d7a9e344cd3ff5448bf790ffa4a556 --- /dev/null +++ b/examples/tests/bonnie.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +import os + +from avocado import Test +from avocado import main +from avocado.utils import archive +from avocado.utils import build +from avocado.utils import process + + +class Bonnie(Test): + + """ + Bonnie++ is a benchmark suite that is aimed at performing a number + of simple tests of hard drive and file system performance. + """ + + def setUp(self): + """ + Build bonnie++ + Source: + http://www.coker.com.au/bonnie++/experimental/bonnie++-1.96.tgz + """ + bonnie_tarball = self.params.get('bonnie_tarball', + default='bonnie++-1.96.tgz') + tarball_path = self.get_data_path(bonnie_tarball) + archive.extract(tarball_path, self.srcdir) + bonnie_version = bonnie_tarball.split('.tgz')[0] + self.srcdir = os.path.join(self.srcdir, bonnie_version) + os.chdir(self.srcdir) + process.run('./configure') + build.make(self.srcdir) + + def test(self): + """ + Run 'bonnie' with its arguments + """ + scratch_dir = self.params.get('scratch-dir', default=self.srcdir) + uid_to_use = self.params.get('uid-to-use', default=None) + number_to_stat = self.params.get('number-to-stat', default=2048) + + args = [] + args.append('-d %s' % scratch_dir) + args.append('-n %s' % number_to_stat) + if uid_to_use is not None: + args.append('-u %s' % uid_to_use) + + cmd = ('%s/bonnie++ %s' % (self.srcdir, " ".join(args))) + process.run(cmd) + + +if __name__ == "__main__": + main() diff --git a/examples/tests/bonnie.py.data/bonnie++-1.96.tgz b/examples/tests/bonnie.py.data/bonnie++-1.96.tgz new file mode 100644 index 0000000000000000000000000000000000000000..c0ef56d9ecd754192f66f1d30b1f5dd59a6c56d7 Binary files /dev/null and b/examples/tests/bonnie.py.data/bonnie++-1.96.tgz differ diff --git a/examples/tests/bonnie.py.data/bonnie.yaml b/examples/tests/bonnie.py.data/bonnie.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3b2c3d28f00163b439c7419b8fd9fe458d47022c --- /dev/null +++ b/examples/tests/bonnie.py.data/bonnie.yaml @@ -0,0 +1,13 @@ +# Bonnie options: +# bonnie++ [-d scratch-dir] [-c concurrency] [-s size(MiB)[:chunk-size(b)]] +# [-n number-to-stat[:max-size[:min-size][:num-directories[:chunk-size]]]] +# [-m machine-name] [-r ram-size-in-MiB] +# [-x number-of-tests] [-u uid-to-use:gid-to-use] [-g gid-to-use] +# [-q] [-f] [-b] [-p processes | -y] [-z seed | -Z random-file] +# [-D] + +# Valid options in avocado test are bellow: +setup: + scratch-dir: null + uid-to-use: null + number-to-stat: null