-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathautoTesting.py
More file actions
89 lines (83 loc) · 2.75 KB
/
autoTesting.py
File metadata and controls
89 lines (83 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
'''
This file performs the automatic testing for all the cases in .........
'''
import numpy as np
import glob
import os
import re
import pytest
def readstp(fn):
f = open(fn, 'r')
for i in f:
exec(i)
f.close()
globals().update(locals())
def readin(fn,nin):
f = open(fn, 'r')
data = f.readlines()
return data[nin]
def modin(fn,nin,strIn):
f = open(fn, 'r')
data = f.readlines()
f.close()
data[nin] = strIn
with open(fn, 'w') as file:
file.writelines( data )
return
def chkRes():
return
#############################################################
# define execution variables
wfold = os.getcwd()
mainFold = wfold[:[_.start() for _ in re.finditer('/',wfold)][-1]]
compiler = 'generic-gnu'
#compiler = 'generic-nvf'
#compiler = 'generic-gpu'
tfold = 'utils/testing/templateTest/'
#
doDBG = ['0']#,'1']
doCuda= ['1']
doProc= ['2 2\n']#,'2 2\n']
#doProc= ['1 1\n']#,'2 2\n']
#doProc= ['1 2\n']#,'2 2\n']
#
cdir = os.getcwd()
apps = [ name for name in os.listdir() if os.path.isdir(os.path.join(name))]
os.system('rm '+wfold+'/test.out')
fileOut = open('test.out','w')
for dbgFlag in doDBG:
for cudaFlag in doCuda:
for app in apps:
os.chdir(wfold+'/'+app)
testcases = [ name for name in os.listdir() if os.path.isdir(os.path.join(name))]
print(testcases)
os.chdir(mainFold+'/src')
#
os.system('make clean APP='+app+'>/dev/null;'+
#'make APP='+app+' ARCH='+compiler+ ' Do_DBG='+dbgFlag+' -j8>/dev/null')
'make APP='+app+' ARCH='+compiler+ ' DO_DBG='+dbgFlag+' -j8>/dev/null')
#
if 'flutas' in os.listdir():
print('app '+app+', debug='+dbgFlag+' : compiled-------> PASSED')
fileOut.write('app '+app+', debug='+dbgFlag+' : compiled -------> PASSED\n')
for case in testcases:
#print(case)
#print(testcases)
os.chdir(wfold+'/'+app+'/'+case)
if len(glob.glob('test*'))>0:
os.system('cp '+mainFold+'/src/flutas .')
for procN in doProc:
tmp = procN.split(' ')
nmpi = int(tmp[0])*int(tmp[1])
modin('dns.in',-2,procN)
os.system('mpirun.openmpi -np '+str(nmpi)+' flutas>/dev/null')
testout = pytest.main()
testout = str(testout)[str(testout).find('.')+1:]
fileOut.write('test '+case+' np='+str(nmpi)+'-------> '+testout+'\n')
#os.system('rm -rf data __pycache__ flutas;'+
os.system('rm -rf data && rm -rf .pytest_cache && rm -rf __pycache__ && rm -rf flutas*;'+
'git checkout *.in')
else:
print('test '+app+', debug='+dbgFlag+' : compilation failed \n')
exit()
fileOut.close()