Esempio n. 1
0
def default_device_tests(runner, devices, settings):
    device_failed = False

    for device in devices:
        try:
            prnt.p_out('Executing default tests for device: %d' % device)

            if settings.dev_state:
                # make sure the device is online with postcode FF
                runner.run(StateTest(device), device)

            if settings.dev_rasdaemon:
                # make sure ras daemon is running on device
                runner.run(RasTest(device), device)

            if settings.flash_ver:
                # make sure flash version is correct
                runner.run(FlashVersionTest(device), device)

            if settings.smc_ver:
                # make sure smc fw version is correct
                runner.run(ctests.SmcFirmwareTest(device), device)

        # MicDevice objects can throw RuntimeError and cause premature termination
        except (ex.FailedTestException, RuntimeError):
            # so we continue testing other devices if present
            device_failed = True

    if device_failed:
        raise ex.FailedTestException('A device test failed')
Esempio n. 2
0
def optional_host_tests(runner, settings):
    if settings.driver_ver:
        prnt.p_out('Executing optional tests for host')

    if settings.driver_ver:
        # check the loaded driver version
        runner.run(DriverVersionTest())
Esempio n. 3
0
def default_host_tests(runner, settings):
    prnt.p_out('Executing default tests for host')

    if settings.pci_devices:
        # make sure we have devices attached to the host
        runner.run(PciDevicesTest())

    if settings.driver_loaded:
        # make sure mic driver is loaded
        runner.run(MicDriverTest())

    if settings.driver_devices:
        # make sure driver detected the same num of devices as the
        # pci buses did
        runner.run(WmiDevicesTest())
Esempio n. 4
0
def optional_device_tests(runner, devices, settings):
    device_failed = False

    for device in devices:
        try:
            if settings.ping or settings.ssh:
                prnt.p_out('Executing optional tests for device: %d' % device)

            if settings.ping:
                runner.run(PingTest(device), device)

            if settings.ssh:
                runner.run(SshTest(device), device)

        # MicDevice objects can throw RuntimeError and cause premature termination
        except (ex.FailedTestException, RuntimeError):
            # so we continue testing other devices if present
            device_failed = True

    if device_failed:
        raise ex.FailedTestException('An optional device test failed')
Esempio n. 5
0
def main():
    try:
        banner = "MicCheck {0}\nCopyright (c) 2015, Intel Corporation.\n"
        prnt.p_out(banner.format(_miccheck.__version__))
        settings, args = parse_command_line(sys.argv[1:])  # parse command line

        test_runner = testrunner.TestRunner()
        pltfm.default_host_tests(test_runner, settings)
        pltfm.optional_host_tests(test_runner, settings)
        pltfm.default_device_tests(test_runner, settings.device, settings)
        pltfm.optional_device_tests(test_runner, settings.device, settings)

        prnt.p_out("\nStatus: OK")
        return 0
    except Exception, excp:
        prnt.p_out("\nStatus: FAIL")
        prnt.p_err("Failure: " + str(excp))
        return 1
Esempio n. 6
0
# no license, express or implied, by estoppel or otherwise, to any
# intellectual property rights is granted herein.
from _miccheck.common import exceptions as ex
from _miccheck.common import printing as prnt 

class TestRunner:
    def __init__(self):
        self._num_tests_run = 0

    def run(self, test, device=-1):
        try:
            # if device == -1, it is a host test, so we don't print mic id
            if device != -1:
                test_output = ('  Test %d (mic%d): %s' % (self._num_tests_run,
                                                  device, test.msg_executing()))
            else:
                test_output = ('  Test %d: %s' % (self._num_tests_run,
                                              test.msg_executing()))

            test.run()
            test_output += ' ... pass'
        except ex.FailedTestException, excp:
            test_output += ' ... fail\n    %s' % str(excp)
            raise
        except Exception, excp:
            test_output += ' ... fail\n    %s' % str(excp)
            raise
        finally:
            self._num_tests_run += 1
            prnt.p_out(test_output)