Fix tests for unix.
This commit is contained in:
parent
96e425f8bb
commit
5fb1eaa9c6
2 changed files with 42 additions and 9 deletions
|
@ -17,11 +17,29 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
|||
|
||||
source "$DIR/../../common/_common.sh"
|
||||
|
||||
mkdir -p "$TEST_PACKAGE_DIR"
|
||||
buildTestPackages() {
|
||||
mkdir -p "$TEST_PACKAGE_DIR"
|
||||
|
||||
PROJECTS=$(loadTestPackageList)
|
||||
PROJECTS=$(loadTestPackageList)
|
||||
|
||||
for project in $PROJECTS
|
||||
do
|
||||
dotnet pack "$REPOROOT/TestAssets/TestPackages/$project" --output "$TEST_PACKAGE_DIR"
|
||||
done
|
||||
for project in $PROJECTS
|
||||
do
|
||||
dotnet pack "$REPOROOT/TestAssets/TestPackages/$project" --output "$TEST_PACKAGE_DIR"
|
||||
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
|
||||
|
|
|
@ -5,7 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.DotNet.TestFramework
|
||||
{
|
||||
|
@ -66,7 +66,9 @@ namespace Microsoft.DotNet.TestFramework
|
|||
|
||||
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);
|
||||
File.Copy(lockFile, destinationLockFile, true);
|
||||
FixTimeStamp(lockFile, destinationLockFile);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -108,7 +111,9 @@ namespace Microsoft.DotNet.TestFramework
|
|||
|
||||
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;
|
||||
|
@ -118,5 +123,15 @@ namespace Microsoft.DotNet.TestFramework
|
|||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue