diff --git a/openmp/README.rst b/openmp/README.rst --- a/openmp/README.rst +++ b/openmp/README.rst @@ -357,3 +357,35 @@ **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 `_ 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 diff --git a/openmp/libomptarget/test/lit.cfg b/openmp/libomptarget/test/lit.cfg --- a/openmp/libomptarget/test/lit.cfg +++ b/openmp/libomptarget/test/lit.cfg @@ -24,6 +24,14 @@ 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] diff --git a/openmp/runtime/test/lit.cfg b/openmp/runtime/test/lit.cfg --- a/openmp/runtime/test/lit.cfg +++ b/openmp/runtime/test/lit.cfg @@ -116,6 +116,14 @@ 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")) diff --git a/openmp/tools/archer/tests/lit.cfg b/openmp/tools/archer/tests/lit.cfg --- a/openmp/tools/archer/tests/lit.cfg +++ b/openmp/tools/archer/tests/lit.cfg @@ -90,6 +90,14 @@ 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 diff --git a/openmp/tools/multiplex/tests/lit.cfg b/openmp/tools/multiplex/tests/lit.cfg --- a/openmp/tools/multiplex/tests/lit.cfg +++ b/openmp/tools/multiplex/tests/lit.cfg @@ -54,6 +54,14 @@ 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: