[Openmp-commits] [PATCH] D122645: [OpenMP][NFC] lit: Allow setting default environment variables for test

Misono Tomohiro via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 29 05:47:27 PDT 2022


t-msn created this revision.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
t-msn edited the summary of this revision.
t-msn added a reviewer: AndreyChurbanov.
t-msn added a project: OpenMP.
t-msn removed a project: All.
Herald added a project: All.
t-msn published this revision for review.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.

Add LIBOMP_TEST_ENV environment variable which will be passed to environment
variables for test. This provides a handy way to exercise various openmp code
with different settings during development.

For example, to change default barrier pattern:

  $ env LIBOMP_TEST_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 envionment variables if needed
as before.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122645

Files:
  openmp/runtime/test/lit.cfg


Index: openmp/runtime/test/lit.cfg
===================================================================
--- openmp/runtime/test/lit.cfg
+++ 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 'LIBOMP_TEST_ENV' in os.environ:
+    test_env = os.environ['LIBOMP_TEST_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"))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122645.418839.patch
Type: text/x-patch
Size: 703 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220329/1ffb1d12/attachment.bin>


More information about the Openmp-commits mailing list