Exemplo n.º 1
0
def verifyCI():
    if args.ci and args.ci is not 'teamcity':
        print 'Unknown continuous integration ' + args.ci + '. Supported CI programs: teamcity'
    if args.ci and not args.citest:
        print 'The name of the test was not specified in \'citest\''

    if args.ci is not 'teamcity':
        TeamCity.tcDisableOutput()
Exemplo n.º 2
0
def verifyCI():
    if args.ci and args.ci is not 'teamcity':
        print 'Unknown continuous integration ' + args.ci + '. Supported CI programs: teamcity'
    if args.ci and not args.citest:
        print 'The name of the test was not specified in \'citest\''

    if args.ci is not 'teamcity':
        TeamCity.tcDisableOutput()
Exemplo n.º 3
0
def buildSim():
    if not os.path.exists(make_file):
        print 'Unable to find make file ' + make_file
        sys.exit(1)
    project = os.path.basename(os.path.abspath(os.environ['NF_DESIGN_DIR']))
    subprocess.call(['cp', make_file, proj_test_dir + '/Makefile'])

    print '=== Work directory is ' + proj_test_dir

    if args.dump:
        dumpfile = 'dump.v'
    else:
        dumpfile = ''
    if args.isim:
        make_opt = args.make_opt + ' isim_top'
    elif args.vcs:
        make_opt = args.make_opt + ' vcs_top'
    else:
        make_opt = args.make_opt + ' vsim_top'

    cmd = "make -f Makefile DUMP_CTRL=" + dumpfile + " SIM_OPT=" + sim_opt + " " + make_opt
    os.chdir(proj_test_dir)
    subprocess.call(['rm', '-rf', 'my_sim'])

    print '=== Calling make to build simulation binary with'
    print cmd
    print ''

    # Invoke make with through the appropriate ci program
    if TeamCity.tcIsEnabled():
        pass  #if tcRunMake('', args.citest + tcGetTestSeparator() + 'make', '.', cmd) is not 0:
        #    sys.exit(1)
    else:
        status = subprocess.call(cmd, shell=True)
        if status > 0:
            print "Error: "
            sys.exit(1)

    print '=== Simulation compiled.'
Exemplo n.º 4
0
def buildSim():
    if not os.path.exists(make_file):
        print 'Unable to find make file ' + make_file
        sys.exit(1)
    project = os.path.basename(os.path.abspath(os.environ['NF_DESIGN_DIR']))
    subprocess.call(['cp', make_file, proj_test_dir + '/Makefile'])

    print '=== Work directory is ' + proj_test_dir

    if args.dump:
        dumpfile = 'dump.v'
    else:
        dumpfile = ''
    if args.isim:
        make_opt = args.make_opt + ' isim_top'
    elif args.vcs:
        make_opt = args.make_opt + ' vcs_top'
    else:
        make_opt = args.make_opt + ' vsim_top'

    cmd = "make -f Makefile DUMP_CTRL=" + dumpfile + " SIM_OPT=" + sim_opt + " " + make_opt
    os.chdir(proj_test_dir)
    subprocess.call(['rm', '-rf', 'my_sim'])

    print '=== Calling make to build simulation binary with'
    print cmd
    print ''

    # Invoke make with through the appropriate ci program
    if TeamCity.tcIsEnabled():
        pass#if tcRunMake('', args.citest + tcGetTestSeparator() + 'make', '.', cmd) is not 0:
        #    sys.exit(1)
    else:
        status = subprocess.call(cmd, shell=True)
        if status > 0:
            print "Error: "
            sys.exit(1)

    print '=== Simulation compiled.'
Exemplo n.º 5
0
            mapfile = open(args.map)
            mapfile.close()
        except IOError,  exc:
            print 'Error opening mapfile ' + args.map
            print exc.strerror
            sys.exit(1)

    identifyTests()

    #run regression tests on each project one-by-one
    results = []
    testResults = {}
    passed = True
    commonPass = True

    test = args.citest + TeamCity.tcGetTestSeparator() + 'global.setup'
    if not args.quiet:
        print '   Running global setup... ',
    TeamCity.tcTestStarted(test)
    (gsResult, output) = runGlobalSetup(project)
    if not gsResult:
        passed = False

        # Store the test results for later
        testResults[GLOBAL_SETUP] = gsResult
        test_result = ( GLOBAL_SETUP, gsResult, output)
        results.append(test_result)

    # run checks
    printScriptOutput(gsResult, output)
    if not gsResult:
Exemplo n.º 6
0
def run_sim_test():
    verifyCI()
    prepareWorkDir()
    if not args.no_compile:
        buildSim()
    if args.compile_only:
        sys.exit(0)

    #set up test dirs
    passed = []
    failed = []
    gui = []
    for td in tests:
        prepareTestWorkDir(td)

        dst_dir = proj_test_dir + '/' + td
        #if os.path.exists(dst_dir + '/' + run):
        #    which_run = './' + run
        #else:
        #    which_run = global_run
        which_run = global_run
        cmd = [which_run, '--sim']
        os.chdir(dst_dir)
        if args.isim:
            cmd.append('isim')
        elif args.vcs:
            cmd.append('vcs')
        else:
            cmd.append('vsim')
        if args.dump:
            cmd.append('--dump')
        if args.gui:
            cmd.append('--gui')
        if args.ci:
            cmd.append('--ci')
            cmd.append(args.ci)
            cmd.append('--citest')
            cmd.append(args.citest)

        #run tests
        print '=== Running test ' + dst_dir + ' ...',
        print 'using cmd', cmd
        status = subprocess.call(cmd)
        if status == 99:
            print "Test " + td + " ran in GUI mode.  Unable to identify pass/failure"
            gui.append(td)
        elif status > 0:
            print 'Error: test ' + td + ' failed!'
            failed.append(td)
        else:
            print 'Test ' + td + ' passed!'
            passed.append(td)

    #print results
    summary = '------------SUMMARY---------------\n'
    summary += 'PASSING TESTS: \n'
    for test in passed:
        summary = summary + test + '\n'
    summary += 'FAILING TESTS: \n'
    for test in failed:
        summary = summary + test + '\n'
    summary += 'TOTAL: ' + str(
        len(tests)) + ' PASS: '******' FAIL: ' + str(
            len(failed)) + ' GUI: ' + str(len(gui)) + '\n'
    print summary

    if len(failed) >= 0:  # check this
        TeamCity.tcTestFailed(args.citest, 'One or more simulations failed',
                              summary)

    if failed:
        f = open(os.environ['NF_DESIGN_DIR'] + '/' + 'FAILED_TESTS', 'w')
        for test in failed:
            f.write(test + '\n')
        f.close()
    sys.exit(len(failed))
Exemplo n.º 7
0
            mapfile = open(args.map)
            mapfile.close()
        except IOError, exc:
            print 'Error opening mapfile ' + args.map
            print exc.strerror
            sys.exit(1)

    identifyTests()

    #run regression tests on each project one-by-one
    results = []
    testResults = {}
    passed = True
    commonPass = True

    test = args.citest + TeamCity.tcGetTestSeparator() + 'global.setup'
    if not args.quiet:
        print '   Running global setup... ',
    TeamCity.tcTestStarted(test)
    (gsResult, output) = runGlobalSetup(project)
    if not gsResult:
        passed = False

        # Store the test results for later
        testResults[GLOBAL_SETUP] = gsResult
        test_result = (GLOBAL_SETUP, gsResult, output)
        results.append(test_result)

    # run checks
    printScriptOutput(gsResult, output)
    if not gsResult:
Exemplo n.º 8
0
def run_sim_test():
    verifyCI()
    prepareWorkDir()
    if not args.no_compile:
        buildSim()
    if args.compile_only:
        sys.exit(0)

    #set up test dirs
    passed = []; failed = []; gui = []
    for td in tests:
        prepareTestWorkDir(td)

        dst_dir = proj_test_dir + '/' + td
        #if os.path.exists(dst_dir + '/' + run):
        #    which_run = './' + run
        #else:
        #    which_run = global_run
        which_run = global_run
        cmd = [which_run, '--sim']
        os.chdir(dst_dir)
        if args.isim:
            cmd.append('isim')
        elif args.vcs:
            cmd.append('vcs')
        else:
            cmd.append('vsim')
        if args.dump:
            cmd.append('--dump')
        if args.gui:
            cmd.append('--gui')
        if args.ci:
            cmd.append('--ci')
            cmd.append(args.ci)
            cmd.append('--citest')
            cmd.append(args.citest)

        #run tests
        print '=== Running test ' + dst_dir + ' ...',
        print 'using cmd', cmd
        status = subprocess.call(cmd)
        if status == 99:
            print "Test " + td + " ran in GUI mode.  Unable to identify pass/failure"
            gui.append(td)
        elif status > 0:
            print 'Error: test ' + td + ' failed!'
            failed.append(td)
        else:
            print 'Test ' + td + ' passed!'
            passed.append(td)

    #print results
    summary = '------------SUMMARY---------------\n'
    summary += 'PASSING TESTS: \n'
    for test in passed:
        summary = summary + test + '\n'
    summary += 'FAILING TESTS: \n'
    for test in failed:
        summary = summary + test + '\n'
    summary += 'TOTAL: ' + str(len(tests)) + ' PASS: '******' FAIL: ' + str(len(failed)) + ' GUI: ' + str(len(gui)) + '\n'
    print summary

    if len(failed) >= 0: # check this
        TeamCity.tcTestFailed(args.citest, 'One or more simulations failed', summary)

    if failed:
        f = open(os.environ['NF_DESIGN_DIR'] + '/' + 'FAILED_TESTS', 'w')
        for test in failed:
            f.write(test + '\n')
        f.close()
    sys.exit(len(failed))