예제 #1
0
      # add arguments to lines
      line = line[:-3] + ', num_args, args);'
      
      # replace lines and defs
      RunnerTemplate = RunnerTemplate.replace("{$SUITE_NAME$}", line.strip())
      RunnerTemplate = RunnerTemplate.replace("SUITE_ADD_TEST", "SUITE_ADD_TEST_ARGS")
      RunnerTemplate = RunnerTemplate.replace("(suite", "(Suite")
      RunnerTemplate = RunnerTemplate.replace("{$SUITE_DEF$}", "extern void " + func + "(CuTest*);")
      
      out.write(RunnerTemplate)
      out.close()
      
      ##############
      # Swap Mains #
      ##############   
      log = swapmain.swap(ProgramFile, TestRunnerCFile)

      # Strip newlines and leftover extern voids. 
      # they add extra lines to the file which will break the metrics
      temp_file = ''
      with open(ProgramFile,'r') as f:
         temp_file = f.read().strip('\n')
      temp_file = temp_file.replace(previous_func, '')
      with open(ProgramFile,'w') as f:
         f.write(temp_file)
      
      # remember the previous function so we can strip out the extern void
      previous_func = 'extern void {0}(CuTest*);\n'.format(func)
      
      #####################
      # Load Crest Inputs #
예제 #2
0
    print "populating environment..."
    for src in os.listdir(working_path):
        if src != debugging_dir and src != backup_dir and src != resources_dir and src != me:
            copy_source = "cp -r {0} {1}/.".format(src, debugging_path)
            os.system(copy_source)
    copy_resources = "cp -r {0} {2} ; cp {1} {2}".format(tests_path, crest_h_path, debugging_path)
    os.system(copy_resources)

    # change dir
    os.chdir(debugging_path)

    ################################
    # Insert single test into main #
    ################################
    if run_suite == False:
        log = swapmain.swap(main, single_test_main_path)
        log_path = "{0}/log.txt".format(resources_path)
        if os.path.exists(log_path):
            with open(log_path, "a") as f:
                f.write(log)
        else:
            with open(log_path, "w") as f:
                f.write(log)

    ##################
    # Parse makefile #
    ##################
    # TODO: we won't need this after we finish the makefile parser
    num_links = 0
    # TODO: count(	s, sub[, start[, end]])
    for line in open(makefile):