Skip to content

Commit 17a8b46

Browse files
committed
InstallAndRunTests.SmokeTestBuildAndRunWithSpecialCharacters updated, broken on NativeAOT
1 parent 50450b6 commit 17a8b46

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,18 +295,56 @@ void Reset ()
295295
}
296296
}
297297

298+
static IEnumerable<object[]> Get_SmokeTestBuildAndRunWithSpecialCharacters_Data ()
299+
{
300+
var ret = new List<object[]> ();
301+
302+
foreach (AndroidRuntime runtime in Enum.GetValues (typeof (AndroidRuntime))) {
303+
AddTestData ("テスト", runtime);
304+
AddTestData ("随机生成器", runtime);
305+
AddTestData ("中国", runtime);
306+
}
307+
308+
return ret;
309+
310+
void AddTestData (string testName, AndroidRuntime runtime)
311+
{
312+
ret.Add (new object[] {
313+
testName,
314+
runtime,
315+
});
316+
}
317+
}
318+
298319
[Test]
299320
[Category ("UsesDevice")]
300-
[TestCase ("テスト")]
301-
[TestCase ("随机生成器")]
302-
[TestCase ("中国")]
303-
public void SmokeTestBuildAndRunWithSpecialCharacters (string testName)
321+
[TestCaseSource (nameof (Get_SmokeTestBuildAndRunWithSpecialCharacters_Data))]
322+
public void SmokeTestBuildAndRunWithSpecialCharacters (string testName, AndroidRuntime runtime)
304323
{
324+
const bool isRelease = true;
325+
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
326+
return;
327+
}
328+
329+
// TODO: fix NativeAOT builds. Despite the .so library being preset in the apk (and named correctly)
330+
// all the tests fail with one of:
331+
//
332+
// java.lang.UnsatisfiedLinkError: dlopen failed: library "libテスト.so" not found
333+
// java.lang.UnsatisfiedLinkError: dlopen failed: library "lib中国.so" not found
334+
// java.lang.UnsatisfiedLinkError: dlopen failed: library "lib随机生成器.so" not found
335+
//
336+
// It might be an issue with the Android shared libary loader or name encoding in the archive. It might
337+
// be a good idea to limit .so names to ASCII.
338+
if (runtime == AndroidRuntime.NativeAOT) {
339+
Assert.Ignore ("NativeAOT doesn't work well with diacritics in the application library name");
340+
}
341+
305342
var rootPath = Path.Combine (Root, "temp", TestName);
306-
var proj = new XamarinFormsAndroidApplicationProject () {
343+
var proj = new XamarinFormsAndroidApplicationProject (packageName: PackageUtils.MakePackageName (runtime)) {
307344
ProjectName = testName,
308-
IsRelease = true,
345+
IsRelease = isRelease,
309346
};
347+
proj.SetRuntime (runtime);
310348
proj.SetAndroidSupportedAbis (DeviceAbi);
311349
proj.SetDefaultTargetDevice ();
312350
using (var builder = CreateApkBuilder (Path.Combine (rootPath, proj.ProjectName))){

0 commit comments

Comments
 (0)