multiplextest.py 3.1 KB
Newer Older
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
#!/usr/bin/python

# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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.
#
# Copyright: Red Hat Inc. 2014
# Author: Ruda Moura <rmoura@redhat.com>

from avocado import test
from avocado import job


class multiplextest(test.Test):

    """
    Execute the Linux Build test.
    """
26 27 28 29 30 31 32 33 34 35 36 37
    default_params = {'os_type': 'linux',
                      'gcc_flags': '-O2',
                      'huge_pages': 'yes',
                      'numa_balancing': 'yes',
                      'numa_balancing_migrate_deferred': 'no',
                      'drive_format': 'virtio_blk',
                      'nic_model': 'virtio_net',
                      'enable_msx_vectors': 'yes',
                      'sync_timeout': 12,
                      'sync_tries': 3,
                      'ping_timeout': 10,
                      'ping_tries': 5}
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

    def setup(self):
        self.compile_code()
        self.set_hugepages()
        self.set_numa_balance()
        self.assembly_vm()

        if self.params.os_type == 'windows':
            self.log.info('Preparing VM with Windows (%s)', self.params.win)
        if self.params.os_type == 'linux':
            self.log.info('Preparing VM with Linux (%s)', self.params.distro)

    def compile_code(self):
        self.log.info('Compile code')
        self.log.info('gcc %s %s', self.params.gcc_flags, 'code.c')

    def set_hugepages(self):
        if self.params.huge_pages == 'yes':
            self.log.info('Setting hugepages')

    def set_numa_balance(self):
        if self.params.numa_balance:
            self.log.info('Numa balancing: %s', self.params.numa_balance)
        if self.params.numa_balancing_migrate_deferred:
            self.log.info('Numa balancing migrate deferred: %s',
                          self.params.numa_balancing_migrate_deferred)

    def assembly_vm(self):
        self.log.info('Assembling VM')
        if self.params.drive_format:
            self.log.info('Drive format: %s', self.params.drive_format)
        if self.params.nic_model:
            self.log.info('NIC model: %s', self.params.nic_model)
        if self.params.enable_msx_vectors == 'yes':
72
            self.log.info('Enabling msx vectors')
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

    def action(self):
        self.log.info('Executing synctest...')
        self.log.info('synctest --timeout %s --tries %s',
                      self.params.sync_timeout,
                      self.params.sync_tries)

        self.log.info('Executing ping test...')
        cmdline = 'ping --timeout %s --tries %s' % (self.params.ping_timeout,
                                                    self.params.ping_tries)

        if self.params.ping_flags:
            cmdline += ' %s' % self.params.ping_flags

        self.log.info(cmdline)


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