source: src/tests/pybin/settings.py@ 02559df

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr no_list persistent-indexer pthread-emulation qualifiedEnum
Last change on this file since 02559df was 552f5cb, checked in by Thierry Delisle <tdelisle@…>, 7 years ago

Tests now get default architecture from GNU build system instead of creating a dummy executable

  • Property mode set to 100644
File size: 1.8 KB
Line 
1from __future__ import print_function
2
3import os
4import sys
5
6try :
7 sys.path.append(os.getcwd())
8 import config
9
10 SRCDIR = os.path.abspath(config.SRCDIR)
11 BUILDDIR = os.path.abspath(config.BUILDDIR)
12except:
13 print('ERROR: missing config.py, re-run configure script.', file=sys.stderr)
14 sys.exit(1)
15
16class Architecture:
17 KnownArchitectures = {
18 'x64' : 'x64',
19 'x86-64' : 'x64',
20 'x86_64' : 'x64',
21 'x86' : 'x86',
22 'i386' : 'x86',
23 'i486' : 'x86',
24 'i686' : 'x86',
25 'Intel 80386' : 'x86',
26 'arm' : 'arm',
27 'ARM' : 'arm',
28 }
29
30 def __init__(self, arch):
31 if arch:
32 self.cross_compile = True
33 try:
34 self.target = Architecture.makeCanonical( arch )
35 except KeyError:
36 print("Unkown architecture %s" % arch)
37 sys.exit(1)
38 else:
39 self.cross_compile = False
40 try:
41 arch = config.HOSTARCH
42 self.target = Architecture.makeCanonical( arch )
43 except KeyError:
44 print("Running on unkown architecture %s" % arch)
45 sys.exit(1)
46
47 self.string = self.target
48
49 def update(self):
50 if not self.cross_compile:
51 self.target = machine_default()
52 self.string = self.target
53 print("updated to %s" % self.target)
54
55 def match(self, arch):
56 return True if not arch else self.target == arch
57
58 @classmethod
59 def makeCanonical(_, arch):
60 return Architecture.KnownArchitectures[arch]
61
62
63class Debug:
64 def __init__(self, value):
65 self.string = "debug" if value else "no debug"
66 self.flags = """DEBUG_FLAGS="%s" """ % ("-debug" if value else "-nodebug")
67
68def init( options ):
69 global arch
70 global dry_run
71 global generating
72 global make
73 global debug
74 global debugFlag
75
76 dry_run = options.dry_run
77 generating = options.regenerate_expected
78 make = 'make'
79 debug = Debug(options.debug)
80 arch = Architecture(options.arch)
81
82
83def updateMakeCmd(force, jobs):
84 global make
85
86 make = "make" if not force else ("make -j%i" % jobs)
Note: See TracBrowser for help on using the repository browser.