forked from Azure/azure-functions-host
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable JitTrace test in release branch (Azure#7508)
- Loading branch information
1 parent
b5e2177
commit a64449b
Showing
4 changed files
with
53 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
test/WebJobs.Script.Tests.Integration/PreJIT/JitPreparesTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.IO; | ||
using Microsoft.Azure.WebJobs.Script.WebHost; | ||
using Microsoft.Azure.WebJobs.Script.WebHost.Middleware; | ||
using Microsoft.Diagnostics.JitTrace; | ||
using Microsoft.WebJobs.Script.Tests; | ||
using Xunit; | ||
|
||
namespace Microsoft.Azure.WebJobs.Script.Tests.PreJIT | ||
{ | ||
[Trait(TestTraits.Category, TestTraits.EndToEnd)] | ||
[Trait(TestTraits.Group, TestTraits.ReleaseTests)] | ||
public class JitPreparesTest | ||
{ | ||
[Theory] | ||
[InlineData(WarmUpConstants.JitTraceFileName)] | ||
[InlineData(WarmUpConstants.LinuxJitTraceFileName)] | ||
public void ColdStart_JitFailuresTest(string fileName) | ||
{ | ||
var path = Path.Combine(Path.GetDirectoryName(new Uri(typeof(HostWarmupMiddleware).Assembly.CodeBase).LocalPath), WarmUpConstants.PreJitFolderName, fileName); | ||
|
||
var file = new FileInfo(path); | ||
|
||
Assert.True(file.Exists, $"Expected PGO file '{file.FullName}' does not exist. The file was either renamed or deleted."); | ||
|
||
JitTraceRuntime.Prepare(file, out int successfulPrepares, out int failedPrepares); | ||
|
||
var failurePercentage = (double)failedPrepares / successfulPrepares * 100; | ||
|
||
// using 1% as approximate number of allowed failures before we need to regenrate a new PGO file. | ||
Assert.True(failurePercentage < 1.0, $"Number of failed PGOs are more than 1 percent! Current number of failures are {failedPrepares}. This will definitely impact cold start! Time to regenrate PGOs and update the {fileName} file!"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters