[openmp] [test] Set __COMPAT_LAYER=RunAsInvoker when running tests on Windows
authorMartin Storsjö <martin@martin.st>
Sat, 5 Nov 2022 19:54:37 +0000 (21:54 +0200)
committerMartin Storsjö <martin@martin.st>
Mon, 28 Nov 2022 20:40:01 +0000 (22:40 +0200)
Windows heuristics may decide to want to run some tested processes
as elevated (since it may think some of them are installers - executables
with "dispatch" in the name may hit a heuristic looking for "patch").

Set this environment variable to disable this heuristic and just run
the executable with whatever privileges the caller has.

This fixes a couple tests on such versions of Windows where this
heuristic is active.

Differential Revision: https://reviews.llvm.org/D137772

openmp/runtime/test/lit.cfg

index 6660150..c1cf24a 100644 (file)
@@ -111,6 +111,14 @@ if config.operating_system in ['Linux', 'Windows']:
 if config.operating_system in ['Linux']:
     config.available_features.add('hidden-helper')
 
+# Avoid Windows heuristics which try to detect potential installer programs
+# (which may need to run with elevated privileges) and ask if the user wants
+# to run them in that way. This heuristic may match for executables containing
+# the word "patch" which is a substring of "dispatch". Set an environment
+# variable indicating that we want to execute them with the current user.
+if config.operating_system == 'Windows':
+    config.environment['__COMPAT_LAYER'] = 'RunAsInvoker'
+
 import multiprocessing
 try:
     if multiprocessing.cpu_count() > 1: