Jonathan Peyton | 614c7ef | 2015-09-21 20:41:31 +0000 | [diff] [blame] | 1 | # -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79: |
| 2 | # Configuration file for the 'lit' test runner. |
| 3 | |
| 4 | import os |
| 5 | import lit.formats |
| 6 | |
| 7 | # Tell pylint that we know config and lit_config exist somewhere. |
| 8 | if 'PYLINT_IMPORT' in os.environ: |
| 9 | config = object() |
| 10 | lit_config = object() |
| 11 | |
Jonathan Peyton | 01dcf36 | 2015-11-30 20:02:59 +0000 | [diff] [blame^] | 12 | def append_dynamic_library_path(path): |
| 13 | if config.operating_system == 'Windows': |
| 14 | name = 'PATH' |
| 15 | sep = ';' |
| 16 | elif config.operating_system == 'Darwin': |
| 17 | name = 'DYLD_LIBRARY_PATH' |
| 18 | sep = ':' |
Jonathan Peyton | 614c7ef | 2015-09-21 20:41:31 +0000 | [diff] [blame] | 19 | else: |
Jonathan Peyton | 01dcf36 | 2015-11-30 20:02:59 +0000 | [diff] [blame^] | 20 | name = 'LD_LIBRARY_PATH' |
| 21 | sep = ':' |
| 22 | if name in config.environment: |
| 23 | config.environment[name] = path + sep + config.environment[name] |
| 24 | else: |
| 25 | config.environment[name] = path |
Jonathan Peyton | 614c7ef | 2015-09-21 20:41:31 +0000 | [diff] [blame] | 26 | |
| 27 | # name: The name of this test suite. |
| 28 | config.name = 'libomp' |
| 29 | |
| 30 | # suffixes: A list of file extensions to treat as test files. |
| 31 | config.suffixes = ['.c'] |
| 32 | |
| 33 | # test_source_root: The root path where tests are located. |
| 34 | config.test_source_root = os.path.dirname(__file__) |
| 35 | |
| 36 | # test_exec_root: The root object directory where output is placed |
| 37 | config.test_exec_root = config.libomp_obj_root |
| 38 | |
| 39 | # test format |
| 40 | config.test_format = lit.formats.ShTest() |
| 41 | |
| 42 | # compiler flags |
| 43 | config.test_cflags = config.test_openmp_flag + \ |
| 44 | " -I " + config.test_source_root + \ |
| 45 | " -I " + config.omp_header_directory + \ |
| 46 | " -L " + config.library_dir + \ |
| 47 | " " + config.test_extra_cflags |
| 48 | |
| 49 | # Setup environment to find dynamic library at runtime |
Jonathan Peyton | 01dcf36 | 2015-11-30 20:02:59 +0000 | [diff] [blame^] | 50 | append_dynamic_library_path(config.library_dir) |
| 51 | if config.using_hwloc: |
| 52 | append_dynamic_library_path(config.hwloc_library_dir) |
| 53 | |
| 54 | # Rpath modifications for Darwin |
| 55 | if config.operating_system == 'Darwin': |
Jonathan Peyton | 5a60bc5 | 2015-09-24 15:09:51 +0000 | [diff] [blame] | 56 | config.test_cflags += " -Wl,-rpath," + config.library_dir |
Jonathan Peyton | 01dcf36 | 2015-11-30 20:02:59 +0000 | [diff] [blame^] | 57 | if config.using_hwloc: |
| 58 | config.test_cflags += " -Wl,-rpath," + config.hwloc_library_dir |
Jonathan Peyton | 614c7ef | 2015-09-21 20:41:31 +0000 | [diff] [blame] | 59 | |
| 60 | # substitutions |
| 61 | config.substitutions.append(("%libomp-compile-and-run", \ |
| 62 | "%clang %cflags %s -o %t -lm && %t")) |
| 63 | config.substitutions.append(("%clang", config.test_compiler)) |
| 64 | config.substitutions.append(("%openmp_flag", config.test_openmp_flag)) |
| 65 | config.substitutions.append(("%cflags", config.test_cflags)) |
| 66 | |