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 | |
| 12 | def append_dynamic_library_path(name, value, sep): |
| 13 | if name in config.environment: |
| 14 | config.environment[name] = value + sep + config.environment[name] |
| 15 | else: |
| 16 | config.environment[name] = value |
| 17 | |
| 18 | # name: The name of this test suite. |
| 19 | config.name = 'libomp' |
| 20 | |
| 21 | # suffixes: A list of file extensions to treat as test files. |
| 22 | config.suffixes = ['.c'] |
| 23 | |
| 24 | # test_source_root: The root path where tests are located. |
| 25 | config.test_source_root = os.path.dirname(__file__) |
| 26 | |
| 27 | # test_exec_root: The root object directory where output is placed |
| 28 | config.test_exec_root = config.libomp_obj_root |
| 29 | |
| 30 | # test format |
| 31 | config.test_format = lit.formats.ShTest() |
| 32 | |
| 33 | # compiler flags |
| 34 | config.test_cflags = config.test_openmp_flag + \ |
| 35 | " -I " + config.test_source_root + \ |
| 36 | " -I " + config.omp_header_directory + \ |
| 37 | " -L " + config.library_dir + \ |
| 38 | " " + config.test_extra_cflags |
| 39 | |
| 40 | # Setup environment to find dynamic library at runtime |
| 41 | if config.operating_system == 'Windows': |
| 42 | append_dynamic_library_path('PATH', config.library_dir, ";") |
| 43 | elif config.operating_system == 'Darwin': |
| 44 | append_dynamic_library_path('DYLD_LIBRARY_PATH', config.library_dir, ":") |
Jonathan Peyton | 5a60bc5 | 2015-09-24 15:09:51 +0000 | [diff] [blame] | 45 | config.test_cflags += " -Wl,-rpath," + config.library_dir |
Jonathan Peyton | 614c7ef | 2015-09-21 20:41:31 +0000 | [diff] [blame] | 46 | else: # Unices |
| 47 | append_dynamic_library_path('LD_LIBRARY_PATH', config.library_dir, ":") |
| 48 | |
| 49 | # substitutions |
| 50 | config.substitutions.append(("%libomp-compile-and-run", \ |
| 51 | "%clang %cflags %s -o %t -lm && %t")) |
| 52 | config.substitutions.append(("%clang", config.test_compiler)) |
| 53 | config.substitutions.append(("%openmp_flag", config.test_openmp_flag)) |
| 54 | config.substitutions.append(("%cflags", config.test_cflags)) |
| 55 | |