[tests] Improve a test about warnings to list all the underlying warnings. (#19043)

Improve a test about warnings to list all the underlying linker warnings,
instead of just stating that a specific assembly has any linker warnings.
This commit is contained in:
Rolf Bjarne Kvinge 2023-09-19 07:28:11 +02:00 коммит произвёл GitHub
Родитель 73e15f09ba
Коммит 2dfb517d34
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 5 добавлений и 5 удалений

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

@ -1452,15 +1452,15 @@ namespace Xamarin.Tests {
properties ["_IsPublishing"] = "true"; // quack like "dotnet publish" properties ["_IsPublishing"] = "true"; // quack like "dotnet publish"
properties ["ExcludeNUnitLiteReference"] = "true"; // we're asserting no warnings, and NUnitLite produces a lot of them, so ignore NUnitLite properties ["ExcludeNUnitLiteReference"] = "true"; // we're asserting no warnings, and NUnitLite produces a lot of them, so ignore NUnitLite
properties ["ExcludeTouchUnitReference"] = "true"; // we're asserting no warnings, and Touch.Unit produces a lot of them, so ignore Touch.Unit properties ["ExcludeTouchUnitReference"] = "true"; // we're asserting no warnings, and Touch.Unit produces a lot of them, so ignore Touch.Unit
properties ["TrimmerSingleWarn"] = "false"; // don't be shy, we want to know what the problem is
var rv = DotNet.AssertBuild (project_path, properties); var rv = DotNet.AssertBuild (project_path, properties);
// Verify that we have no warnings, but unfortunately we still have some we haven't fixed yet. // Verify that we have no warnings, but unfortunately we still have some we haven't fixed yet.
// Ignore those, and fail the test if we stop getting them (so that we can update the test to not ignore them anymore). // Ignore those, and fail the test if we stop getting them (so that we can update the test to not ignore them anymore).
var foundIL3053 = false; var foundIL3050 = false;
rv.AssertNoWarnings ((evt) => { rv.AssertNoWarnings ((evt) => {
// This will probably go away when the IL2049 warning from above is fixed. if (evt.Code == "IL3050" && evt.Message == "<Module>..cctor(): Using member 'System.Enum.GetValues(Type)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. It might not be possible to create an array of the enum type at runtime. Use the GetValues<TEnum> overload or the GetValuesAsUnderlyingType method instead.") {
if (evt.Code == "IL3053" && evt.Message == $"Assembly 'Microsoft.{platform.AsString ()}' produced AOT analysis warnings.") { foundIL3050 = true;
foundIL3053 = true;
return false; return false;
} }
@ -1470,7 +1470,7 @@ namespace Xamarin.Tests {
return true; return true;
}); });
Assert.IsTrue (foundIL3053, "IL3053 not found - update test code to remove the code to ignore the IL3053"); Assert.IsTrue (foundIL3050, "IL3050 not found - update test code to remove the code to ignore the IL3050");
} }
void AssertThatDylibExistsAndIsReidentified (string appPath, string dylibRelPath) void AssertThatDylibExistsAndIsReidentified (string appPath, string dylibRelPath)