From: Marco Rossignoli Date: Thu, 13 Sep 2018 20:48:20 +0000 (+0200) Subject: Add retry policy to ProfileOptimization test (dotnet/corefx#31810) X-Git-Tag: submit/tizen/20210909.063632~11031^2~3528 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be89c691169b2781a77833ef81df37d6463566ec;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Add retry policy to ProfileOptimization test (dotnet/corefx#31810) * add retry policy * add write test on profile file path location * address PR feedback * cleanup code Commit migrated from https://github.com/dotnet/corefx/commit/065bed2fb74ebed6798990e65b88e67c0b47429b --- diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Runtime/ProfileOptimization.netcoreapp.cs b/src/libraries/System.Runtime.Extensions/tests/System/Runtime/ProfileOptimization.netcoreapp.cs index 367a9df..91e4f51 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Runtime/ProfileOptimization.netcoreapp.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Runtime/ProfileOptimization.netcoreapp.cs @@ -5,22 +5,36 @@ using System.Diagnostics; using System.IO; using Xunit; +using Xunit.Abstractions; namespace System.Runtime.Tests { public class ProfileOptimizationTest : RemoteExecutorTestBase { + private readonly ITestOutputHelper _output; + + public ProfileOptimizationTest(ITestOutputHelper output) => _output = output; + [Fact] public void ProfileOptimization_CheckFileExists() { string tmpProfileFilePath = GetTestFileName(); + string tmpTestFileName = Path.Combine(Path.GetDirectoryName(tmpProfileFilePath), Path.GetRandomFileName()); + + _output.WriteLine($"We'll test write permission on path '{tmpTestFileName}'"); - RemoteInvoke(profileFilePath => + RemoteInvoke((profileFilePath, testFileName) => { + // after test fail tracked by https://github.com/dotnet/corefx/issues/31792 + // we suspect that the reason is something related to write permission to the location + // to prove that we added a simple write to file in same location of profile file directory path + // ProfileOptimization/Multi-Core JIT could fail silently + File.WriteAllText(testFileName, "42"); + ProfileOptimization.SetProfileRoot(Path.GetDirectoryName(profileFilePath)); ProfileOptimization.StartProfile(Path.GetFileName(profileFilePath)); - return 42; - }, tmpProfileFilePath).Dispose(); + + }, tmpProfileFilePath, tmpTestFileName).Dispose(); FileInfo fileInfo = new FileInfo(tmpProfileFilePath); Assert.True(fileInfo.Exists);