[PATCH] D148988: [asan][test][win] Set __COMPAT_LAYER=RunAsInvoker when running tests

Alvin Wong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 22 06:23:59 PDT 2023


alvinhochun created this revision.
alvinhochun added reviewers: vitalybuka, mstorsjo.
Herald added a subscriber: Enna1.
Herald added a project: All.
alvinhochun requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

The `TestCases/asan_update_allocation.cpp` test on i686 MinGW target
happens to trigger a heuristic on Windows which makes it want to run as
elevated, probably because its name contains "update". This makes the
test fail when not running with elevated privileges.

Setting this environment variable tells Windows to ignore the
requirement to run as elevated, allowing the test to pass. This is the
same approach taken in https://reviews.llvm.org/D137772.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148988

Files:
  compiler-rt/test/asan/lit.cfg.py


Index: compiler-rt/test/asan/lit.cfg.py
===================================================================
--- compiler-rt/test/asan/lit.cfg.py
+++ compiler-rt/test/asan/lit.cfg.py
@@ -259,3 +259,12 @@
 
 if config.host_os == 'NetBSD':
   config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix))
+
+# 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 "update", e.g. `TestCases/asan_update_allocation.cpp`. Set an
+# environment variable indicating that we want to execute them with the current
+# user.
+if config.host_os == 'Windows':
+    config.environment['__COMPAT_LAYER'] = 'RunAsInvoker'


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148988.516063.patch
Type: text/x-patch
Size: 803 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230422/24cafd6a/attachment.bin>


More information about the llvm-commits mailing list