Пример #1
0
def get_json_from_test_run(tar_filename):
    testconf_path = extract_file_from_tar(tar_filename, 'test_run.conf',
                                          os.getcwd(), fullpathknown=False)
    fh = open(testconf_path, 'r')
    test_conf_data = fh.read()
    fh.close()

    test_conf = xml.dom.minidom.parseString(test_conf_data)
    json = xmltojson.ack_xml_to_json(test_conf_data)
    return json
Пример #2
0
def get_json_from_test_run(tar_filename):
    testconf_path = extract_file_from_tar(tar_filename,
                                          'test_run.conf',
                                          os.getcwd(),
                                          fullpathknown=False)
    fh = open(testconf_path, 'r')
    test_conf_data = fh.read()
    fh.close()

    test_conf = xml.dom.minidom.parseString(test_conf_data)
    json = xmltojson.ack_xml_to_json(test_conf_data)
    return json
Пример #3
0
def do_parse(options):
    """do_parse function"""
    tarfilename = options.filename  # downloadACK(runjob, runmachine)
    xenrtmachine = None  # runmachine
    global SERVER_DICT
    SERVER_DICT = result_parser(tarfilename, os.getcwd())
    # display_results(dict, keys)
    display_results(SERVER_DICT)

    (count, test_conf) = count_test_failures(tarfilename)
    testconf_path = extract_file_from_tar(tarfilename, 'test_run.conf',
                                          os.getcwd(), fullpathknown=False)
    fh = open(testconf_path, 'r')
    test_conf_data = fh.read()
    fh.close()

    test_conf = xml.dom.minidom.parseString(test_conf_data)

    if options.post:
        json = xmltojson.ack_xml_to_json(test_conf_data)
        print json

    # fail product lists
    if count > 0:
        exception_list = []
        for exception in test_conf.getElementsByTagName('exception'):
            if exception.firstChild.nodeValue not in exception_list:
                exception_list.append(exception.firstChild.nodeValue)
        # maintain MACHINE_DICT only for xenRT machines
        if xenrtmachine:
            FAILED_DICT[xenrtmachine] = exception_list

            if SERVER_DICT['product'] not in MACHINE_DICT['pass']:
                if SERVER_DICT['product'] not in MACHINE_DICT['fail']:
                    MACHINE_DICT['fail'].append(SERVER_DICT['product'])
            print "*******%s tests FAILED for %s *********" % (
                count,
                xenrtmachine,
                )
        else:
            FAILED_DICT[SERVER_DICT['product']] = exception_list
    else:
        # added check here
        if xenrtmachine:  # and SERVER_DICT['product'] not in passed_list:
            # remove duplicacy
            if SERVER_DICT['product'] not in MACHINE_DICT['pass']:
                MACHINE_DICT['pass'].append(SERVER_DICT['product'])
    if xenrtmachine:
        print "#"*30
        print "NICS LISTING HERE"
        display_results(NICS_DICT)
        print "NICS LISTING OVER"
        print "#"*30
        print "HBAs HERE"
        display_results(HBAS_DICT)
        print "HBAs listing over"
        print "#"*30
        print "MY PASSED PRODUCTS"
        pprint.pprint(MACHINE_DICT['pass'])
        print "#"*30
        print "MY FAIL PRODUCTS"
        pprint.pprint(MACHINE_DICT['fail'])
        print "#"*30, "FAILED_DICT below"
    display_results(FAILED_DICT)
Пример #4
0
def do_parse(options):
    """do_parse function"""
    tarfilename = options.filename  # downloadACK(runjob, runmachine)
    xenrtmachine = None  # runmachine
    global SERVER_DICT
    SERVER_DICT = result_parser(tarfilename, os.getcwd())
    # display_results(dict, keys)
    display_results(SERVER_DICT)

    (count, test_conf) = count_test_failures(tarfilename)
    testconf_path = extract_file_from_tar(tarfilename,
                                          'test_run.conf',
                                          os.getcwd(),
                                          fullpathknown=False)
    fh = open(testconf_path, 'r')
    test_conf_data = fh.read()
    fh.close()

    test_conf = xml.dom.minidom.parseString(test_conf_data)

    if options.post:
        json = xmltojson.ack_xml_to_json(test_conf_data)
        print json

    # fail product lists
    if count > 0:
        exception_list = []
        for exception in test_conf.getElementsByTagName('exception'):
            if exception.firstChild.nodeValue not in exception_list:
                exception_list.append(exception.firstChild.nodeValue)
        # maintain MACHINE_DICT only for xenRT machines
        if xenrtmachine:
            FAILED_DICT[xenrtmachine] = exception_list

            if SERVER_DICT['product'] not in MACHINE_DICT['pass']:
                if SERVER_DICT['product'] not in MACHINE_DICT['fail']:
                    MACHINE_DICT['fail'].append(SERVER_DICT['product'])
            print "*******%s tests FAILED for %s *********" % (
                count,
                xenrtmachine,
            )
        else:
            FAILED_DICT[SERVER_DICT['product']] = exception_list
    else:
        # added check here
        if xenrtmachine:  # and SERVER_DICT['product'] not in passed_list:
            # remove duplicacy
            if SERVER_DICT['product'] not in MACHINE_DICT['pass']:
                MACHINE_DICT['pass'].append(SERVER_DICT['product'])
    if xenrtmachine:
        print "#" * 30
        print "NICS LISTING HERE"
        display_results(NICS_DICT)
        print "NICS LISTING OVER"
        print "#" * 30
        print "HBAs HERE"
        display_results(HBAS_DICT)
        print "HBAs listing over"
        print "#" * 30
        print "MY PASSED PRODUCTS"
        pprint.pprint(MACHINE_DICT['pass'])
        print "#" * 30
        print "MY FAIL PRODUCTS"
        pprint.pprint(MACHINE_DICT['fail'])
        print "#" * 30, "FAILED_DICT below"
    display_results(FAILED_DICT)