-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created new Codesign class and moved SearchForExpectedEntitlements to…
… it.
- Loading branch information
1 parent
bcf962c
commit 5cdeb51
Showing
2 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/TestUtils/src/Microsoft.Maui.IntegrationTests/Apple/Codesign.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,33 @@ | ||
using System.Diagnostics; | ||
|
||
namespace Microsoft.Maui.IntegrationTests.Apple | ||
{ | ||
public static class Codesign | ||
{ | ||
public static List<string> SearchForExpectedEntitlements( | ||
string entitlementsPath, | ||
string appLocation, | ||
List<string> expectedEntitlements) | ||
{ | ||
List<string> foundEntitlements = new(); | ||
string procOutput = ToolRunner.Run(new ProcessStartInfo() | ||
{ | ||
FileName = "/usr/bin/codesign", | ||
Arguments = $"-d --entitlements {entitlementsPath} --xml {appLocation}" | ||
}, out int errorCode); | ||
|
||
Assert.AreEqual(errorCode, 0, procOutput); | ||
Assert.IsTrue(File.Exists(entitlementsPath)); | ||
|
||
string fileContent = File.ReadAllText(entitlementsPath); | ||
foreach (string entitlement in expectedEntitlements) | ||
{ | ||
if (fileContent.Contains(entitlement, StringComparison.OrdinalIgnoreCase)) | ||
foundEntitlements.Add(entitlement); | ||
} | ||
|
||
return foundEntitlements; | ||
} | ||
} | ||
} | ||
|
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