This repository has been archived by the owner on Nov 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Intermittent checkin - Build helper projects
- Loading branch information
Showing
3 changed files
with
167 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This is the Unix equivalent of build-and-run-test.cmd | ||
# It is invoked by each test's bash script. The reason it's called corerun is that | ||
# the unix CoreCLR tests don't have a custom runner override environment variable. | ||
# See issue https://github.com/dotnet/coreclr/issues/9007 | ||
# The CoreFX alternative is named corerun to keep parity with CoreCLR's testing infrastructure | ||
|
||
#!/usr/bin/env bash | ||
|
||
# This is the Unix equivalent of build-and-run-test.cmd | ||
# It is invoked by each test's bash script. The reason it's called corerun is that | ||
# the unix CoreCLR tests don't have a custom runner override environment variable. | ||
# See issue https://github.com/dotnet/coreclr/issues/9007 | ||
|
||
export TestExecutable=$1 | ||
export TestFileName=${TestExecutable%.*} | ||
|
||
source "$CoreRT_TestRoot/coredump_handling.sh" | ||
|
||
if [[ $CoreRT_EnableCoreDumps == 1 ]]; then | ||
set_up_core_dump_generation | ||
fi | ||
|
||
cp -ar $CoreRT_TestRoot/CoreCLR/. . | ||
|
||
# Workaround until we have a better reflection engine | ||
# Add name of currently executing test to rd.xml | ||
|
||
$__dotnetclipath/dotnet publish | ||
|
||
|
||
__msbuild_dir=${CoreRT_TestRoot}/../Tools | ||
echo ${__msbuild_dir}/msbuild.sh /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} Test.csproj | ||
${__msbuild_dir}/msbuild.sh /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} Test.csproj | ||
|
||
if [[ $CoreRT_EnableCoreDumps == 1 ]]; then | ||
# Handle any core files generated when running the test IL through the toolchain. | ||
inspect_and_delete_core_files $CoreRT_ToolchainDir/corerun "$CoreRT_ToolchainDir" | ||
fi | ||
|
||
# Remove the test executable from the arg list so it isn't passed to test execution | ||
shift | ||
|
||
testExtRepo=$( dirname ${CoreRT_TestRoot} )/tests_downloaded/CoreCLR/ | ||
nativeArtifactRepo=${testExtRepo}native/ | ||
dirSuffix=$(dirname ${PWD#$testExtRepo})/ | ||
nativeDir=${nativeArtifactRepo}tests/src/${dirSuffix} | ||
|
||
# In OSX we copy the native component to the directory where the exectuable resides. | ||
# However, in Linux dlopen doesn't seem to look for current directory to resolve the dynamic library. | ||
# So instead we point LD_LIBRARY_PATH to the directory where the native component is. | ||
if [ -e ${nativeDir} ]; then | ||
if [ "${CoreRT_BuildOS}" == "OSX" ]; then | ||
echo "Copying native component from :"${nativeDir} | ||
cp ${nativeDir}*.dylib native/ 2>/dev/null | ||
fi | ||
if [ "${CoreRT_BuildOS}" == "Linux" ]; then | ||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${nativeDir} | ||
export LD_LIBRARY_PATH | ||
fi | ||
fi | ||
|
||
if [[ ! -f native/${TestFileName} ]]; then | ||
echo "ERROR: Native binary not found. Unable to run test." | ||
exit -1 | ||
fi | ||
|
||
pushd native/ | ||
./${TestFileName} "$@" | ||
testScriptExitCode=$? | ||
popd | ||
|
||
if [[ $CoreRT_EnableCoreDumps == 1 ]]; then | ||
# Handle any core files generated when running the test. | ||
inspect_and_delete_core_files native/$TestFileName "$CoreRT_ToolchainDir" | ||
fi | ||
|
||
# Clean up test binary artifacts to save space | ||
rm -r native 2>/dev/null | ||
|
||
exit $testScriptExitCode |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters