blob: 8b79097d1a5e2d75586888d1950c4e3d1153858e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#!/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 $CoreRT_TestRoot/CoreCLR/Test.csproj .
__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
|