mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-01 12:43:47 +00:00
[OpenMP][NFC] lit: Allow setting default environment variables for test
Add CHECK_OPENMP_ENV environment variable which will be passed to environment variables for test (make check-* target). This provides a handy way to exercise various openmp code with different settings during development. For example, to change default barrier pattern: ``` $ env CHECK_OPENMP_ENV="KMP_FORKJOIN_BARRIER_PATTERN=hier,hier \ KMP_PLAIN_BARRIER_PATTERN=hier,hier \ KMP_REDUCTION_BARRIER_PATTERN=hier,hier" \ ninja check-openmp ``` Even with this, each test can set appropriate environment variables if needed as before. Also, this commit adds missing documention about how to run tests in README. Patch provided by t-msn Differential Revision: https://reviews.llvm.org/D122645
This commit is contained in:
parent
b53e16ca0c
commit
81bc7cf609
@ -363,3 +363,35 @@ Advanced Builds with Various Options
|
||||
**Footnotes**
|
||||
|
||||
.. [*] Other names and brands may be claimed as the property of others.
|
||||
|
||||
How to Run Tests
|
||||
================
|
||||
|
||||
There are following check-* make targets for tests.
|
||||
|
||||
- ``check-ompt`` (ompt tests under runtime/test/ompt)
|
||||
- ``check-ompt-multiplex`` (ompt multiplex tests under tools/multiplex/tests)
|
||||
- ``check-libarcher`` (libarcher tests under tools/archer/tests)
|
||||
- ``check-libomp`` (libomp tests under runtime/test. This includes check-ompt tests too)
|
||||
- ``check-libomptarget-*`` (libomptarget tests for specific target under libomptarget/test)
|
||||
- ``check-libomptarget`` (all check-libomptarget-* tests)
|
||||
- ``check-openmp`` (combination of all above tests excluding duplicates)
|
||||
|
||||
For example, to run all available tests, use ``make check-openmp``.
|
||||
|
||||
Options for Tests
|
||||
------------------
|
||||
Tests use lit framework.
|
||||
See `lit documentation <https://llvm.org/docs/CommandGuide/lit.html>`_ for lit options.
|
||||
|
||||
**CHECK_OPENMP_ENV** = ``""``
|
||||
Default environment variables which test process uses for ``check-openmp``
|
||||
separated by space. This can be used for individual targets (``check-ompt``,
|
||||
``check-ompt-multiplex``, ``check-libarcher``, ``check-libomp`` and
|
||||
``check-libomptarget-*``) too. Note that each test still overrides
|
||||
environment variables if needed. For example, to change barrier pattern to be
|
||||
used from default hyper barrier to hierarchical barrier, run:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ CHECK_OPENMP_ENV="KMP_PLAIN_BARRIER_PATTERN=hier,hier KMP_FORKJOIN_BARRIER_PATTERN=hier,hier KMP_REDUCTION_BARRIER_PATTERN=hier,hier" make check-openmp
|
||||
|
@ -35,6 +35,14 @@ if 'LIBOMPTARGET_LOCK_MAPPED_HOST_BUFFERS' in os.environ:
|
||||
if 'OMP_TARGET_OFFLOAD' in os.environ:
|
||||
config.environment['OMP_TARGET_OFFLOAD'] = os.environ['OMP_TARGET_OFFLOAD']
|
||||
|
||||
# set default environment variables for test
|
||||
if 'CHECK_OPENMP_ENV' in os.environ:
|
||||
test_env = os.environ['CHECK_OPENMP_ENV'].split()
|
||||
for env in test_env:
|
||||
name = env.split('=')[0]
|
||||
value = env.split('=')[1]
|
||||
config.environment[name] = value
|
||||
|
||||
def append_dynamic_library_path(name, value, sep):
|
||||
if name in config.environment:
|
||||
config.environment[name] = value + sep + config.environment[name]
|
||||
|
@ -134,6 +134,14 @@ except NotImplementedError:
|
||||
if 'INTEL_LICENSE_FILE' in os.environ:
|
||||
config.environment['INTEL_LICENSE_FILE'] = os.environ['INTEL_LICENSE_FILE']
|
||||
|
||||
# set default environment variables for test
|
||||
if 'CHECK_OPENMP_ENV' in os.environ:
|
||||
test_env = os.environ['CHECK_OPENMP_ENV'].split()
|
||||
for env in test_env:
|
||||
name = env.split('=')[0]
|
||||
value = env.split('=')[1]
|
||||
config.environment[name] = value
|
||||
|
||||
# substitutions
|
||||
config.substitutions.append(("%libomp-compile-and-run", \
|
||||
"%libomp-compile && %libomp-run"))
|
||||
|
@ -90,6 +90,14 @@ if config.has_tsan == True:
|
||||
if 'INTEL_LICENSE_FILE' in os.environ:
|
||||
config.environment['INTEL_LICENSE_FILE'] = os.environ['INTEL_LICENSE_FILE']
|
||||
|
||||
# set default environment variables for test
|
||||
if 'CHECK_OPENMP_ENV' in os.environ:
|
||||
test_env = os.environ['CHECK_OPENMP_ENV'].split()
|
||||
for env in test_env:
|
||||
name = env.split('=')[0]
|
||||
value = env.split('=')[1]
|
||||
config.environment[name] = value
|
||||
|
||||
config.environment['ARCHER_OPTIONS'] = "report_data_leak=1"
|
||||
|
||||
# Race Tests
|
||||
|
@ -54,6 +54,14 @@ config.test_flags = " -I " + config.test_source_root + "/.."\
|
||||
if 'INTEL_LICENSE_FILE' in os.environ:
|
||||
config.environment['INTEL_LICENSE_FILE'] = os.environ['INTEL_LICENSE_FILE']
|
||||
|
||||
# set default environment variables for test
|
||||
if 'CHECK_OPENMP_ENV' in os.environ:
|
||||
test_env = os.environ['CHECK_OPENMP_ENV'].split()
|
||||
for env in test_env:
|
||||
name = env.split('=')[0]
|
||||
value = env.split('=')[1]
|
||||
config.environment[name] = value
|
||||
|
||||
# Allow XFAIL to work
|
||||
config.target_triple = [ ]
|
||||
for feature in config.test_compiler_features:
|
||||
|
Loading…
x
Reference in New Issue
Block a user