ghc-dup: d7e63d1c875dc57ec700e38b7251c5595038866f

     1: # 
     2: # (c) Simon Marlow 2002
     3: #
     4: 
     5: # -----------------------------------------------------------------------------
     6: # Configuration info
     7: 
     8: # There is a single global instance of this structure, stored in the
     9: # variable config below.  The fields of the structure are filled in by
    10: # the appropriate config script(s) for this compiler/platform, in
    11: # ../config.
    12: # 
    13: # Bits of the structure may also be filled in from the command line,
    14: # via the build system, using the '-e' option to runtests.
    15: 
    16: class TestConfig:
    17:     def __init__(self):
    18: 
    19:         # Where the testsuite root is
    20:         self.top = ''
    21: 
    22:         # Directories below which to look for test description files (foo.T)
    23:         self.rootdirs = []
    24: 
    25:         # Run these tests only (run all tests if empty)
    26:         self.only = []
    27: 
    28:         # Accept new output which differs from the sample?
    29:         self.accept = 0
    30: 
    31:         # File in which to save the summary
    32:         self.output_summary = ''
    33: 
    34:         # File in which to save the times
    35:         self.times_file = ''
    36: 
    37:         # What platform are we running on?
    38:         self.platform = ''
    39:         self.os = ''
    40:         self.arch = ''
    41: 
    42:         # What is the wordsize (in bits) of this platform?
    43:         self.wordsize = ''
    44: 
    45:         # Verbosity level
    46:         self.verbose = 1
    47: 
    48:         # run the "fast" version of the test suite
    49:         self.fast = 0
    50: 
    51:         # Compiler type (ghc, hugs, nhc, etc.)
    52:         self.compiler_type = ''
    53: 
    54:         # Path to the compiler
    55:         self.compiler = ''
    56:         # and ghc-pkg
    57:         self.ghc_pkg = ''
    58: 
    59:         # Compiler version info
    60:         self.compiler_version = ''
    61:         self.compiler_maj_version = ''
    62:         self.compiler_tags = []
    63: 
    64:         # Flags we always give to this compiler
    65:         self.compiler_always_flags = []
    66:         
    67:         # Which ways to run tests (when compiling and running respectively)
    68:         # Other ways are added from the command line if we have the appropriate
    69:         # libraries.
    70:         self.compile_ways = []
    71:         self.run_ways     = []
    72:         self.other_ways   = []
    73: 
    74:         # The ways selected via the command line.
    75:         self.cmdline_ways = []
    76: 
    77:         # Lists of flags for each way
    78:         self.way_flags = {}
    79:         self.way_rts_flags = {}
    80: 
    81:         # Do we have profiling support?
    82:         self.have_profiling = False
    83: 
    84:         # Do we have interpreter support?
    85:         self.have_interp = False
    86: 
    87:         # Do we have shared libraries?
    88:         self.have_shared_libs = False
    89: 
    90:         # Do we have SMP support?
    91:         self.have_smp = False
    92: 
    93:         # Are we testing an in-tree compiler?
    94:         self.in_tree_compiler = True
    95: 
    96:         # the timeout program
    97:         self.timeout_prog = ''
    98:         self.timeout = 300
    99:         
   100:         # threads
   101:         self.threads = 1
   102:         self.use_threads = 0
   103: 
   104:         # Should we check for files being written more than once?
   105:         self.check_files_written = False
   106: 
   107: global config
   108: config = TestConfig()
   109: 
   110: def getConfig():
   111:     return config
   112: 
   113: # -----------------------------------------------------------------------------
   114: # Information about the current test run
   115: 
   116: class TestRun:
   117:    def __init__(self):
   118:        self.start_time = ''
   119:        self.total_tests = 0
   120:        self.total_test_cases = 0
   121:        self.n_framework_failures = 0
   122:        self.framework_failures = {}
   123:        self.n_tests_skipped = 0
   124:        self.tests_skipped = {}
   125:        self.n_expected_passes = 0
   126:        self.expected_passes = {}
   127:        self.n_expected_failures = 0
   128:        self.expected_failures = {}
   129:        self.n_missing_libs = 0
   130:        self.missing_libs = {}
   131:        self.n_unexpected_passes = 0
   132:        self.unexpected_passes = {}
   133:        self.n_unexpected_failures = 0
   134:        self.unexpected_failures = {}
   135:        
   136: global t
   137: t = TestRun()
   138: 
   139: def getTestRun():
   140:     return t
   141: 
   142: # -----------------------------------------------------------------------------
   143: # Information about the current test
   144: 
   145: class TestOptions:
   146:    def __init__(self):
   147:        # if not None then we look for namebase.stderr etc rather than
   148:        # using the test name
   149:        self.with_namebase = None
   150: 
   151:        # skip this test?
   152:        self.skip = 0
   153: 
   154:        # skip these ways
   155:        self.omit_ways = []
   156: 
   157:        # skip all ways except these (None == do all ways)
   158:        self.only_ways = None
   159: 
   160:        # add these ways to the default set
   161:        self.extra_ways = []
   162: 
   163:        # the result we normally expect for this test
   164:        self.expect = 'pass'
   165: 
   166:        # override the expected result for certain ways
   167:        self.expect_fail_for = []
   168: 
   169:        # the stdin file that this test will use (empty for <name>.stdin)
   170:        self.stdin = ''
   171: 
   172:        # don't compare output
   173:        self.ignore_output = 0
   174: 
   175:        # don't give anything as stdin
   176:        self.no_stdin = 0
   177: 
   178:        # compile this test to .hc only
   179:        self.compile_to_hc = 0
   180: 
   181:        # We sometimes want to modify the compiler_always_flags, so
   182:        # they are copied from config.compiler_always_flags when we
   183:        # make a new instance of TestOptions.
   184:        self.compiler_always_flags = []
   185: 
   186:        # extra compiler opts for this test
   187:        self.extra_hc_opts = ''
   188: 
   189:        # extra run opts for this test
   190:        self.extra_run_opts = ''
   191: 
   192:        # expected exit code
   193:        self.exit_code = 0
   194: 
   195:        # should we clean up after ourselves?
   196:        self.cleanup = ''
   197: 
   198:        # extra files to clean afterward
   199:        self.clean_files = []
   200: 
   201:        # which -t numeric fields do we want to look at, and what bounds must
   202:        # they fall within?
   203:        # Elements of these lists should be things like
   204:        # ('bytes allocated',
   205:        #   9300000000,
   206:        #   10)
   207:        # To allow a 10% deviation from 9300000000.
   208:        self.compiler_stats_range_fields = {}
   209:        self.stats_range_fields = {}
   210: 
   211:        # TODO: deprecate this in favour of compiler_stats_range_fields
   212:        #
   213:        # which -t numeric fields do we want to look at, and what bounds must
   214:        # they fall within?
   215:        # Elements of these lists should be things like
   216:        # ('bytes allocated',
   217:        #   9300000000,
   218:        #   9400000000)
   219:        self.compiler_stats_num_fields = {}
   220:        self.stats_num_fields = {}
   221: 
   222:        # should we run this test alone, i.e. not run it in parallel with
   223:        # any other threads
   224:        self.alone = False
   225: 
   226:        # Does this test use a literate (.lhs) file?
   227:        self.literate = 0
   228: 
   229:        # Does this test use a .c, .m or .mm file?
   230:        self.c_src      = 0
   231:        self.objc_src   = 0
   232:        self.objcpp_src = 0
   233: 
   234:        # Command to run before the test
   235:        self.pre_cmd = None
   236: 
   237:        # Command to run for extra cleaning
   238:        self.clean_cmd = None
   239: 
   240:        # Command wrapper: a function to apply to the command before running it
   241:        self.cmd_wrapper = None
   242: 
   243:        # Prefix to put on the command before compiling it
   244:        self.compile_cmd_prefix = ''
   245: 
   246:        # Extra output normalisation
   247:        self.extra_normaliser = lambda x: x
   248: 
   249:        # Extra normalisation for compiler error messages
   250:        self.extra_errmsg_normaliser = lambda x: x
   251: 
   252:        # The directory the test is in
   253:        self.testdir = '.'
   254: 
   255:        # Should we redirect stdout and stderr to a single file?
   256:        self.combined_output = False
   257: 
   258: # The default set of options
   259: global default_testopts
   260: default_testopts = TestOptions()
   261: 

Generated by git2html.