source: src/tests/pybin/settings.py @ f85bc15

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since f85bc15 was f85bc15, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Test now work outside of tree except for io2

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