summaryrefslogtreecommitdiff
path: root/client/tests/scrashme/scrashme.py
blob: 30ace1c98a675a3b4a689e64bdf038883053a276 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
from autotest_lib.client.bin import test, autotest_utils
from autotest_lib.client.common_lib import utils


class scrashme(test.test):
    version = 1

    # http://www.codemonkey.org.uk/projects/git-snapshots/scrashme/scrashme-2007-07-08.tar.gz
    def setup(self, tarball = 'scrashme-2007-07-08.tar.gz'):
        tarball = utils.unmap_url(self.bindir, tarball,
                                           self.tmpdir)
        autotest_utils.extract_tarball_to_dir(tarball, self.srcdir)
        os.chdir(self.srcdir)

        utils.system('make')

    def execute(self, iterations = 1, args_list = ''):
        if len(args_list) != 0:
            args = '' + args_list
        else:
            args = '-c100 -z'

        profilers = self.job.profilers
        if not profilers.only():
            for i in range(iterations):
                utils.system(self.srcdir + '/scrashme ' + args)

        # Do a profiling run if necessary
        if profilers.present():
            profilers.start(self)
            utils.system(self.srcdir + '/scrashme ' + args)
            profilers.stop(self)
            profilers.report(self)