[Piglit] [PATCH] cmake: create Win10 manifest files for particular executables
Jose Fonseca
jfonseca at vmware.com
Fri Nov 3 15:06:11 UTC 2017
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.
Jose
> + endif()
> + endif()
> +endfunction(piglit_create_manifest_file)
> diff --git a/cmake/win10-manifest.txt b/cmake/win10-manifest.txt
> new file mode 100644
> index 0000000..5abd234
> --- /dev/null
> +++ b/cmake/win10-manifest.txt
> @@ -0,0 +1,12 @@
> +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
> + <security>
> + <requestedPrivileges>
> + <!-- Make sure that UAC believes
> + that it does not require administrative privilege -->
> + <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
> + </requestedPrivileges>
> + </security>
> + </trustInfo>
> +</assembly>
>
More information about the Piglit
mailing list