예제 #1
0
def print_failed(data, aname, area, whitelist, area2='cloudhwname'):
    if not data:
        return
    agg_data = aggregate.flat(data, area)
    for name, data in agg_data.items():
        print('%s %s' % (aname, name[0]))
        for test in data:
            if test.has_key('test'):
                if test['test']['result'] != 'passed':
                    if test['test']['name'] not in whitelist:
                        if test['test']['result'] == 'skip':
                            print(
                                '!  Skipped test %s - most likely not applicable for this configuration.'
                                % test['test']['name'])
                        else:
                            print('   Failed test %s (%s)' %
                                  (test['test']['name'], test[area2]))
            else:
                if test['stage_result'] == 'skip':
                    print(
                        '!! Skipped - most likely unsupported instance type in region. (%s)'
                        % test[area2])
                elif test['stage_result'] != 'passed':
                    print('!! Failed stage %s (%s)' %
                          (test['stage_name'], test[area2]))
예제 #2
0
파일: summary_main.py 프로젝트: alexxa/dva
def print_failed_html(data, aname, area, whitelist,area2='cloudhwname'):
    agg_data = aggregate.flat(data, area)
    table_data=[]
    for name,data in agg_data.items():
        for test in data:
            pass
    html_output = html.table(table_data)
    print html_output
예제 #3
0
def print_failed(data, aname, area, whitelist):
    agg_data = aggregate.flat(data, area)
    for name, data in agg_data.items():
        print("%s %s" % (aname, name[0]))
        for test in data:
            if test.has_key("test"):
                if test["test"]["result"] != "passed":
                    if test["test"]["name"] not in whitelist:
                        print("   Failed test %s" % test["test"]["name"])
예제 #4
0
def print_failed(data, aname, area, whitelist):
    agg_data = aggregate.flat(data, area)
    for name, data in agg_data.items():
        print('%s %s' % (aname, name[0]))
        for test in data:
            if test.has_key('test'):
                if test['test']['result'] != 'passed':
                    if test['test']['name'] not in whitelist:
                        print('   Failed test %s' % test['test']['name'])
예제 #5
0
파일: summary_main.py 프로젝트: alexxa/dva
def print_failed(data, aname, area, whitelist,area2='cloudhwname'):
    agg_data = aggregate.flat(data, area)
    for name,data in agg_data.items():
        print('%s %s' % (aname, name[0]))
        for test in data:
            if test.has_key('test'):
                if test['test']['result'] != 'passed':
                    if test['test']['name'] not in whitelist:
                        print('   Failed test %s (%s)' % (test['test']['name'],test[area2]))
            else:
                if test['stage_result'] != 'passed':
                    print('!! Failed stage %s (%s)' % (test['stage_name'],test[area2]))
예제 #6
0
def print_xunit(data, aname, area):
    print('<?xml version="1.0" encoding="UTF-8"?><testsuites>')
    if not data:
        print('</testsuites>')
        return
    agg_data = aggregate.flat(data, area)
    error = {}
    fail = {}
    skip = {}
    total = {}
    testcase = {}
    testsuite = {}
    for name,data in agg_data.items():
        for test in data:
            classname = '%s-%s.%s' % (test['platform'],test['arch'],name[0])
            ami = name[0]
            if not (ami in error): error[ami] = 0
            if not (ami in fail): fail[ami] = 0
            if not (ami in total): total[ami] = 0
            if not (ami in skip): skip[ami] = 0
            total[ami] = total[ami]+1
            if test.has_key('test'):
                runtime = round(test['test']['end_time'] - test['test']['start_time'])
                try:
                    testcase[ami] = testcase[ami]+'<testcase classname="%s" name="%s.%s.%s" time="%d">' % (classname,test['cloudhwname'],test['test']['stage'],test['test']['name'],runtime)
                except KeyError:
                    testcase[ami] = '<testcase classname="%s" name="%s.%s.%s" time="%d">' % (classname,test['cloudhwname'],test['test']['stage'],test['test']['name'],runtime)
                if test['test']['result'] != 'passed':
                    fail[ami] = fail[ami]+1
                    testcase[ami] = testcase[ami]+'<error type="%s"><![CDATA[%s]]></error>' % (test['test']['result'],test['test']['log'])
            else:
                try:
                    testcase[ami] = testcase[ami]+'<testcase classname="%s" name="%s.%s">' % (classname,test['cloudhwname'],test['stage_name'])
                except KeyError:
                    testcase[ami] = '<testcase classname="%s" name="%s.%s">' % (classname,test['cloudhwname'],test['stage_name'])
                if test['stage_result'] != 'passed':
                    if test['stage_result'] == 'skip':
                        skip[ami] = skip[ami]+1
                    else:
                        error[ami] = error[ami]+1
                    testcase[ami] = testcase[ami]+'<error type="%s"><![CDATA[%s]]></error>' % (test['stage_result'],test['stage_exception'])
            testcase[ami] = testcase[ami]+'</testcase>\n'
        try:
            testsuite[ami] = testsuite[ami]+'<testsuite name="%s" tests="%d" errors="%d" failures="%d" skip="%d">\n' % (classname,total[ami],error[ami],fail[ami],skip[ami])
        except KeyError:
            testsuite[ami] = '<testsuite name="%s" tests="%d" errors="%d" failures="%d" skip="%d">\n' % (classname,total[ami],error[ami],fail[ami],skip[ami])
        testcase[ami] = testcase[ami]+'</testsuite>'

    for key in testsuite:
        print testsuite[key]
        print testcase[key]
    print('</testsuites>')
예제 #7
0
파일: bug_main.py 프로젝트: RedHatQE/dva
def main(
    config,
    istream,
    ostream,
    test_whitelist,
    user=None,
    password=None,
    url=DEFAULT_URL,
    component=DEFAULT_COMPONENT,
    bugzilla_product=DEFAULT_PRODUCT,
    verbose=False,
    pool_size=128,
    debug_mode=False,
):
    user, password = bugzilla_credentials(config)
    logger.debug("got credentials: %s, %s", user, password)
    data = load_yaml(istream)
    whitelist = [str(item) for item in test_whitelist[0].split(",")]
    agg_data = aggregate.flat(data, "region", "platform", "product", "version", "arch", "itype", "ami")
    pool = Pool(size=pool_size)
    if debug_mode:
        # There will be enhancement to have for each ami output in the file
        statuses = pool.map(
            lambda (key, data): process_ami_record_debug(
                key,
                data,
                whitelist,
                user=user,
                password=password,
                url=url,
                component=component,
                bugzilla_product=bugzilla_product,
            ),
            agg_data.items(),
        )
    else:
        statuses = pool.map(
            lambda (key, data): process_ami_record(
                key,
                data,
                whitelist,
                user=user,
                password=password,
                url=url,
                component=component,
                bugzilla_product=bugzilla_product,
            ),
            agg_data.items(),
        )
    for bug, ami, status in statuses:
        save_result(ostream, dict(bug=bug, id=ami, status=status))
    return all([status in (RESULT_PASSED, RESULT_WAIVED) for _, status, _ in statuses]) and 0 or 1
예제 #8
0
파일: bug_main.py 프로젝트: liangxiao1/dva
def main(config,
         istream,
         ostream,
         test_whitelist,
         user=None,
         password=None,
         url=DEFAULT_URL,
         component=DEFAULT_COMPONENT,
         bugzilla_product=DEFAULT_PRODUCT,
         verbose=False,
         pool_size=128,
         debug_mode=False):
    user, password = bugzilla_credentials(config)
    logger.debug('got credentials: %s, %s', user, password)
    data = load_yaml(istream)
    whitelist = [str(item) for item in test_whitelist[0].split(',')]
    agg_data = aggregate.flat(data, 'region', 'platform', 'product', 'version',
                              'arch', 'itype', 'ami')
    pool = Pool(size=pool_size)
    if debug_mode:
        #There will be enhancement to have for each ami output in the file
        statuses = pool.map(
            lambda (key, data): process_ami_record_debug(key,
                                                         data,
                                                         whitelist,
                                                         user=user,
                                                         password=password,
                                                         url=url,
                                                         component=component,
                                                         bugzilla_product=
                                                         bugzilla_product),
            agg_data.items())
    else:
        statuses = pool.map(
            lambda
            (key, data): process_ami_record(key,
                                            data,
                                            whitelist,
                                            user=user,
                                            password=password,
                                            url=url,
                                            component=component,
                                            bugzilla_product=bugzilla_product),
            agg_data.items())
    for bug, ami, status in statuses:
        save_result(ostream, dict(bug=bug, id=ami, status=status))
    return all([
        status in (RESULT_PASSED, RESULT_WAIVED) for _, status, _ in statuses
    ]) and 0 or 1
예제 #9
0
def print_failed(data, aname, area, whitelist,area2='cloudhwname'):
    if not data:
        return
    agg_data = aggregate.flat(data, area)
    for name,data in agg_data.items():
        print('%s %s' % (aname, name[0]))
        for test in data:
            if test.has_key('test'):
                if test['test']['result'] != 'passed':
                    if test['test']['name'] not in whitelist:
                        if test['test']['result'] == 'skip':
                            print('!  Skipped test %s - most likely not applicable for this configuration.' % test['test']['name'])
                        else:
                            print('   Failed test %s (%s)' % (test['test']['name'],test[area2]))
            else:
                if test['stage_result'] == 'skip':
                    print('!! Skipped - most likely unsupported instance type in region. (%s)' % test[area2])
                elif test['stage_result'] != 'passed':
                    print('!! Failed stage %s (%s)' % (test['stage_name'],test[area2]))
예제 #10
0
def print_xunit(data, aname, area):
    print('<?xml version="1.0" encoding="UTF-8"?><testsuites>')
    if not data:
        print('</testsuites>')
        return
    agg_data = aggregate.flat(data, area)
    error = {}
    fail = {}
    skip = {}
    total = {}
    testcase = {}
    testsuite = {}
    for name, data in agg_data.items():
        for test in data:
            classname = '%s-%s.%s' % (test['platform'], test['arch'], name[0])
            ami = name[0]
            if not (ami in error): error[ami] = 0
            if not (ami in fail): fail[ami] = 0
            if not (ami in total): total[ami] = 0
            if not (ami in skip): skip[ami] = 0
            total[ami] = total[ami] + 1
            if test.has_key('test'):
                runtime = round(test['test']['end_time'] -
                                test['test']['start_time'])
                try:
                    testcase[ami] = testcase[
                        ami] + '<testcase classname="%s" name="%s.%s.%s" time="%d">' % (
                            classname, test['cloudhwname'], test['test']
                            ['stage'], test['test']['name'], runtime)
                except KeyError:
                    testcase[
                        ami] = '<testcase classname="%s" name="%s.%s.%s" time="%d">' % (
                            classname, test['cloudhwname'],
                            test['test']['stage'], test['test']['name'],
                            runtime)
                if test['test']['result'] != 'passed':
                    fail[ami] = fail[ami] + 1
                    testcase[ami] = testcase[
                        ami] + '<error type="%s"><![CDATA[%s]]></error>' % (
                            test['test']['result'], test['test']['log'])
            else:
                try:
                    testcase[ami] = testcase[
                        ami] + '<testcase classname="%s" name="%s.%s">' % (
                            classname, test['cloudhwname'], test['stage_name'])
                except KeyError:
                    testcase[
                        ami] = '<testcase classname="%s" name="%s.%s">' % (
                            classname, test['cloudhwname'], test['stage_name'])
                if test['stage_result'] != 'passed':
                    if test['stage_result'] == 'skip':
                        skip[ami] = skip[ami] + 1
                    else:
                        error[ami] = error[ami] + 1
                    testcase[ami] = testcase[
                        ami] + '<error type="%s"><![CDATA[%s]]></error>' % (
                            test['stage_result'], test['stage_exception'])
            testcase[ami] = testcase[ami] + '</testcase>\n'
        try:
            testsuite[ami] = testsuite[
                ami] + '<testsuite name="%s" tests="%d" errors="%d" failures="%d" skip="%d">\n' % (
                    classname, total[ami], error[ami], fail[ami], skip[ami])
        except KeyError:
            testsuite[
                ami] = '<testsuite name="%s" tests="%d" errors="%d" failures="%d" skip="%d">\n' % (
                    classname, total[ami], error[ami], fail[ami], skip[ami])
        testcase[ami] = testcase[ami] + '</testsuite>'

    for key in testsuite:
        print testsuite[key]
        print testcase[key]
    print('</testsuites>')