diff options
author | Aditya Mandaleeka <adityam@microsoft.com> | 2015-09-15 16:20:55 -0700 |
---|---|---|
committer | Aditya Mandaleeka <adityam@microsoft.com> | 2015-09-15 16:20:55 -0700 |
commit | 093f4eeb4bb1dddec685b35bdc8ffcd6bc9cce86 (patch) | |
tree | 5c5e49b9b853b445a6176cc66cd8ddcd07365da9 | |
parent | 09cd6baa9399c80aaa6605e0702cde5f34f5bf6c (diff) | |
download | coreclr-093f4eeb4bb1dddec685b35bdc8ffcd6bc9cce86.tar.gz coreclr-093f4eeb4bb1dddec685b35bdc8ffcd6bc9cce86.tar.bz2 coreclr-093f4eeb4bb1dddec685b35bdc8ffcd6bc9cce86.zip |
Handle pre- and post-commands gracefully in bash execution scripts.
Existing tests can specify pre- or post-commands that are injected into
the execution scripts. However, today these are all using Windows syntax
so they break the bash scripts. We will handle that by skipping any tests
that are using pre- or post-commands unless they specify the bash-specific
equivalent. The scripts will continue to run and just exit with an exit
code that indicates a skip, so that the skipped tests are tracked and not
just hidden.
Also, this change moves the global pre-command that was being added for
running __TestEnv into the bash/batch targets rather than in the dir.props
file that is used for all platforms.
-rw-r--r-- | tests/src/CLRTest.Execute.Bash.targets | 40 | ||||
-rw-r--r-- | tests/src/CLRTest.Execute.Batch.targets | 4 | ||||
-rw-r--r-- | tests/src/dir.props | 5 |
3 files changed, 38 insertions, 11 deletions
diff --git a/tests/src/CLRTest.Execute.Bash.targets b/tests/src/CLRTest.Execute.Bash.targets index dc46efac01..72d3619e69 100644 --- a/tests/src/CLRTest.Execute.Bash.targets +++ b/tests/src/CLRTest.Execute.Bash.targets @@ -128,7 +128,23 @@ CLRTestExitCode=$? <GenerateParamList ArgumentItems="@(BashCLRTestExecutionScriptArgument)"> <Output TaskParameter="ParamList" PropertyName="_CLRTestParamList"/> </GenerateParamList> - + + <!-- If a test has precommands or postcommands but no bash-specific ones, + we will skip running that test. In order to enable the test on Unix, + the corresponding bash versions (_BashCLRTest[Pre|Post]Commands) of + the commands should be specified. --> + <PropertyGroup> + <ShouldSkipTest>false</ShouldSkipTest> + <ShouldSkipTest Condition="('$(_CLRTestPreCommands)' != '' AND '$(_BashCLRTestPreCommands)' == '') + OR ('$(_CLRTestPostCommands)' != '' AND '$(_BashCLRTestPostCommands)' == '')" + >true</ShouldSkipTest> + + <SkipTest> +echo "Skipping this test due to presence of pre- or post-commands that are not bash-specific." +exit 2 # Exit code indicating skip + </SkipTest> + </PropertyGroup> + <PropertyGroup> <!-- This generates the script portion to parse all of the command line arguments. @@ -166,18 +182,30 @@ done $(BashCLRTestArgPrep) ]]></BashCLRTestArgPrep> + + <_CLRTestExecutionScriptText Condition="$(ShouldSkipTest)"> + <![CDATA[ +$(SkipTest) + ]]> + </_CLRTestExecutionScriptText> + <!-- NOTE! semicolons must be escaped with %3B boooo --> - <_CLRTestExecutionScriptText><![CDATA[ + <_CLRTestExecutionScriptText Condition="!$(ShouldSkipTest)"> + <![CDATA[ +# The __TestEnv variable may be used to specify something to run before the test. +$__TestEnv + $(BashCLRTestArgPrep) $(BashCLRTestExitCodePrep) -# Precommands -$(_CLRTestPreCommands) +# PreCommands +$(_BashCLRTestPreCommands) # Launch $(BashCLRTestLaunchCmds) # PostCommands -$(_CLRTestPostCommands) +$(_BashCLRTestPostCommands) $(BashCLRTestExitCodeCheck) - ]]></_CLRTestExecutionScriptText> + ]]> + </_CLRTestExecutionScriptText> </PropertyGroup> diff --git a/tests/src/CLRTest.Execute.Batch.targets b/tests/src/CLRTest.Execute.Batch.targets index 808532a99c..d32feb2f8e 100644 --- a/tests/src/CLRTest.Execute.Batch.targets +++ b/tests/src/CLRTest.Execute.Batch.targets @@ -184,6 +184,10 @@ setlocal pushd %~dp0 $(BatchCLRTestArgPrep) $(BatchCLRTestExitCodePrep) + +REM The __TestEnv variable may be used to specify something to run before the test. +IF NOT "%__TestEnv%"=="" call %__TestEnv% + REM Precommands $(_CLRTestPreCommands) REM Launch diff --git a/tests/src/dir.props b/tests/src/dir.props index 1d46bcd8ee..725ed56a44 100644 --- a/tests/src/dir.props +++ b/tests/src/dir.props @@ -12,9 +12,4 @@ <GenerateAssemblyInfo>false</GenerateAssemblyInfo> </PropertyGroup> - <!-- Enable alternative JIT for testing if specified --> - <PropertyGroup> - <_CLRTestPreCommands>IF NOT "%__TestEnv%"=="" call %__TestEnv%</_CLRTestPreCommands> - </PropertyGroup> - </Project> |