Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Unable to run any Robolectric test on M1 mac #22721

Closed
afurtak opened this issue Dec 6, 2021 · 2 comments
Closed

Unable to run any Robolectric test on M1 mac #22721

afurtak opened this issue Dec 6, 2021 · 2 comments
Labels
needs:triage Issue needs triage

Comments

@afurtak
Copy link

afurtak commented Dec 6, 2021

When I run a Robolectric test it crashes on its beginning with stack trace like this

/Users/adam/Library/Caches/JNA/temp/jna16393990834196772459.tmp: dlopen(/Users/adam/Library/Caches/JNA/temp/jna16393990834196772459.tmp, 1): no suitable image found.  Did find:
	/Users/adam/Library/Caches/JNA/temp/jna16393990834196772459.tmp: no matching architecture in universal wrapper
	/Users/adam/Library/Caches/JNA/temp/jna16393990834196772459.tmp: no matching architecture in universal wrapper
java.lang.UnsatisfiedLinkError: /Users/adam/Library/Caches/JNA/temp/jna16393990834196772459.tmp: dlopen(/Users/adam/Library/Caches/JNA/temp/jna16393990834196772459.tmp, 1): no suitable image found.  Did find:
	/Users/adam/Library/Caches/JNA/temp/jna16393990834196772459.tmp: no matching architecture in universal wrapper
	/Users/adam/Library/Caches/JNA/temp/jna16393990834196772459.tmp: no matching architecture in universal wrapper
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2627)
	at java.base/java.lang.Runtime.load0(Runtime.java:768)
	at java.base/java.lang.System.load(System.java:1837)
	at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
	at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
	at com.sun.jna.Native.<clinit>(Native.java:195)
	at com.sun.jna.StringArray.<init>(StringArray.java:56)
	at com.sun.jna.StringArray.<init>(StringArray.java:49)
	at mozilla.telemetry.glean.private.CounterMetricType.<init>(CounterMetricType.kt:41)
	at org.mozilla.fenix.GleanMetrics.PerfStartup.<clinit>(PerfStartup.kt:129)
	at org.mozilla.fenix.FenixApplication.onCreate(FenixApplication.kt:105)
	at org.mozilla.fenix.helpers.FenixRobolectricTestApplication.onCreate(FenixRobolectricTestApplication.kt:19)
	at org.robolectric.android.internal.AndroidTestEnvironment.lambda$installAndCreateApplication$2(AndroidTestEnvironment.java:350)
	at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:86)
	at org.robolectric.android.internal.AndroidTestEnvironment.installAndCreateApplication(AndroidTestEnvironment.java:350)
	at org.robolectric.android.internal.AndroidTestEnvironment.lambda$createApplicationSupplier$0(AndroidTestEnvironment.java:229)
	at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:53)
	at org.robolectric.android.internal.AndroidTestEnvironment.lambda$createApplicationSupplier$1(AndroidTestEnvironment.java:226)
	at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:167)
	at org.robolectric.RuntimeEnvironment.getApplication(RuntimeEnvironment.java:71)
	at org.robolectric.android.internal.AndroidTestEnvironment.setUpApplicationState(AndroidTestEnvironment.java:194)
	at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:321)
	at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:269)
	at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

┆Issue is synchronized with this Jira Task

@github-actions github-actions bot added the needs:triage Issue needs triage label Dec 6, 2021
@MatthewTighe
Copy link
Contributor

MatthewTighe commented Dec 6, 2021

This is an upstream issue with Application Services, which you can track the status of with this issue.

The current workaround is to run the tests using a JDK compiled for an x86_64 architecture instead of one compiled for an aarch64 architecture. You can see more details about how to do that in this comment

@kbrosnan
Copy link
Contributor

kbrosnan commented Dec 6, 2021

Upstream issue.

@kbrosnan kbrosnan closed this as completed Dec 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs:triage Issue needs triage
Projects
None yet
Development

No branches or pull requests

3 participants