synctest.py 1.6 KB
Newer Older
1 2
#!/usr/bin/python

3 4
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
5 6
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
7 8 9 10 11 12 13
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
14
# Copyright: Red Hat Inc. 2013-2014
15 16
# Author: Lucas Meneghel Rodrigues <lmr@redhat.com>

L
Lucas Meneghel Rodrigues 已提交
17 18 19
import os

from avocado import test
20
from avocado import job
L
Lucas Meneghel Rodrigues 已提交
21 22 23 24 25 26 27 28 29 30
from avocado.utils import archive
from avocado.utils import build
from avocado.utils import process


class synctest(test.Test):

    """
    Execute the synctest test suite.
    """
31 32 33
    default_params = {'sync_tarball': 'synctest.tar.bz2',
                      'sync_length': 100,
                      'sync_loop': 10}
L
Lucas Meneghel Rodrigues 已提交
34

35 36
    def setup(self):
        """
37
        Build the synctest suite.
38
        """
39
        self.cwd = os.getcwd()
40
        tarball_path = self.get_data_path(self.params.sync_tarball)
41
        archive.extract(tarball_path, self.srcdir)
L
Lucas Meneghel Rodrigues 已提交
42 43 44
        self.srcdir = os.path.join(self.srcdir, 'synctest')
        build.make(self.srcdir)

45 46 47 48
    def action(self):
        """
        Execute synctest with the appropriate params.
        """
L
Lucas Meneghel Rodrigues 已提交
49
        os.chdir(self.srcdir)
50 51
        cmd = ('./synctest %s %s' %
               (self.params.sync_length, self.params.sync_loop))
L
Lucas Meneghel Rodrigues 已提交
52
        process.system(cmd)
53
        os.chdir(self.cwd)
54 55 56 57


if __name__ == "__main__":
    job.main()