On 11/03/2017 09:06 AM, Jose Fonseca wrote:
On 27/10/17 17:12, Brian Paul wrote:
On Windows10 (and possibly older versions), UAC (User Account Control)
intervenes when starting an executables with "patch", "update" or "setup"
in their name. This requires the user to approve execution by clicking
in a dialog window (and even then, causes test failures). With Cygwin,
you simply get "Permission Denied".
Currently, there are four Piglit tests which need this special treatment:
bin/arb_compute_shader-zero-dispatch-size
bin/arb_tessellation_shader-invalid-patch-vertices-range
bin/glsl-uniform-update
bin/mipmap-setup
A work-around is to create a manifest file for each effected executable.
This patch creates a <foo>.exe.manifest file if "foo" contains any of
the above strings. There's no effect on non-Windows platforms.
Note: this solution uses the cmake file(GENERATE ...) function. I think
add_custom_command() is probably the proper approach, but I've been
unsuccessful in getting that to work.
---
cmake/piglit_util.cmake | 30 ++++++++++++++++++++++++++++++
cmake/win10-manifest.txt | 12 ++++++++++++
2 files changed, 42 insertions(+)
create mode 100644 cmake/win10-manifest.txt
diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake
index 411fa54..9b85761 100644
--- a/cmake/piglit_util.cmake
+++ b/cmake/piglit_util.cmake
@@ -58,6 +58,8 @@ endfunction(piglit_include_target_api)
#
function(piglit_add_executable name)
+ piglit_create_manifest_file(${name})
+
list(REMOVE_AT ARGV 0)
add_executable(${name} ${ARGV})
add_dependencies(${name} piglit_dispatch_gen)
@@ -89,3 +91,31 @@ function(piglit_add_library name)
endif() >
endfunction(piglit_add_library)
+
+
+# This is lame, but Windows 10 (and maybe Win8) asks for confirmation
+# before running .exe files containing the strings "patch", "setup",
+# "update", etc. In Cygwin, we simply get "Permission Denied".
+# This causes the Piglit test to fail.
+# The work-around is to create a "manifest" file for such executables.
+# This function examines the target name and creates the manifest file
+# if needed. The file will be named "${target}.exe.manifest".
+# See
https://answers.microsoft.com/en-us/windows/forum/windows_7-security/uac-prompts-on-any-program-with-the-word-patch-or/c5359497-d16e-43c6-99f2-db3d8eecc9c0?auth=1
+function(piglit_create_manifest_file target)
+ if (WIN32)
+ # look for known strings
+ string(FIND ${target} "patch" r1)
+ string(FIND ${target} "setup" r2)
+ string(FIND ${target} "update" r3)
+
+ # if any of those strings is in the target filename
+ if((${r1} GREATER -1) OR (${r2} GREATER -1) OR (${r3} GREATER -1))
+ # XXX we should probably use add_custom_command() here to copy
+ # the manifest file, but I've been unsuccessful in getting
+ # that to work.
+ file(GENERATE
+ OUTPUT bin/${target}.exe.manifest
+ INPUT ${CMAKE_SOURCE_DIR}/cmake/win10-manifest.txt)
Neat. I hadn't realized the manifest files could exist as free standing
.exe.manifest files (I presumed one would always have to build)
I think you'll need to add a
install (FILES bin/${target}.exe.manifest DESTINATION
${PIGLIT_INSTALL_LIBDIR}/bin)
inside piglit_add_executable() macro, so that the manifest files get
copied and installed
I think things would probably get easier to do this if you merged
piglit_create_manifest_file macro into the piglit_add_executable macro
body.
OK I tinkered with this for a few hours without luck. I get cmake
errors like:
% cmake
[...]
-- Configuring done
CMake Error in tests/shaders/CMakeLists.txt:
Evaluation file "bin/glsl-uniform-update.exe.manifest" cannot be written.
My cmake skills are pretty weak and googling hasn't given me any tips.
-Brian
_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit