Skip to content

Bump Robolectric to 4.10.3 #5149

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

Merged
merged 9 commits into from
Oct 3, 2023
Merged

Bump Robolectric to 4.10.3 #5149

merged 9 commits into from
Oct 3, 2023

Conversation

utzcoz
Copy link
Contributor

@utzcoz utzcoz commented Jul 9, 2023

@utzcoz utzcoz force-pushed the robolectric-4.10 branch from 22f858f to 09944c4 Compare July 9, 2023 07:47
@utzcoz utzcoz marked this pull request as draft July 9, 2023 07:58
@utzcoz utzcoz force-pushed the robolectric-4.10 branch from 09944c4 to 10b8e92 Compare July 9, 2023 10:49
@utzcoz utzcoz force-pushed the robolectric-4.10 branch 3 times, most recently from 43862fd to 4d44929 Compare September 2, 2023 01:33
@utzcoz utzcoz marked this pull request as ready for review September 2, 2023 04:39
@utzcoz
Copy link
Contributor Author

utzcoz commented Sep 2, 2023

@rlazo Please help to review this PR. Thanks.

@rlazo
Copy link
Collaborator

rlazo commented Sep 5, 2023

Perf tests break due to this change

> Task :firebase-perf:processDebugUnitTestResources
/home/runner/work/firebase-android-sdk/firebase-android-sdk/firebase-perf/src/test/java/com/google/firebase/perf/FirebasePerformanceTestBase.java:61: error: cannot access TranslationManager

    ShadowPackageManager shadowPackageManager = shadowOf(appContext.getPackageManager());
                                                ^
  class file for android.view.translation.TranslationManager not found
> Task :firebase-perf:compileDebugUnitTestJavaWithJavac
/home/runner/work/firebase-android-sdk/firebase-android-sdk/firebase-perf/src/test/java/com/google/firebase/perf/transport/TransportManagerTest.java:1403: error: cannot access RenderEffect
      ShadowPackageManager shadowPackageManager = shadowOf(context.getPackageManager());
                                                  ^
  class file for android.graphics.RenderEffect not found
/home/runner/work/firebase-android-sdk/firebase-android-sdk/firebase-perf/src/test/java/com/google/firebase/perf/FirebasePerformanceTest.java:86: error: cannot access RuntimeShader
    ShadowPackageManager shadowPackageManager = shadowOf(context.getPackageManager());
                                                ^
  class file for android.graphics.RuntimeShader not found

@utzcoz
Copy link
Contributor Author

utzcoz commented Sep 5, 2023

@rlazo Thanks. I will try to fix it this weekend.

@utzcoz utzcoz force-pushed the robolectric-4.10 branch 2 times, most recently from 9df752a to e916bde Compare September 11, 2023 07:34
@utzcoz utzcoz marked this pull request as draft September 11, 2023 07:38
utzcoz and others added 3 commits September 11, 2023 15:43
Fix Class not found for Robolectric
Robolectric's ReflectionHelpers removes supporting of setting fnial
static method becasuse it not the reposibility of Robolectric, and
it will not be allowed by the latest JDK. This CL just adds custom
method to do the same things as a workaround. When the project updates
the JDK someday, the maintainer needs to rewrite the test or provides
some test helper method to avoid set final static method for test.

Signed-off-by: utzcoz <[email protected]>
@utzcoz utzcoz marked this pull request as ready for review September 19, 2023 04:44
@utzcoz
Copy link
Contributor Author

utzcoz commented Sep 19, 2023

Hi @rlazo, I think this PR is ready for reviewing again. Thanks.

@rlazo
Copy link
Collaborator

rlazo commented Sep 19, 2023

Thanks @utzcoz I'm seeing these errors when running tests

Task :firebase-inappmessaging-display:ktx:compileReleaseUnitTestJavaWithJavac NO-SOURCE
Error: Exception in thread "pool-3-thread-1" java.lang.AssertionError: Unable to load Robolectric native runtime library

	at org.robolectric.nativeruntime.DefaultNativeRuntimeLoader.ensureLoaded(DefaultNativeRuntimeLoader.java:87)
	at org.robolectric.nativeruntime.DefaultNativeRuntimeLoader.injectAndLoad(DefaultNativeRuntimeLoader.java:54)
	at org.robolectric.shadows.ShadowNativeSQLiteConnection.nativeOpen(ShadowNativeSQLiteConnection.java:26)
	at org.robolectric.shadows.ShadowNativeSQLiteConnection.nativeOpen(ShadowNativeSQLiteConnection.java:50)
	at android.database.sqlite.SQLiteConnection.nativeOpen(SQLiteConnection.java)
	at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:224)
	at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:205)
	at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:512)
	at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:210)
	at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:202)
	at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1085)
	at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1065)
	at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:929)
	at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:918)
	at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:373)
	at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:316)
	at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.retryIfDbLocked(SQLiteEventStore.java:582)
	at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.getDb(SQLiteEventStore.java:95)
	at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.runCriticalSection(SQLiteEventStore.java:765)
	at com.google.android.datatransport.runtime.scheduling.jobscheduling.WorkInitializer.lambda$ensureContextsScheduled$1(WorkInitializer.java:54)
	at com.google.android.datatransport.runtime.SafeLoggingExecutor$SafeLoggingRunnable.run(SafeLoggingExecutor.java:47)
	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:829)
Caused by: java.io.FileNotFoundException: /tmp/robolectric-nativeruntime7483900119560904969/fonts/NotoSansCJK-Black.ttc (No such file or directory)

@rlazo
Copy link
Collaborator

rlazo commented Sep 19, 2023

Thanks @utzcoz I'm seeing these errors when running tests

Task :firebase-inappmessaging-display:ktx:compileReleaseUnitTestJavaWithJavac NO-SOURCE
Error: Exception in thread "pool-3-thread-1" java.lang.AssertionError: Unable to load Robolectric native runtime library

	at org.robolectric.nativeruntime.DefaultNativeRuntimeLoader.ensureLoaded(DefaultNativeRuntimeLoader.java:87)
	at org.robolectric.nativeruntime.DefaultNativeRuntimeLoader.injectAndLoad(DefaultNativeRuntimeLoader.java:54)
	at org.robolectric.shadows.ShadowNativeSQLiteConnection.nativeOpen(ShadowNativeSQLiteConnection.java:26)
	at org.robolectric.shadows.ShadowNativeSQLiteConnection.nativeOpen(ShadowNativeSQLiteConnection.java:50)
	at android.database.sqlite.SQLiteConnection.nativeOpen(SQLiteConnection.java)
	at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:224)
	at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:205)
	at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:512)
	at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:210)
	at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:202)
	at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1085)
	at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1065)
	at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:929)
	at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:918)
	at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:373)
	at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:316)
	at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.retryIfDbLocked(SQLiteEventStore.java:582)
	at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.getDb(SQLiteEventStore.java:95)
	at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.runCriticalSection(SQLiteEventStore.java:765)
	at com.google.android.datatransport.runtime.scheduling.jobscheduling.WorkInitializer.lambda$ensureContextsScheduled$1(WorkInitializer.java:54)
	at com.google.android.datatransport.runtime.SafeLoggingExecutor$SafeLoggingRunnable.run(SafeLoggingExecutor.java:47)
	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:829)
Caused by: java.io.FileNotFoundException: /tmp/robolectric-nativeruntime7483900119560904969/fonts/NotoSansCJK-Black.ttc (No such file or directory)

Forgot to include the link to the test

https://github.com/firebase/firebase-android-sdk/actions/runs/6230686607/job/16932225839#step:5:1597

@utzcoz
Copy link
Contributor Author

utzcoz commented Sep 20, 2023

@rlazo Thanks. I will check whether it is related cache as I think these files might need to be existed this weenkend.

@utzcoz
Copy link
Contributor Author

utzcoz commented Sep 24, 2023

@rlazo I run ./gradlew :firebase-inappmessaging-display:ktx:check and ./gradlew :firebase-inappmessaging-display:check locally, and all of them passed. Maybe the issue you encountered is related to cache? What about clean and run it again?

@rlazo rlazo enabled auto-merge (squash) October 3, 2023 04:35
@rlazo rlazo disabled auto-merge October 3, 2023 04:35
@rlazo rlazo merged commit dc48e69 into firebase:master Oct 3, 2023
@rlazo
Copy link
Collaborator

rlazo commented Oct 3, 2023

I've merged the PR. Thanks for your contrib @utzcoz!

@utzcoz
Copy link
Contributor Author

utzcoz commented Oct 3, 2023

@rlazo Thanks for your reviewing.

@utzcoz utzcoz deleted the robolectric-4.10 branch October 3, 2023 04:44
@firebase firebase locked and limited conversation to collaborators Nov 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants