[tests] Fix BlittablePInvokes.CheckForNonBlittablePInvokes to not verify known failures unless building for all platforms. (#18007)

This fixes a test failure when not including all platforms:

	Cecil.Tests.BlittablePInvokes.CheckForNonBlittablePInvokes: Known failures that aren't failing anymore - remove these from the list of known failures: In the file tests/cecil-tests/BlittablePInvokes.cs, read the guide carefully.
		Expected: <empty>
		But was: < "AudioUnit.AudioComponentStatus AudioUnit.AudioUnit::AudioOutputUnitPublish(AudioUnit.AudioComponentDescription,System.IntPtr,System.UInt32,System.IntPtr)", ...
This commit is contained in:
Rolf Bjarne Kvinge 2023-04-11 07:12:46 +02:00 коммит произвёл GitHub
Родитель 3d554c2200
Коммит 2012ffbb75
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -66,7 +66,11 @@ namespace Cecil.Tests {
}
Assert.IsEmpty (newFailures, $"Failures: {message}");
Assert.IsEmpty (fixedFailures, $"Known failures that aren't failing anymore - remove these from the list of known failures: {message}");
// The list of known failures often doesn't separate based on platform, which means that we might not see all the known failures
// unless we're currently building for all platforms. As such, only verify the list of known failures if we're building for all platforms.
if (!Configuration.AnyIgnoredPlatforms ())
Assert.IsEmpty (fixedFailures, $"Known failures that aren't failing anymore - remove these from the list of known failures: {message}");
}
// Enumerates all the methods in the assembly, for all types (including nested types), potentially providing a custom filter function.

Просмотреть файл

@ -1115,12 +1115,22 @@ namespace Xamarin.Tests {
}
}
public static void IgnoreIfAnyIgnoredPlatforms (bool dotnet = true)
public static bool AnyIgnoredPlatforms (bool dotnet = true)
{
return AnyIgnoredPlatforms (dotnet, out var _);
}
public static bool AnyIgnoredPlatforms (bool dotnet, out IEnumerable<ApplePlatform> notIncluded)
{
var allPlatforms = GetAllPlatforms (dotnet);
var includedPlatforms = GetIncludedPlatforms (dotnet);
var notIncluded = allPlatforms.Where (v => !includedPlatforms.Contains (v));
if (notIncluded.Any ())
notIncluded = allPlatforms.Where (v => !includedPlatforms.Contains (v)).ToArray ();
return notIncluded.Any ();
}
public static void IgnoreIfAnyIgnoredPlatforms (bool dotnet = true)
{
if (AnyIgnoredPlatforms (dotnet, out var notIncluded))
Assert.Ignore ($"This test requires all platforms to be included, but the following platforms aren't included: {string.Join (", ", notIncluded.Select (v => v.AsString ()))}");
}