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
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        with_gc
      
      
        
          | 
            Last change
 on this file since d35abc2 was             f3b9efc, checked in by Thierry Delisle <tdelisle@…>, 8 years ago           | 
        
        
          | 
             
Tests now properly work with multiple architectures 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.6 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | import sys
 | 
|---|
| 2 | 
 | 
|---|
| 3 | class Architecture:
 | 
|---|
| 4 |         KnownArchitectures = {
 | 
|---|
| 5 |                 'x64'                   : 'x64',
 | 
|---|
| 6 |                 'x86-64'                : 'x64',
 | 
|---|
| 7 |                 'x86'                   : 'x86',
 | 
|---|
| 8 |                 'i386'          : 'x86',
 | 
|---|
| 9 |                 'i486'          : 'x86',
 | 
|---|
| 10 |                 'i686'          : 'x86',
 | 
|---|
| 11 |                 'Intel 80386'   : 'x86',
 | 
|---|
| 12 |                 'arm'                   : 'arm',
 | 
|---|
| 13 |                 'ARM'                   : 'arm',
 | 
|---|
| 14 |         }
 | 
|---|
| 15 | 
 | 
|---|
| 16 |         def __init__(self, arch):
 | 
|---|
| 17 |                 if arch:
 | 
|---|
| 18 |                         self.cross_compile = True
 | 
|---|
| 19 |                         try:
 | 
|---|
| 20 |                                 self.target = Architecture.makeCanonical( arch )
 | 
|---|
| 21 |                         except KeyError:
 | 
|---|
| 22 |                                 print("Unkown architecture %s" % arch)
 | 
|---|
| 23 |                                 sys.exit(1)
 | 
|---|
| 24 |                 else:
 | 
|---|
| 25 |                         self.cross_compile = False
 | 
|---|
| 26 |                         try:
 | 
|---|
| 27 |                                 arch = machine_default()
 | 
|---|
| 28 |                                 self.target = Architecture.makeCanonical( arch )
 | 
|---|
| 29 |                         except KeyError:
 | 
|---|
| 30 |                                 print("Running on unkown architecture %s" % arch)
 | 
|---|
| 31 |                                 sys.exit(1)
 | 
|---|
| 32 | 
 | 
|---|
| 33 |                 self.string = self.target
 | 
|---|
| 34 | 
 | 
|---|
| 35 |         def update(self):
 | 
|---|
| 36 |                 if not self.cross_compile:
 | 
|---|
| 37 |                         self.target = machine_default()
 | 
|---|
| 38 |                         self.string = self.target
 | 
|---|
| 39 |                         print("updated to %s" % self.target)
 | 
|---|
| 40 | 
 | 
|---|
| 41 |         def match(self, arch):
 | 
|---|
| 42 |                 return True if not arch else self.target == arch
 | 
|---|
| 43 | 
 | 
|---|
| 44 |         @classmethod
 | 
|---|
| 45 |         def makeCanonical(_, arch):
 | 
|---|
| 46 |                 return Architecture.KnownArchitectures[arch]
 | 
|---|
| 47 | 
 | 
|---|
| 48 | 
 | 
|---|
| 49 | class Debug:
 | 
|---|
| 50 |         def __init__(self, value):
 | 
|---|
| 51 |                 self.string = "debug" if value else "no debug"
 | 
|---|
| 52 |                 self.flags  = """DEBUG_FLAGS="%s" """ % ("-debug" if value else "-nodebug")
 | 
|---|
| 53 | 
 | 
|---|
| 54 | def init( options ):
 | 
|---|
| 55 |         global arch
 | 
|---|
| 56 |         global dry_run
 | 
|---|
| 57 |         global generating
 | 
|---|
| 58 |         global make
 | 
|---|
| 59 |         global debug
 | 
|---|
| 60 |         global debugFlag
 | 
|---|
| 61 | 
 | 
|---|
| 62 |         dry_run    = options.dry_run
 | 
|---|
| 63 |         generating = options.regenerate_expected
 | 
|---|
| 64 |         make       = 'make'
 | 
|---|
| 65 |         debug        = Debug(options.debug)
 | 
|---|
| 66 |         arch       = Architecture(options.arch)
 | 
|---|
| 67 | 
 | 
|---|
| 68 | def updateMakeCmd(force, jobs):
 | 
|---|
| 69 |         global make
 | 
|---|
| 70 | 
 | 
|---|
| 71 |         make = "make" if not force else ("make -j%i" % jobs)
 | 
|---|
| 72 | 
 | 
|---|
| 73 | 
 | 
|---|
| 74 | def set_machine_default( func ):
 | 
|---|
| 75 |         global machine_default
 | 
|---|
| 76 | 
 | 
|---|
| 77 |         machine_default = func
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.