-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
executable file
·127 lines (99 loc) · 3.11 KB
/
config.py
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/env python
import argparse
import os
import sys
from ConfigParser import SafeConfigParser
def this_dir():
return os.path.abspath(os.path.dirname(__file__));
def root_dir():
root_file_dir=os.path.join(this_dir(),'root.txt')
root_file_content = open (root_file_dir,"r").read().strip('\n')
if not root_file_content==this_dir():
print "Something wrong! \nroot_file_content = %s, but this_dir() = %s" %(root_file_content, this_dir())
sys.exit(1)
return root_file_content
def src_dir():
res=os.path.join(root_dir(),'src')
if not os.path.isdir(res):
print "Something wrong! `%s` is not a directory" % res
sys.exit(1)
return res
def benchs_dir():
res=os.path.join(root_dir(),'benchs')
if not os.path.isdir(res):
print "Something wrong! `%s` is not a directory" % res
sys.exit(1)
return res
def output_dir():
res=os.path.join(root_dir(),'output')
if not os.path.isdir(res):
print "Something wrong! `%s` is not a directory" % res
sys.exit(1)
return res
def config_dir():
res=os.path.join(root_dir(),'config')
if not os.path.isdir(res):
print "Something wrong! `%s` is not a directory" % res
sys.exit(1)
return res
def pp_ini_dir():
res=os.path.join(config_dir(),'pp.ini')
if not os.path.isfile(res):
print "Something wrong! `%s` is not a file" % res
sys.exit(1)
return res
def bench_name():
theBench_txt_dir=os.path.join(root_dir(),'theBench.txt')
if not os.path.isfile(theBench_txt_dir):
print "Something wrong (001)! `%s` is not a directory" % res
sys.exit(1)
res = open (theBench_txt_dir,"r").read().strip('\n')
return res
def bench_dir():
res=os.path.join(benchs_dir(),bench_name())
if not os.path.isdir(res):
print "Something wrong (002)! `%s` is not a directory" % res
sys.exit(1)
return res
def loader_dir():
res=os.path.join(root_dir(), 'build')
if not os.path.isdir(res):
print "Something wrong! `%s` is not a directory" % res
sys.exit(1)
return res
def libr_so_dir():
res = os.path.join (root_dir(), 'build','libr.so')
if not os.path.isfile(res):
print "Something wrong! `%s` is not a file" % res
sys.exit(1)
return res
def brInfo_dir():
res = os.path.join (output_dir(), 'brInfo.txt')
if not os.path.isfile(res):
print "Something wrong! `%s` is not a file" % res
sys.exit(1)
return res
def time_dir():
res = os.path.join (output_dir(), 'time.txt')
return res
def tests_dir():
res = os.path.join (output_dir(), 'tests.txt')
return res
def dimension_dir():
res = os.path.join (output_dir(), 'dimension.txt')
return res
def nfev_dir():
res = os.path.join (output_dir(), 'nfev.txt')
return res
if __name__ == "__main__":
message='[BVA config setting] ... '
print this_dir()
print root_dir()
print src_dir()
print benchs_dir()
print pp_ini_dir()
print bench_name()
print bench_dir()
print loader_dir()
print libr_so_dir()
print "loader_dir =", loader_dir()