Ejemplo n.º 1
0
def nftest_finish(total_errors = 0):
    nftest_barrier()

    # write out the sent/expected pcaps for easy viewing
    if not os.path.isdir("./source_pcaps"):
        os.mkdir("./source_pcaps")
    for iface in ifaceArray:
        if len(sent_phy[iface]) > 0:
            scapy.wrpcap("./source_pcaps/%s_sent_phy.pcap"%iface,
                         sent_phy[iface])
        if len(sent_dma[iface]) > 0:
            scapy.wrpcap("./source_pcaps/%s_sent_dma.pcap"%iface,
                         sent_dma[iface])
        if len(expected_phy[iface]) > 0:
            scapy.wrpcap("./source_pcaps/%s_expected_phy.pcap"%iface,
                         expected_phy[iface])
        if len(expected_dma[iface]) > 0:
            scapy.wrpcap("./source_pcaps/%s_expected_dma.pcap"%iface,
                         expected_dma[iface])

    if sim:
        simLib.close()
        return 0
    else:
        total_errors += hwPktLib.finish()
        if total_errors == 0:
            print 'SUCCESS!'
            sys.exit(0)
        else:
            print 'FAIL: ' + str(total_errors) + ' errors'
            sys.exit(1)
Ejemplo n.º 2
0
def nftest_finish(total_errors = 0):
    nftest_barrier()

    # write out the sent/expected pcaps for easy viewing
    if not os.path.isdir("./source_pcaps"):
        os.mkdir("./source_pcaps")
    for iface in ifaceArray:
        if len(sent_phy[iface]) > 0:
            scapy.wrpcap("./source_pcaps/%s_sent_phy.pcap"%iface,
                         sent_phy[iface])
        if len(sent_dma[iface]) > 0:
            scapy.wrpcap("./source_pcaps/%s_sent_dma.pcap"%iface,
                         sent_dma[iface])
        if len(expected_phy[iface]) > 0:
            scapy.wrpcap("./source_pcaps/%s_expected_phy.pcap"%iface,
                         expected_phy[iface])
        if len(expected_dma[iface]) > 0:
            scapy.wrpcap("./source_pcaps/%s_expected_dma.pcap"%iface,
                         expected_dma[iface])

    if sim:
        simLib.close()
        return 0
    else:
        total_errors += hwPktLib.finish()
        if total_errors == 0:
            print 'SUCCESS!'
            sys.exit(0)
        else:
            print 'FAIL: ' + str(total_errors) + ' errors'
            sys.exit(1)
Ejemplo n.º 3
0
def nftest_finish(reg_list):
    total_errors = 0
    nftest_barrier()
    reg_errors = 0
    reg_status = 0
    

    if sim:
        simLib.close()
        return 0
    else:

	# write out the sent/expected pcaps for easy viewing
	if not os.path.isdir("./source_pcaps"):
	    os.mkdir("./source_pcaps")
	for iface in ifaceArray:
	    if len(sent_phy[iface]) > 0:
		scapy.wrpcap("./source_pcaps/%s_sent_phy.pcap"%iface,
		                 sent_phy[iface])
	    if len(sent_dma[iface]) > 0:
		scapy.wrpcap("./source_pcaps/%s_sent_dma.pcap"%iface,
		                 sent_dma[iface])
	    if len(expected_phy[iface]) > 0:
		scapy.wrpcap("./source_pcaps/%s_expected_phy.pcap"%iface,
		                 expected_phy[iface])
	    if len(expected_dma[iface]) > 0:
		scapy.wrpcap("./source_pcaps/%s_expected_dma.pcap"%iface,
		                 expected_dma[iface])

        total_errors += hwPktLib.finish()
	for i in range(len(reg_list)):
		if(reg_list[i]==0):
			reg_errors += 1	
	reg_status = reg_read_result(reg_list)
	print'\n'+'*****************'
        print'HW Test results'
	print'*****************'
        if total_errors == 0 and reg_status == 1:
            print 'Test status : SUCCESS!'
            sys.exit(0)
        else:
            #print 'FAIL: ' + str(total_errors) + ' errors'
	    print '\n'+'Test status : FAIL'
 	    print 'packet_missed errors : '+str(total_errors)
	    print 'register_read errors : '+str(reg_errors) 	 	
            sys.exit(1)