Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] If test suite adds ARM emulator runs in the future, add test for hybrid AOT + armeabi-v7a expected crash #5291

Open
brendanzagaeski opened this issue Nov 12, 2020 · 0 comments
Assignees

Comments

@brendanzagaeski
Copy link
Contributor

Context: #4966

After #4966 is merged, builds that attempt to use AndroidAotMode=Hybrid in combination with AndroidSupportedAbis=armeabi-v7a will intentionally fail on a build error to provide a better user experience compared to letting the apps abort on a SIGSEGV (#1218). This error is useful right now, but if hybrid AOT becomes compatible with armeabi-v7a in the future, the error should be removed.

Expected behavior

One way to alert the team if hybrid AOT becomes compatible with armeabi-v7a would be to add a test for it. The problem is that the test needs to run on an armeabi-v7a environment. In the past there were some AOT tests that ran on hardware ARM devices, but those are now deprecated (https://github.com/xamarin/QualityAssurance/commit/62d40bfb933d1ac0af27cf33311c837c4c3efbbc) in favor of tests that can run on emulator.

So if the MSBuildDeviceIntegration test suite is expanded to run tests on ARM emulators in the future, then it would be useful to add a test like the following to the test suite:

[Test]
public void AndroidAotModeHybridAbortsOnArmeabiV7a ()
{
	AssertHasDevices ();

	var proj = new XamarinAndroidApplicationProject () {
		IsRelease = true,
		AotAssemblies = true,
	};
	proj.SetProperty ("AndroidAotMode", "Hybrid");
	proj.SetAndroidSupportedAbis ("armeabi-v7a");
	proj.SetProperty ("_AndroidAotModeValidateAbi", "false");

	builder = CreateApkBuilder ();
	builder.Install (proj);

	ClearAdbLogcat ();
	if (CommercialBuildAvailable)
		Assert.True (builder.RunTarget (proj, "_Run"), "Project should have run.");
	else
		AdbStartActivity ($"{proj.PackageName}/{proj.JavaPackageName}.MainActivity");

	var logcatPath = Path.Combine (Root, builder.ProjectDirectory, "crash-logcat.log");
	Assert.IsTrue (MonitorAdbLogcat ((line) => {
		return line.Contains ($"Force finishing activity {proj.PackageName}");
	}, logcatPath, 30), "Application did not abort within 30 seconds.");
}

Other notes

If support for armeabi-v7a is deprecated before the test suite runs tests on ARM emulators, then this issue should be closed as no longer applicable, and the error from #4966 can be removed.

Similarly, if it turns out that .NET 6 resolves the issue with hybrid AOT or makes larger changes to AOT that make the whole problem obsolete, the issue should be closed, and the error from #4966 can be adjusted so that it only applies to pre-.NET 6 Xamarin.Android projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants