ghc-dup: 3ce91af623ea29d59a3ade96272d9736edc46fd4
1: import os
2: import re
3:
4: # Testsuite configuration setup for GHC
5: #
6: # This file is Python source
7: #
8: config.compiler_type = 'ghc'
9: config.compiler = 'ghc'
10: config.compiler_always_flags = ghc_compiler_always_flags.split()
11:
12: config.hp2ps = 'hp2ps'
13: config.hpc = 'hpc'
14: config.gs = 'gs'
15: config.confdir = '.'
16:
17: # By default, we test the 'normal', 'opt' and 'hpc' ways.
18: # 'optasm' is added by mk/test.mk if the compiler has a native code gen,
19: # 'prof' is added by mk/test.mk if the profiling way is enabled.
20: config.compile_ways = ['normal', 'hpc']
21: config.run_ways = ['normal', 'hpc']
22:
23: # ways that are not enabled by default, but can always be invoked explicitly
24: config.other_ways = ['extcore','optextcore',
25: 'prof',
26: 'prof_hc_hb','prof_hb',
27: 'prof_hd','prof_hy','prof_hr',
28: 'threaded1_ls', 'threaded2_hT',
29: 'llvm', 'debugllvm' ]
30:
31: if (ghc_with_native_codegen == 1):
32: config.compile_ways.append('optasm')
33: config.run_ways.append('optasm')
34:
35: if (ghc_with_profiling == 1):
36: config.have_profiling = True
37: config.compile_ways.append('profasm')
38: config.run_ways.append('profasm')
39:
40: if (ghc_with_interpreter == 1):
41: config.have_interp = True
42: config.run_ways.append('ghci')
43:
44: config.unregisterised = (ghc_unregisterised == 1)
45:
46: if (ghc_with_threaded_rts == 1):
47: config.run_ways.append('threaded1')
48: if (ghc_with_smp == 1):
49: config.have_smp = True
50: config.run_ways.append('threaded2')
51:
52: if (ghc_with_dynamic_rts == 1):
53: config.have_shared_libs = True
54: config.run_ways.append('dyn')
55:
56: if (ghc_with_profiling == 1 and ghc_with_threaded_rts == 1):
57: config.run_ways.append('profthreaded')
58:
59: if (ghc_with_llvm == 1):
60: config.compile_ways.append('optllvm')
61: config.run_ways.append('optllvm')
62:
63: config.in_tree_compiler = in_tree_compiler
64: config.clean_only = clean_only
65:
66: config.way_flags = {
67: 'normal' : [],
68: 'g1' : [],
69: 'optasm' : ['-O', '-fasm'],
70: 'llvm' : ['-fllvm'],
71: 'optllvm' : ['-O', '-fllvm'],
72: 'debugllvm' : ['-fllvm', '-keep-llvm-files'],
73: 'prof' : ['-prof', '-auto-all', '-fasm'],
74: 'profasm' : ['-O', '-prof', '-auto-all'],
75: 'profthreaded' : ['-O', '-prof', '-auto-all', '-threaded'],
76: 'ghci' : ['--interactive', '-v0', '-ignore-dot-ghci', '+RTS', '-I0.1', '-RTS'],
77: 'extcore' : ['-fext-core'],
78: 'optextcore' : ['-O', '-fext-core'],
79: 'threaded1' : ['-threaded', '-debug'],
80: 'threaded1_ls' : ['-threaded', '-debug'],
81: 'threaded2' : ['-O', '-threaded', '-eventlog'],
82: 'threaded2_hT' : ['-O', '-threaded'],
83: 'hpc' : ['-O', '-fhpc' ],
84: 'prof_hc_hb' : ['-O', '-prof', '-auto-all'],
85: 'prof_hb' : ['-O', '-prof', '-auto-all'],
86: 'prof_hd' : ['-O', '-prof', '-auto-all'],
87: 'prof_hy' : ['-O', '-prof', '-auto-all'],
88: 'prof_hr' : ['-O', '-prof', '-auto-all'],
89: 'dyn' : ['-O', '-dynamic']
90: }
91:
92: config.way_rts_flags = {
93: 'normal' : [],
94: 'g1' : ['-G1'],
95: 'optasm' : [],
96: 'llvm' : [],
97: 'optllvm' : [],
98: 'debugllvm' : [],
99: 'prof' : ['-p'],
100: 'profasm' : ['-hc', '-p'], # test heap profiling too
101: 'profthreaded' : ['-p'],
102: 'ghci' : [],
103: 'extcore' : [],
104: 'optextcore' : [],
105: 'threaded1' : [],
106: 'threaded1_ls' : ['-ls'],
107: 'threaded2' : ['-N2 -ls'],
108: 'threaded2_hT' : ['-N2', '-hT'],
109: 'hpc' : [],
110: 'prof_hc_hb' : ['-hc -hbvoid'],
111: 'prof_hb' : ['-hb'],
112: 'prof_hd' : ['-hd'],
113: 'prof_hy' : ['-hy'],
114: 'prof_hr' : ['-hr'],
115: 'dyn' : []
116: }
117:
118: # Useful classes of ways that can be used with only_ways() and
119: # expect_broken_for().
120:
121: prof_ways = map (lambda x: x[0], \
122: filter(lambda x: '-prof' in x[1], \
123: config.way_flags.items()))
124:
125: threaded_ways = map (lambda x: x[0], \
126: filter(lambda x: '-threaded' in x[1] or 'ghci' == x[0], \
127: config.way_flags.items()))
128:
129: opt_ways = map (lambda x: x[0], \
130: filter(lambda x: '-O' in x[1], \
131: config.way_flags.items()))
132:
133: def get_compiler_info():
134: # This should really not go through the shell
135: h = os.popen('"' + config.compiler + '" --info', 'r')
136: s = h.read()
137: s = re.sub('[\r\n]', '', s)
138: h.close()
139: compilerInfoDict = dict(eval(s))
140: h = os.popen('"' + config.compiler + '" +RTS --info', 'r')
141: s = h.read()
142: s = re.sub('[\r\n]', '', s)
143: h.close()
144: rtsInfoDict = dict(eval(s))
145:
146: # We use a '/'-separated path for libdir, even on Windows
147: config.libdir = re.sub('\\\\','/',compilerInfoDict['LibDir'])
148:
149: v = compilerInfoDict["Project version"].split('-')
150: config.compiler_version = v[0]
151: config.compiler_maj_version = re.sub('^([0-9]+\.[0-9]+).*',r'\1', v[0])
152: config.compiler_tags = v[1:]
153:
154: # -fno-ghci-history was added in 7.3
155: if version_ge(config.compiler_version, '7.3'):
156: config.compiler_always_flags = \
157: config.compiler_always_flags + ['-fno-ghci-history']
158:
159: if re.match(".*_p(_.*|$)", rtsInfoDict["RTS way"]):
160: config.compiler_profiled = True
161: config.run_ways = filter(lambda x: x != 'ghci', config.run_ways)
162: else:
163: config.compiler_profiled = False
164:
165: try:
166: config.package_conf_cache_file = compilerInfoDict["Global Package DB"] + '/package.cache'
167: except:
168: config.package_conf_cache_file = ''
169:
Generated by git2html.