使用python调用其他文件夹下的makefile

由于业务需要跑仿真的时候将所有的测试用例放在不同的文件夹下面跑,所以需要调用不同文件夹下的make file

import os 
from multiprocessing import Process, Queue, Pool
import time, datetime

#首先判断文件夹是否存在,以免覆盖之前的文件夹了
count =0

for i in range(10):    #只希望最多存留之前编译文件10个
    if os.path.exists("../compile_{0}".format(count)):  #设置创建文件的相对路径
        count += 1   #如果存在则名字加1
    else:
        data = os.system("cp -rf ../run ../compile_{}".format(count)) #调用系统函数创建文件夹
        os.chdir("../compile_{}".format(count))  #修改工作路径,这一行是最重要的
        os.system("make compile_vcs")
        break
        

 

你可能感兴趣的:(uvm,python)