summaryrefslogtreecommitdiff
path: root/tests/debugger_tests/ConfigFilesGenerators
diff options
context:
space:
mode:
Diffstat (limited to 'tests/debugger_tests/ConfigFilesGenerators')
-rw-r--r--tests/debugger_tests/ConfigFilesGenerators/ConfigTemplate.txt32
-rw-r--r--tests/debugger_tests/ConfigFilesGenerators/GenerateConfig.cmd53
-rw-r--r--tests/debugger_tests/ConfigFilesGenerators/GenerateConfig.sh65
3 files changed, 150 insertions, 0 deletions
diff --git a/tests/debugger_tests/ConfigFilesGenerators/ConfigTemplate.txt b/tests/debugger_tests/ConfigFilesGenerators/ConfigTemplate.txt
new file mode 100644
index 0000000000..d674a72698
--- /dev/null
+++ b/tests/debugger_tests/ConfigFilesGenerators/ConfigTemplate.txt
@@ -0,0 +1,32 @@
+<Configuration>
+ <TestRoot>..\..</TestRoot>
+ <TargetArchitecture>x64</TargetArchitecture>
+ <ScriptRootDir>$(TestRoot)\Scripts</ScriptRootDir>
+ <DebuggeeRootDir>$(TestRoot)\Debuggees</DebuggeeRootDir>
+ <DebuggeeSourceRoot>$(DebuggeeRootDir)\Source</DebuggeeSourceRoot>
+ <RuntimeRoot>##Insert_Runtime_Root##</RuntimeRoot>
+ <NugetCacheRoot>##Insert_Nuget_Cache_Root##</NugetCacheRoot>
+ <TestProduct>ProjectK</TestProduct>
+ <HostExe>$(RuntimeRoot)\corerun.exe</HostExe>
+ <DbgShim>$(RuntimeRoot)\dbgshim.dll</DbgShim>
+ <RuntimeSymbolsPath>$(RuntimeRoot)</RuntimeSymbolsPath>
+ <DebuggeeBuildProcess>cli</DebuggeeBuildProcess>
+ <CliVersion>1.0.0-preview1-002702</CliVersion>
+ <DebuggeeNativeLibRoot>$(DebuggeeRootDir)\native</DebuggeeNativeLibRoot>
+ <DebuggeeBuildRoot>$(DebuggeeRootDir)\dotnet.$(CliVersion)</DebuggeeBuildRoot>
+ <ProjectJsonNetStandardLibraryVersion>1.0.0-rc2-23811</ProjectJsonNetStandardLibraryVersion>
+ <ProjectJsonSystemThreadingThreadVersion>4.0.0-rc2-24027</ProjectJsonSystemThreadingThreadVersion>
+ <ProjectJsonMicrosoftCSharpVersion>4.0.1-rc2-23811</ProjectJsonMicrosoftCSharpVersion>
+ <CliPath>##Cli_Path##</CliPath>
+ <NuGetPackageCacheDir>$(NugetCacheRoot)</NuGetPackageCacheDir>
+ <NuGetPackageFeeds>
+ myget.org dotnet-core=https://dotnet.myget.org/F/dotnet-core/api/v3/index.json;
+ myget.org=https://www.nuget.org/api/v2/
+ </NuGetPackageFeeds>
+ <SOSPath>$(RuntimeRoot)\sos.dll</SOSPath>
+ <MDbgDir>$(TestRoot)\mdbg</MDbgDir>
+ <DebuggeeDumpOutputRootDir>$(WorkingDir)\dumps\$(TestProduct)</DebuggeeDumpOutputRootDir>
+ <DebuggeeDumpInputRootDir>$(DebuggeeDumpOutputRootDir)</DebuggeeDumpInputRootDir>
+ <LogDir>$(TestRoot)\logs_$(Timestamp)</LogDir>
+ <CDBPath>$(TestRoot)\Debuggers\cdb\cdb.exe</CDBPath>
+</Configuration>
diff --git a/tests/debugger_tests/ConfigFilesGenerators/GenerateConfig.cmd b/tests/debugger_tests/ConfigFilesGenerators/GenerateConfig.cmd
new file mode 100644
index 0000000000..635df958c6
--- /dev/null
+++ b/tests/debugger_tests/ConfigFilesGenerators/GenerateConfig.cmd
@@ -0,0 +1,53 @@
+@echo off
+setlocal EnableDelayedExpansion
+
+:: Set the default arguments for script generation.
+set __RuntimeRoot=`$(TestRoot)\Runtimes\Coreclr1
+set __NugetCacheDir=`$(WorkingDir)\packages
+set __CliPath=
+set __ConfigFileName=Debugger.Tests.Config.txt
+set __TemplateFileName=%~dp0\ConfigTemplate.txt
+
+:Arg_Loop
+if "%1" == "" goto ArgsDone
+if /i "%1" == "/?" goto Usage
+
+if /i "%1" == "rt" (set "__RuntimeRoot=%2"&shift&shift&goto Arg_Loop)
+if /i "%1" == "nc" (set "__NugetCacheDir=%2"&shift&shift&goto Arg_Loop)
+if /i "%1" == "cli" (set "__CliPath=%2"&shift&shift&goto Arg_Loop)
+
+echo Invalid commandline argument: %1
+goto Usage
+
+:ArgsDone
+
+if not exist %__TemplateFileName% (
+ echo Template file %__TemplateFileName% doesn't exist.
+ exit /b 1
+)
+
+:: Delete previous config file.
+if exist %__ConfigFileName% (
+ echo Deleting current config file.
+ del %__ConfigFileName%
+)
+
+:: powershell "Get-Content %__TemplateFileName% -replace (""##Insert_Runtime_Root##"", ""%__RuntimeRoot%"") | Output-File %__ConfigFileName% "
+powershell "(Get-Content \"%__TemplateFileName%\")`"^
+ "-replace \"##Insert_Runtime_Root##\", \"%__RuntimeRoot%\" `"^
+ "|ForEach-Object{$_ -replace \"##Insert_Nuget_Cache_Root##\", \"%__NugetCacheDir%\"} `"^
+ "|ForEach-Object{$_ -replace \"##Cli_Path##\", \"%__CliPath%\"} `"^
+ "| Out-File \"%__ConfigFileName%\""
+
+exit /b 0
+
+:Usage
+echo.
+echo Usage:
+echo %0 [rt ^<runtime_path^>] [nc ^<nuget_cache_path^>] [cli ^<cli_path^>] where:
+echo.
+echo ^<runtime_path^>: path to the runtime that you want to use for testing.
+echo ^<nuget_cache_path^>: path to the nuget cache.
+echo ^<cli_path^>: path to the cli tool.
+exit /b 1
+endlocal
diff --git a/tests/debugger_tests/ConfigFilesGenerators/GenerateConfig.sh b/tests/debugger_tests/ConfigFilesGenerators/GenerateConfig.sh
new file mode 100644
index 0000000000..38834ed6a5
--- /dev/null
+++ b/tests/debugger_tests/ConfigFilesGenerators/GenerateConfig.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+function print_usage {
+ echo ''
+ echo 'Usage:'
+ echo '[rt=<runtime_path>] [nc=<nuget_cache_path>] [cli=<cli_path>] where:'
+ echo ' <runtime_path>: path to the runtime that you want to use for testing.'
+ echo ' <nuget_cache_path>: path to the nuget cache.'
+ echo ' <cli_path>: path to the cli tool.'
+ echo ''
+ echo ''
+}
+
+# Argument variables
+__RuntimeRoot='$(TestRoot)\Runtimes\Coreclr1'
+__NugetCacheDir='$(WorkingDir)\packages'
+__CliPath=
+__ConfigFileName='Debugger.Tests.Config.txt'
+__TemplateFileName='ConfigTemplate.txt'
+
+for i in "$@"
+do
+ case $i in
+ -h|--help)
+ print_usage
+ exit $EXIT_CODE_SUCCESS
+ ;;
+ rt=*)
+ __RuntimeRoot=${i#*=}
+ ;;
+ nc=*)
+ __NugetCacheDir=${i#*=}
+ ;;
+ cli=*)
+ __CliPath=${i#*=}
+ ;;
+ *)
+ echo "Unknown switch: $i"
+ print_usage
+ exit $EXIT_CODE_SUCCESS
+ ;;
+ esac
+done
+
+if ! -e "$__TemplateFileName"
+then
+ echo '$__TemplateFileName does not exist'
+ exit 1
+fi
+
+if -e "$__ConfigFileName"
+then
+ rm "$__ConfigFileName"
+fi
+
+cp "$__TemplateFileName" "$__ConfigFileName"
+
+sed -i \
+ 's/##Insert_Runtime_Root##/$__RuntimeRoot/g;' \
+ 's/##Insert_Nuget_Cache_Root##/$__NugetCacheDir/g'\
+ 's/##Cli_Path##/$__CliPath/g'\
+ 's/corerun.exe/corerun/g'\
+ "$__ConfigFileName"
+
+exit 0 \ No newline at end of file