-
Notifications
You must be signed in to change notification settings - Fork 17
Android: fix instrumented test compatibility and add emulator CI #183
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances Android instrumented test compatibility by converting test discovery patterns from @BeforeClass + Assume to @Rule-based patterns, ensuring proper test reporting in AndroidJUnitRunner. It also adds emulator-based CI testing via GitHub Actions and updates certificate file paths from /sdcard/ to /data/local/tmp/ to avoid permission issues.
- Converts test availability checks from
@BeforeClassmethods to JUnit@Ruleimplementations for proper test skipping behavior - Adds GitHub Actions workflow for running instrumented tests on Android emulator with proper certificate file setup
- Updates native build configuration in CMakeLists.txt to match current wolfSSL
--enable-jnidefines
Reviewed changes
Copilot reviewed 35 out of 36 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/test/java/com/wolfssl/wolfcrypt/test/fips/FipsTest.java |
Adds @Rule for FIPS availability check, replacing @BeforeClass pattern |
src/test/java/com/wolfssl/wolfcrypt/test/fips/Des3FipsTest.java |
Implements @Rule for DES3 FIPS availability and version checking |
src/test/java/com/wolfssl/wolfcrypt/test/WolfSSLCertManagerOCSPTest.java |
Adds rules for cert file and OCSP availability checks; updates cert path to /data/local/tmp/ |
src/test/java/com/wolfssl/wolfcrypt/test/Sha3Test.java |
Adds missing import for Statement class |
src/test/java/com/wolfssl/wolfcrypt/test/RsaTest.java |
Adds @SuppressWarnings("deprecation") to test method |
src/test/java/com/wolfssl/wolfcrypt/test/DhTest.java |
Adds key size validation logic with graceful test skipping for unsupported DH key sizes |
src/test/java/com/wolfssl/wolfcrypt/test/Des3Test.java |
Converts DES3 availability check to @Rule pattern |
src/test/java/com/wolfssl/wolfcrypt/test/AesTest.java |
Adds deprecation suppression to test method |
src/test/java/com/wolfssl/wolfcrypt/test/AesOfbTest.java |
Implements @Rule for AES-OFB availability checking |
src/test/java/com/wolfssl/wolfcrypt/test/AesGcmTest.java |
Adds deprecation suppression annotation |
src/test/java/com/wolfssl/wolfcrypt/test/AesEcbTest.java |
Converts availability check to @Rule pattern |
src/test/java/com/wolfssl/wolfcrypt/test/AesCtrTest.java |
Implements @Rule for AES-CTR availability |
src/test/java/com/wolfssl/wolfcrypt/test/AesCmacTest.java |
Converts availability check to @Rule pattern |
src/test/java/com/wolfssl/wolfcrypt/test/AesCcmTest.java |
Implements @Rule for AES-CCM availability |
src/test/java/com/wolfssl/provider/jce/test/WolfSSLKeyStoreTest.java |
Updates cert path and improves file existence checking; adds Android JKS skip logic |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptUtilTest.java |
Adds helper method for checking test file availability |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptSignatureTest.java |
Moves PSS parameter setting to after init calls for Android compatibility |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptServiceLoaderTest.java |
Adds Android detection and test skipping for ServiceLoader tests |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptPKIXRevocationCheckerTest.java |
Updates cert path and converts file existence check to assumption; removes unnecessary casts |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptPKIXCertPathValidatorTest.java |
Implements @Rule for cert file availability and updates Android cert path |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha3Test.java |
Fixes exception handling in catch clause |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptKeyPairGeneratorTest.java |
Adds Android detection and skip logic for RSASSA-PSS tests |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptKeyAgreementTest.java |
Removes unnecessary casts and adds unchecked suppression |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptCipherTest.java |
Adds Android provider support and skips tests for unsupported algorithms |
src/test/java/com/wolfssl/provider/jce/test/WolfCryptAlgorithmParameterGeneratorTest.java |
Expands error handling for DH parameter generation failures on Android |
src/main/java/com/wolfssl/provider/jce/WolfCryptKeyPairGenerator.java |
Adds try-catch for RSASSA-PSS KeyFactory instantiation on platforms without support |
src/main/java/com/wolfssl/provider/jce/WolfCryptDhParameterGenerator.java |
Implements retry logic for prime generation failures during DH parameter generation |
IDE/Android/gradle.properties |
Removes trailing blank lines |
IDE/Android/app/src/main/cpp/CMakeLists.txt |
Updates native build defines to match current wolfSSL --enable-jni configuration |
IDE/Android/app/src/androidTest/java/com/wolfssl |
Creates symlink to test source directory |
IDE/Android/app/build.gradle |
Adds test runner arguments and JUnit dependency for instrumented tests |
IDE/Android/README.md |
Adds documentation for pushing certificate files to Android device |
IDE/Android/.gitignore |
Adds test results preferences file to gitignore |
.github/workflows/main.yml |
Removes android-gradle job from main workflow |
.github/workflows/android_gradle.yml |
Converts to standalone workflow with emulator support and instrumented test execution |
Files not reviewed (1)
- IDE/Android/.idea/vcs.xml: Language not supported
Comments suppressed due to low confidence (2)
src/test/java/com/wolfssl/wolfcrypt/test/fips/FipsTest.java:1
- The order value
Integer.MIN_VALUE + 2is a magic number. Consider adding a comment explaining why this specific order is necessary, or define a named constant to clarify the rule ordering strategy used across test classes.
src/test/java/com/wolfssl/wolfcrypt/test/DhTest.java:1 - The string "Key size error" is duplicated across multiple locations in this file (lines 104, 150, 202). Consider extracting this to a constant at the class level to improve maintainability.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/com/wolfssl/provider/jce/WolfCryptDhParameterGenerator.java
Show resolved
Hide resolved
…ise we see test count doubled. Tests are still run with this change
…Class + Assume to Rule pattern, update Android README for cert paths
b5ab6c7 to
509c4a8
Compare
509c4a8 to
8171b6a
Compare
…er thread, avoids threading contention at JNI class level in test
This PR fixes Android instrumented test compatibility issues and adds emulator-based CI testing.
@BeforeClass+Assumepattern to@Rulepattern so tests are properly reported as skipped instead of silently dropped by AndroidJUnitRunnerandroid_gradle.ymlto run instrumented tests on emulator/sdcard/to/data/local/tmp/to avoid permission issues--enable-jniconfiguration