Skip to content

Conversation

@cconlon
Copy link
Member

@cconlon cconlon commented Dec 30, 2025

This PR fixes Android instrumented test compatibility issues and adds emulator-based CI testing.

  • Test discovery fixes: Convert @BeforeClass + Assume pattern to @Rule pattern so tests are properly reported as skipped instead of silently dropped by AndroidJUnitRunner
  • GitHub workflow: Update android_gradle.yml to run instrumented tests on emulator
  • Cert path updates: Change Android cert paths from /sdcard/ to /data/local/tmp/ to avoid permission issues
  • CMakeLists.txt: Update native build defines to match current wolfSSL --enable-jni configuration

@cconlon cconlon self-assigned this Dec 30, 2025
@cconlon cconlon requested a review from Copilot December 30, 2025 20:26
Copy link

Copilot AI left a 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 @BeforeClass methods to JUnit @Rule implementations 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-jni defines

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 + 2 is 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.

@cconlon cconlon force-pushed the androidTestFixes branch 2 times, most recently from b5ab6c7 to 509c4a8 Compare December 30, 2025 21:19
…er thread, avoids threading contention at JNI class level in test
@cconlon cconlon assigned rlm2002 and unassigned cconlon Dec 30, 2025
@rlm2002 rlm2002 merged commit c6f8855 into wolfSSL:master Dec 30, 2025
57 checks passed
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

Successfully merging this pull request may close these issues.

2 participants