ClrSleepEx(g_pConfig->StartupDelayMS(), FALSE);
}
#endif
-
+
#if USE_DISASSEMBLER
if ((g_pConfig->GetGCStressLevel() & (EEConfig::GCSTRESS_INSTR_JIT | EEConfig::GCSTRESS_INSTR_NGEN)) != 0)
{
Disassembler::StaticInitialize();
if (!Disassembler::IsAvailable())
{
-#ifdef HAVE_GCCOVER
-#ifdef _DEBUG
- printf("External disassembler is not available. Disabling GCStress for GCSTRESS_INSTR_JIT and GCSTRESS_INSTR_NGEN.\n");
-#endif // _DEBUG
- g_pConfig->SetGCStressLevel(
- g_pConfig->GetGCStressLevel() & ~(EEConfig::GCSTRESS_INSTR_JIT | EEConfig::GCSTRESS_INSTR_NGEN));
-#endif // HAVE_GCCOVER
+ fprintf(stderr, "External disassembler is not available.\n");
+ IfFailGo(E_FAIL);
}
}
#endif // USE_DISASSEMBLER
#endif // USE_COREDISTOOLS_DISASSEMBLER
}
-// static
void Disassembler::StaticInitialize()
{
LIMITED_METHOD_CONTRACT;
#if USE_COREDISTOOLS_DISASSEMBLER
_ASSERTE(!IsAvailable());
- // TODO: The 'coredistools' library will eventually be part of a NuGet package, need to be able to load
- // that using appropriate search paths
- LPCWSTR libraryName = MAKEDLLNAME(W("coredistools"));
- HMODULE libraryHandle = CLRLoadLibrary(libraryName);
+ HMODULE libraryHandle = nullptr;
+ PathString libPath;
+ DWORD result = WszGetModuleFileName(nullptr, libPath);
+ if (result == 0) {
+#ifdef _DEBUG
+ wprintf(
+ W("GetModuleFileName failed, function 'DisasmInstruction': error %u\n"),
+ GetLastError());
+#endif // _DEBUG
+ return;
+ }
+
+#if defined(FEATURE_PAL)
+ WCHAR delim = W('/');
+#else
+ WCHAR delim = W('\\');
+#endif
+ LPCWSTR libFileName = MAKEDLLNAME(W("coredistools"));
+ PathString::Iterator iter = libPath.End();
+ if (libPath.FindBack(iter, delim)) {
+ libPath.Truncate(++iter);
+ libPath.Append(libFileName);
+ }
+ else {
+ _ASSERTE(!"unreachable");
+ }
+
+ LPCWSTR libraryName = libPath.GetUnicode();
+ libraryHandle = CLRLoadLibrary(libraryName);
do
{
if (libraryHandle == nullptr)
return;
} while (false);
- CLRFreeLibrary(libraryHandle);
_ASSERTE(!IsAvailable());
+
#endif // USE_COREDISTOOLS_DISASSEMBLER
}
load_unsupported_tests
load_failing_tests
+if [ -n "$COMPlus_GCStress" ]; then
+ scriptPath=$(dirname $0)
+ ${scriptPath}/setup-gcstress.sh --outputDir=$coreOverlayDir
+ if [ $? -ne 0 ]
+ then
+ echo 'Failed to download coredistools library'
+ exit $EXIT_CODE_EXCEPTION
+ fi
+fi
-
cd "$testRootDir"
if [ -z "$testDirectories" ]
then
exit $EXIT_CODE_TEST_FAILURE
fi
-exit $EXIT_CODE_SUCCESS
\ No newline at end of file
+exit $EXIT_CODE_SUCCESS
--- /dev/null
+#!/usr/bin/env bash
+
+#
+# This script should be located in coreclr/tests.
+#
+
+function print_usage {
+ echo ''
+ echo 'Download coredistool for GC stress testing'
+ echo ''
+ echo 'Command line:'
+ echo ''
+ echo './setup-gcstress.sh --outputDir=<coredistools_lib_install_path>'
+ echo ''
+ echo 'Required arguments:'
+ echo ' --outputDir=<path> : Directory to install libcoredistools.so'
+ echo ''
+}
+
+# Argument variables
+libInstallDir=
+
+# Handle arguments
+verbose=0
+for i in "$@"
+do
+ case $i in
+ -h|--help)
+ exit $EXIT_CODE_SUCCESS
+ ;;
+ -v|--verbose)
+ verbose=1
+ ;;
+ --outputDir=*)
+ libInstallDir=${i#*=}
+ ;;
+ *)
+ echo "Unknown switch: $i"
+ print_usage
+ exit $EXIT_CODE_SUCCESS
+ ;;
+ esac
+done
+
+if [ -z "$libInstallDir" ]; then
+ echo "--libInstallDir is required."
+ print_usage
+ exit $EXIT_CODE_EXCEPTION
+fi
+
+# This script must be located in coreclr/tests.
+scriptDir=$(cd "$(dirname "$0")"; pwd -P)
+dotnetToolsDir=$scriptDir/../Tools
+dotnetCmd=${dotnetToolsDir}/dotnetcli/bin/dotnet
+packageDir=${scriptDir}/../packages
+jsonFilePath=${scriptDir}/project.json
+
+# Check tool directory
+if [ ! -e $dotnetToolsDir ]; then
+ echo 'Directory containing dotnet commandline does not exist:' $dotnetToolsDir
+ exit 1
+fi
+if [ ! -e $dotnetCmd ]; then
+ echo 'donet commandline does not exist:' $dotnetCmd
+ exit 1
+fi
+
+# make package directory
+if [ ! -e $packageDir ]; then
+ mkdir -p $packageDir
+fi
+
+# make output directory
+if [ ! -e $libInstallDir ]; then
+ mkdir -p $libInstallDir
+fi
+
+# Write dependency information to project.json
+echo { \
+ \"dependencies\": { \
+ \"Microsoft.NETCore.CoreDisTools\": \"1.0.0-prerelease-00001\" \
+ }, \
+ \"frameworks\": { \"dnxcore50\": { } } \
+ } > $jsonFilePath
+
+# Find runtime id
+rid=`$dotnetCmd --version | grep 'Runtime Id:' | sed 's/^ *Runtime Id: *//g'`
+
+# Download the package
+echo Downloading CoreDisTools package
+bash -c -x "$dotnetCmd restore $jsonFilePath --source https://dotnet.myget.org/F/dotnet-core/ --packages $packageDir --runtime $rid"
+
+# Get library path
+libPath=`find $packageDir | grep $rid | grep -m 1 libcoredistools`
+if [ ! -e $libPath ]; then
+ echo 'Failed to locate the downloaded library'
+ exit 1
+fi
+
+# Copy library to output directory
+echo 'Copy library:' $libPath '-->' $libInstallDir/
+cp -f $libPath $libInstallDir
+
+# Delete temporary files
+rm -rf $jsonFilePath
+
+# Return success
+exit 0
+