Fix tests for unix.

This commit is contained in:
Sridhar Periyasamy 2016-02-12 14:38:37 -08:00 committed by DDCloud
parent 96e425f8bb
commit 5fb1eaa9c6
2 changed files with 42 additions and 9 deletions

View file

@ -17,11 +17,29 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../../common/_common.sh" source "$DIR/../../common/_common.sh"
mkdir -p "$TEST_PACKAGE_DIR" buildTestPackages() {
mkdir -p "$TEST_PACKAGE_DIR"
PROJECTS=$(loadTestPackageList) PROJECTS=$(loadTestPackageList)
for project in $PROJECTS for project in $PROJECTS
do do
dotnet pack "$REPOROOT/TestAssets/TestPackages/$project" --output "$TEST_PACKAGE_DIR" dotnet pack "$REPOROOT/TestAssets/TestPackages/$project" --output "$TEST_PACKAGE_DIR"
done done
}
buildTestProjects() {
testProjectsRoot="$REPOROOT/TestAssets/TestProjects"
exclusionList=( "$testProjectsRoot/CompileFail/project.json" )
testProjectsList=( $(find $testProjectsRoot -name "project.json") )
for project in "${testProjectsList[@]}"
do
if [[ "${exclusionList[@]}" != "${project}" ]]; then
dotnet build "$project" --framework dnxcore50
fi
done
}
buildTestPackages
buildTestProjects

View file

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
namespace Microsoft.DotNet.TestFramework namespace Microsoft.DotNet.TestFramework
{ {
@ -66,7 +66,9 @@ namespace Microsoft.DotNet.TestFramework
foreach (string srcFile in sourceFiles) foreach (string srcFile in sourceFiles)
{ {
File.Copy(srcFile, srcFile.Replace(_testAssetRoot, _testDestination), true); string destFile = srcFile.Replace(_testAssetRoot, _testDestination);
File.Copy(srcFile, destFile, true);
FixTimeStamp(srcFile, destFile);
} }
} }
@ -76,6 +78,7 @@ namespace Microsoft.DotNet.TestFramework
{ {
string destinationLockFile = lockFile.Replace(_testAssetRoot, _testDestination); string destinationLockFile = lockFile.Replace(_testAssetRoot, _testDestination);
File.Copy(lockFile, destinationLockFile, true); File.Copy(lockFile, destinationLockFile, true);
FixTimeStamp(lockFile, destinationLockFile);
} }
return this; return this;
@ -108,7 +111,9 @@ namespace Microsoft.DotNet.TestFramework
foreach (string binFile in binFiles) foreach (string binFile in binFiles)
{ {
File.Copy(binFile, binFile.Replace(_testAssetRoot, _testDestination), true); string destFile = binFile.Replace(_testAssetRoot, _testDestination);
File.Copy(binFile, destFile, true);
FixTimeStamp(binFile, destFile);
} }
return this; return this;
@ -118,5 +123,15 @@ namespace Microsoft.DotNet.TestFramework
{ {
get { return _testDestination; } get { return _testDestination; }
} }
private static void FixTimeStamp(string originalFile, string newFile)
{
// workaround for https://github.com/dotnet/corefx/issues/6083
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
var originalTime = File.GetLastWriteTime(originalFile);
File.SetLastWriteTime(newFile, originalTime);
}
}
} }
} }