[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [test-API PATCH 0/5] add TESTCASE_check optional function support



In some cases, we need to check if the testing environment is satisfied
to run a certain testcase. The testcase only will be executed If some
specific hardware is present on box. The patches add a optional check
function support.

For example: a testcase named testa.py with testa_check() defined in
this file. The framework will run test_check(params) first, return 0
means pass, 1 means failure. If the check function failed. the testa(params)
will not be run. "Skip" is marked in output.

# testa.py
required_params = ()
optional_params = ('options')

def testa_check(params):
    logger = params['logger']
    logger.info("I am from testa_check")
    return 1

def testa(params):
    logger = params['logger']
    logger.info("I am from testa")
    return 1


The Output:
Checking Testing Environment... 
    Linux localhost.localdomain 3.2.5-3.fc16.x86_64 #1 SMP Thu Feb 9 01:24:38 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
    Virsh command line tool of libvirt: 0.9.10
    libvirtd (libvirt) 0.9.10
    Default URI: qemu:///system
    QEMU emulator version 0.15.0 (qemu-kvm-0.15.0), Copyright (c) 2003-2008 Fabrice Bellard

Start Testing:
    Case Count: 1
    Log File: log/20120416142755/libvirt_test001

    test:testa
            14:27:56|INFO  |I am from testa_check
            14:27:56|INFO  |Failed to meet testing requirement
            Result: Skip


Summary:
    Total:1 [Pass:0 Fail:0 Skip:1]

The testcase.conf file:
test:testa
    options
        value1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]