Skip to content

Commit 7711b71

Browse files
nhatnghihojustsmth
andauthored
Fixes for android CI tests (#2713)
### Description of changes: Fixed failing Android CI tests. ### Call-outs: The fix requires a Docker image update so devicefarm will still fail on this PR. I have verified that the test passed in my personal account. See test result for this [commit](https://github.com/nhatnghiho/aws-lc/commits/a9d3dff8b25e82d3fe43d67951536ffee91e94e6) By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license. --------- Co-authored-by: Justin Smith <justsmth@amazon.com>
1 parent 1304256 commit 7711b71

File tree

9 files changed

+51
-52
lines changed

9 files changed

+51
-52
lines changed

tests/ci/android/AWSLCAndroidTestRunner/app/build.gradle

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
apply plugin: 'com.android.application'
2-
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
1+
plugins {
2+
id 'com.android.application'
3+
id 'kotlin-android'
4+
}
45

56
android {
6-
compileSdkVersion 30
7-
buildToolsVersion "30.0.3"
8-
ndkVersion "21.4.7075529"
7+
namespace 'software.amazon.aws.crypto.awslcandroidtestrunner'
8+
compileSdk 30
9+
buildToolsVersion "33.0.3"
10+
ndkVersion "28.2.13676358"
911

1012
def cmake_args = ''
1113
def specific_abis = ''
@@ -50,16 +52,19 @@ android {
5052

5153
defaultConfig {
5254
applicationId "software.amazon.aws.crypto.awslcandroidtestrunner"
53-
minSdkVersion 21
54-
targetSdkVersion 30
55+
minSdk 21
56+
targetSdk 30
5557
versionCode 1
5658
versionName "1.0"
5759

5860
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
5961

6062
externalNativeBuild {
6163
cmake {
62-
arguments cmake_args.split(',')
64+
if (!cmake_args.isEmpty()) {
65+
arguments cmake_args.split(',')
66+
}
67+
targets "all_tests"
6368
abiFilters specific_abis.split(',')
6469
}
6570
}
@@ -87,10 +92,10 @@ android {
8792

8893
dependencies {
8994
implementation fileTree(dir: 'libs', include: ['*.jar'])
90-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
95+
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.31'
9196
implementation 'androidx.appcompat:appcompat:1.1.0'
9297
implementation 'androidx.core:core-ktx:1.2.0'
93-
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
94-
androidTestImplementation 'androidx.test:runner:1.2.0'
95-
androidTestImplementation 'androidx.test:monitor:1.2.0@aar'
98+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
99+
androidTestImplementation 'androidx.test:runner:1.4.0'
100+
androidTestImplementation 'androidx.test:core:1.4.0'
96101
}

tests/ci/android/AWSLCAndroidTestRunner/app/src/main/cpp/CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
# Sets the minimum version of CMake required to build the native library.
55

6-
cmake_minimum_required(VERSION 3.4.1)
6+
cmake_minimum_required(VERSION 3.10)
77

88
# AWS lib
9-
set(path_to_awslc "${CMAKE_CURRENT_LIST_DIR}/../../../../../../../../")
10-
get_filename_component(path_to_awslc ${path_to_awslc} ABSOLUTE)
9+
get_filename_component(path_to_awslc "${CMAKE_CURRENT_LIST_DIR}/../../../../../../../../" REALPATH)
1110

1211
list(APPEND CMAKE_MODULE_PATH $<TARGET_FILE:crypto>)
1312
set(ANDROIDTESTRUNNER ON)
@@ -22,15 +21,14 @@ list(APPEND ANDROID_TEST_CASES "crypto_test")
2221
list(APPEND ANDROID_TEST_CASES "urandom_test")
2322
list(APPEND ANDROID_TEST_CASES "ssl_test")
2423

24+
2525
# Generate Kotlin test classes
26-
get_filename_component(testrunner_path "../../androidTest/java/software/amazon/aws/crypto/awslcandroidtestrunner" ABSOLUTE)
26+
get_filename_component(testrunner_path "../../androidTest/java/software/amazon/aws/crypto/awslcandroidtestrunner" REALPATH)
2727
foreach(name IN LISTS ANDROID_TEST_CASES)
2828
set(TEST_NAME "${name}")
2929
configure_file(
3030
"${testrunner_path}/NativeTest.kt.in"
3131
"${testrunner_path}/tests/NativeTest_${name}.kt"
3232
@ONLY
3333
)
34-
endforeach()
35-
36-
34+
endforeach()

tests/ci/android/AWSLCAndroidTestRunner/build.gradle

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

3-
buildscript {
4-
ext.kotlin_version = '1.3.71'
5-
repositories {
6-
google()
7-
jcenter()
8-
9-
}
10-
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.6.2'
12-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
13-
14-
// NOTE: Do not place your application dependencies here; they belong
15-
// in the individual module build.gradle files
16-
}
3+
plugins {
4+
id 'com.android.application' version '7.3.1' apply false
5+
id 'org.jetbrains.kotlin.android' version '1.5.31' apply false
176
}
187

198
allprojects {
209
repositories {
2110
google()
22-
jcenter()
23-
11+
mavenCentral()
2412
}
2513
}
2614

tests/ci/android/AWSLCAndroidTestRunner/gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=file\:/opt/gradle-5.6.4-all.zip
5+
distributionUrl=file\:/opt/gradle-7.6.4-all.zip
66

77
# Use version below when building outside of our android docker image and gradle
88
# is not preinstalled.
9-
# distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
9+
# distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1+
pluginManagement {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
gradlePluginPortal()
6+
}
7+
}
8+
19
rootProject.name='AWSLCAndroidTestRunner'
2-
include ':app'
10+
include ':app'

tests/ci/android/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Our android CI cross-compiles AWS-LC using AWSLCAndroidTestRunner and the NDK to
66
## Setup
77
The commands below help build the app within our Android CI's docker image. The docker image is only made to support cross-compiling AWS-LC with Android toolchains, building the `AWSLCAndroidTestRunner` apks, and uploading and kicking off the tests in AWS Device Farm. Running and testing on connected Android devices or emulators via `./gradlew cC` isn't configured within the docker image.
88
1. Assuming all the commands are being run from this folder: `cd tests/ci/android`
9-
2. `docker build -t ubuntu-20.04:android ../docker_images/linux-x86/ubuntu-24.04_android/`
9+
2. `docker build -t ubuntu-24.04:android ../docker_images/linux-x86/ubuntu-24.04_android/`
1010
3. Run the docker image from root of aws-lc. The container needs access to aws-lc's source code to build.
1111
```
1212
cd ../../../

tests/ci/cdk/cdk/codebuild/github_ci_android_omnibus.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,43 @@ version: 0.2
66
# Doc for batch https://docs.aws.amazon.com/codebuild/latest/userguide/batch-build-buildspec.html#build-spec.batch.build-list
77
batch:
88
build-list:
9-
- identifier: ubuntu2004_android_nonfips_static_debug
9+
- identifier: ubuntu2404_android_nonfips_static_debug
1010
buildspec: ./tests/ci/codebuild/android/run_android_static_debug.yml
1111
env:
1212
type: LINUX_CONTAINER
1313
privileged-mode: true
1414
compute-type: BUILD_GENERAL1_MEDIUM
1515
# TODO(CryptoAlg-1276): replace |620771051181| and |us-west-2| with corresponding env variables.
1616
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest
17-
- identifier: ubuntu2004_android_nonfips_static_release
17+
- identifier: ubuntu2404_android_nonfips_static_release
1818
buildspec: ./tests/ci/codebuild/android/run_android_static_release.yml
1919
env:
2020
type: LINUX_CONTAINER
2121
privileged-mode: true
2222
compute-type: BUILD_GENERAL1_MEDIUM
2323
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest
24-
- identifier: ubuntu2004_android_nonfips_shared_debug
24+
- identifier: ubuntu2404_android_nonfips_shared_debug
2525
buildspec: ./tests/ci/codebuild/android/run_android_shared_debug.yml
2626
env:
2727
type: LINUX_CONTAINER
2828
privileged-mode: true
2929
compute-type: BUILD_GENERAL1_MEDIUM
3030
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest
31-
- identifier: ubuntu2004_android_nonfips_shared_release
31+
- identifier: ubuntu2404_android_nonfips_shared_release
3232
buildspec: ./tests/ci/codebuild/android/run_android_shared_release.yml
3333
env:
3434
type: LINUX_CONTAINER
3535
privileged-mode: true
3636
compute-type: BUILD_GENERAL1_MEDIUM
3737
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest
38-
- identifier: ubuntu2004_android_fips_shared_release
38+
- identifier: ubuntu2404_android_fips_shared_release
3939
buildspec: ./tests/ci/codebuild/android/run_android_fips_shared.yml
4040
env:
4141
type: LINUX_CONTAINER
4242
privileged-mode: true
4343
compute-type: BUILD_GENERAL1_MEDIUM
4444
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-24.04_android_latest
45-
- identifier: ubuntu2004_android_fips_static_release
45+
- identifier: ubuntu2404_android_fips_static_release
4646
buildspec: ./tests/ci/codebuild/android/run_android_fips_static.yml
4747
env:
4848
type: LINUX_CONTAINER

tests/ci/docker_images/linux-x86/ubuntu-24.04_android/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id 'com.android.application' version '7.3.1'
3-
id 'org.jetbrains.kotlin.android' version '1.8.10'
3+
id 'org.jetbrains.kotlin.android' version '1.5.31'
44
}
55

66
allprojects {
@@ -26,10 +26,10 @@ android {
2626

2727
dependencies {
2828
implementation fileTree(dir: 'libs', include: ['*.jar'])
29-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.10"
29+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.31"
3030
implementation 'androidx.appcompat:appcompat:1.1.0'
3131
implementation 'androidx.core:core-ktx:1.2.0'
32-
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
33-
androidTestImplementation 'androidx.test:runner:1.5.2'
34-
androidTestImplementation 'androidx.test:core:1.5.0'
32+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
33+
androidTestImplementation 'androidx.test:runner:1.4.0'
34+
androidTestImplementation 'androidx.test:core:1.4.0'
3535
}

tests/ci/docker_images/linux-x86/ubuntu-24.04_android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ distributionUrl=file\:/opt/gradle-7.6.4-all.zip
66

77
# Use version below when building outside of our android docker image and gradle
88
# is not preinstalled.
9-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip
9+
#distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip

0 commit comments

Comments
 (0)