Andrey Churbanov | a951e21 | 2015-04-29 14:36:38 +0000 | [diff] [blame] | 1 | # -*- Python -*- |
| 2 | |
| 3 | # Configuration file for the 'lit' test runner. |
| 4 | |
| 5 | import os |
| 6 | import sys |
| 7 | import re |
| 8 | import platform |
| 9 | |
| 10 | try: |
| 11 | import lit.util |
| 12 | import lit.formats |
| 13 | except ImportError: |
| 14 | pass |
| 15 | |
| 16 | # name: The name of this test suite. |
| 17 | config.name = 'OpenMPValidationSuite' |
| 18 | |
| 19 | # testFormat: The test format to use to interpret tests. |
| 20 | config.test_format = lit.formats.ShTest(execute_external=False) |
| 21 | |
| 22 | # suffixes: A list of file extensions to treat as test files |
| 23 | # Note this can be overridden by lit.local.cfg files |
| 24 | config.suffixes = ['.ll'] |
| 25 | |
| 26 | # test_source_root: The root path where tests are located. |
| 27 | #config.test_source_root = "/home/ichoyjx/install/openmp/testsuite/bin" |
| 28 | #os.path.dirname(__file__) |
| 29 | |
| 30 | # test_exec_root: The root path where tests should be run. |
| 31 | #mpvs_obj_root = getattr(config, 'mpvs_obj_root', None) |
| 32 | #if mpvs_obj_root is not None: |
| 33 | config.test_exec_root = "./" |
| 34 | #os.path.join(mpvs_obj_root, 'src') |
| 35 | |
| 36 | # Discover the 'clang' and 'clangcc' to use. |
| 37 | |
| 38 | import os |
| 39 | |
| 40 | def inferClang(PATH): |
| 41 | # Determine which clang to use. |
| 42 | clang = os.getenv('CLANG') |
| 43 | |
| 44 | # If the user set clang in the environment, definitely use that and don't |
| 45 | # try to validate. |
| 46 | if clang: |
| 47 | return clang |
| 48 | |
| 49 | # Otherwise look in the path. |
| 50 | clang = lit.util.which('clang', PATH) |
| 51 | |
| 52 | if not clang: |
| 53 | lit_config.fatal("couldn't find 'clang' program, try setting " |
| 54 | "CLANG in your environment") |
| 55 | |
| 56 | return clang |
| 57 | |
| 58 | config.clang = inferClang(config.environment['PATH']).replace('\\', '/') |
| 59 | config.substitutions.append( ('%clang', ' ' + config.clang + ' ') ) |
| 60 | |
| 61 | # Propogate some environment variable to test environment. |
| 62 | def addEnv(name): |
| 63 | if name in os.environ: |
| 64 | config.environment[name] = os.environ[name] |
| 65 | |
| 66 | addEnv('HOME') |
| 67 | addEnv('PWD') |
| 68 | |
| 69 | |
| 70 | addEnv('C_INCLUDE_PATH') |
| 71 | addEnv('CPLUS_INCLUDE_PATH') |
| 72 | addEnv('LIBRARY_PATH') |
| 73 | addEnv('LD_LIBRARY_PATH') |
| 74 | addEnv('DYLD_LIBRARY_PATH') |
| 75 | |
| 76 | # Check that the object root is known. |
| 77 | if config.test_exec_root is None: |
| 78 | lit.fatal('test execution root not set!') |