From 9dee791516284ded1808ba133a63385f38cfafb5 Mon Sep 17 00:00:00 2001 From: Francois Gouget <fgouget@free.fr> Date: Wed, 18 Nov 2015 14:58:53 +0100 Subject: [PATCH] cmd/tests: Use net session to verify we have sufficient privileges. Modifying the associations requires holding administrator+elevated privileges. 'net session' is the standard way of checking that in batch files. Signed-off-by: Francois Gouget <fgouget@free.fr> Signed-off-by: Alexandre Julliard <julliard@winehq.org> --- programs/cmd/tests/test_builtins.cmd | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index db286dbbffb..1bcd6554dfb 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -1950,6 +1950,10 @@ if exist baz\lala (echo file created in read-only dir) else echo file not create cd .. & rd /s/q foobar echo ------------ Testing assoc ------------ +rem Modifying associations requires some privileges... +net session >nul 2>&1 +if errorlevel 1 goto :SkipAssoc + rem FIXME Can't test error messages in the current test system, so we have to use some kludges rem FIXME Revise once || conditional execution is fixed mkdir foobar & cd foobar @@ -1978,8 +1982,25 @@ cmd /c tmp.cmd > baz type baz echo --- cd .. & rd /s/q foobar +goto ContinueFType +:SkipAssoc +echo --- setting association +echo --- +echo .foo=bar +echo .foo=bar +echo +++ +echo .foo=bar +echo --- resetting association +echo --- +echo +++ +echo --- + +:ContinueFType echo ------------ Testing ftype ------------ +rem Modifying associations requires some privileges... +net session >nul 2>&1 +if errorlevel 1 goto :SkipFType rem FIXME Can't test error messages in the current test system, so we have to use some kludges rem FIXME Revise once || conditional execution is fixed mkdir foobar & cd foobar @@ -2020,7 +2041,19 @@ regedit /s regCleanup.reg set WINE_FOO= endlocal cd .. & rd /s/q foobar +goto ContinueCall +:SkipFType +echo --- setting association +echo --- +echo footype=foo_opencmd +echo .foo=footype +echo footype=foo_opencmd +echo +++ +echo footype=foo_opencmd +echo --- resetting association +echo original value +:ContinueCall echo ------------ Testing CALL ------------ mkdir foobar & cd foobar echo --- external script -- GitLab