Skip to content

Commit

Permalink
Merge pull request dotnet#2125 from wtgodbe/macRunTest
Browse files Browse the repository at this point in the history
runtest.sh now works on Mac as well as Linux
  • Loading branch information
wtgodbe committed Dec 1, 2015
2 parents f1f3d1e + 69ea93d commit b3a45c0
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions tests/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ countSkippedTests=0
xunitOutputPath=
xunitTestOutputPath=

# libExtension determines extension for dynamic library files
OSName=$(uname -s)
libExtension=
case $OSName in
Linux)
libExtension="so"
;;

Darwin)
libExtension="dylib"
;;
*)
echo "Unsupported OS $OSName detected, configuring as if for Linux"
libExtension="so"
;;
esac


function xunit_output_begin {
xunitOutputPath=$testRootDir/coreclrtests.xml
xunitTestOutputPath=${xunitOutputPath}.test
Expand All @@ -86,7 +104,7 @@ function xunit_output_add_test {
local testResult=$3 # Pass, Fail, or Skip
local testScriptExitCode=$4

local testPath=${scriptFilePath:0:(-3)} # Remove trailing ".sh"
local testPath=${scriptFilePath%.sh} # Remove trailing ".sh"
local testDir=$(dirname "$testPath")
local testName=$(basename "$testPath")

Expand Down Expand Up @@ -311,8 +329,10 @@ function create_core_overlay {
rm -f -r "$coreOverlayDir"
fi
mkdir "$coreOverlayDir"
(cd $coreFxBinDir && find . -iname '*.dll' \! -iwholename '*test*' \! -iwholename '*/ToolRuntime/*' -exec cp -f -u '{}' "$coreOverlayDir/" \;)
cp -f "$coreFxNativeBinDir/Native/"*.so "$coreOverlayDir/" 2>/dev/null

(cd $coreFxBinDir && find . -iname '*.dll' \! -iwholename '*test*' \! -iwholename '*/ToolRuntime/*' -exec cp -f '{}' "$coreOverlayDir/" \;)
cp -f "$coreFxNativeBinDir/Native/"*."$libExtension" "$coreOverlayDir/" 2>/dev/null

cp -f "$coreClrBinDir/"* "$coreOverlayDir/" 2>/dev/null
cp -f "$mscorlibDir/mscorlib.dll" "$coreOverlayDir/"
cp -n "$testDependenciesDir"/* "$coreOverlayDir/" 2>/dev/null
Expand All @@ -333,7 +353,7 @@ function copy_test_native_bin_to_test_root {
fi

# Copy native test components from the native test build into the respective test directory in the test root directory
find "$testNativeBinDir" -type f -iname '*.so' |
find "$testNativeBinDir" -type f -iname '*.$libExtension' |
while IFS='' read -r filePath || [ -n "$filePath" ]; do
local dirPath=$(dirname "$filePath")
local destinationDirPath=${testRootDir}${dirPath:${#testNativeBinDir}}
Expand Down Expand Up @@ -418,8 +438,8 @@ function run_test {
local outputFileName=$(basename "$outputFilePath")

# Convert DOS line endings to Unix if needed
sed -i 's/\r$//' "$scriptFileName"

perl -pi -e 's/\r\n|\n|\r/\n/g' "$scriptFileName"
# Add executable file mode bit if needed
chmod +x "$scriptFileName"

Expand Down

0 comments on commit b3a45c0

Please sign in to comment.