2020-03-29 15:19:14 +00:00
|
|
|
import os
|
2020-10-25 05:49:39 +00:00
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
2020-03-29 15:19:14 +00:00
|
|
|
|
|
|
|
# 找出path目录下的所有bin文件
|
|
|
|
def list_binfiles(path):
|
|
|
|
files = []
|
|
|
|
list_dir = os.walk(path)
|
|
|
|
for maindir, subdir, all_file in list_dir:
|
|
|
|
for filename in all_file:
|
|
|
|
apath = os.path.join(maindir, filename)
|
|
|
|
if apath.endswith('.bin'):
|
|
|
|
files.append(apath)
|
|
|
|
|
|
|
|
return files
|
|
|
|
|
2020-10-25 05:49:39 +00:00
|
|
|
# 主函数
|
|
|
|
def main():
|
|
|
|
bin_files = list_binfiles(r'../tests/isa/generated')
|
2020-03-29 15:19:14 +00:00
|
|
|
|
2020-10-25 05:49:39 +00:00
|
|
|
anyfail = False
|
2020-03-29 15:19:14 +00:00
|
|
|
|
2020-10-25 05:49:39 +00:00
|
|
|
# 对每一个bin文件进行测试
|
|
|
|
for file in bin_files:
|
|
|
|
#print(file)
|
|
|
|
cmd = r'python sim_new_nowave.py' + ' ' + file + ' ' + 'inst.data'
|
|
|
|
f = os.popen(cmd)
|
|
|
|
r = f.read()
|
|
|
|
f.close()
|
|
|
|
if (r.find('TEST_PASS') != -1):
|
|
|
|
print(file + ' PASS')
|
|
|
|
else:
|
|
|
|
print(file + ' !!!FAIL!!!')
|
|
|
|
anyfail = True
|
|
|
|
break
|
2020-03-29 15:19:14 +00:00
|
|
|
|
2020-10-25 05:49:39 +00:00
|
|
|
if (anyfail == False):
|
|
|
|
print('Congratulation, All PASS...')
|
2020-03-29 15:19:14 +00:00
|
|
|
|
|
|
|
|
2020-10-25 05:49:39 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|