From 43473578142dfd09e3b1613cb7ee76a415dc7e4f Mon Sep 17 00:00:00 2001 From: Rajesh Nyamagoud Date: Wed, 3 Jan 2024 01:01:17 +0000 Subject: [PATCH] Created libkeystore-engine as cc-library instead of cc-test-library to avoid issues while linking shared libraries with Rust test binaries. This change is made to avoid vts-tradefed failure to link the shared library while running the Rust VTS `keystore2_client_tests` test suite. As suggested in b/314110490#24 using the libkeystore-engine static-library to run keystore2_client_tests. Bug: 314110490, 298668920 Test: atest keystore2_client_tests; run vts -m keystore2_client_tests Change-Id: If956865eeb4af908f33b1ad81a2b2e26300aae0e --- keystore-engine/Android.bp | 7 ++++++- keystore2/test_utils/Android.bp | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/keystore-engine/Android.bp b/keystore-engine/Android.bp index 3087675b..88ae016c 100644 --- a/keystore-engine/Android.bp +++ b/keystore-engine/Android.bp @@ -21,9 +21,14 @@ package { default_applicable_licenses: ["system_security_license"], } -cc_test_library { +// This is expected to be cc_test_library but due to issue mentioned in b/298668920, b/314110490 +// we are creating cc_library and using static library to link with `keystore_client_tests`. +cc_library { name: "libkeystore-engine", + defaults: [ + "keystore2_use_latest_aidl_ndk_shared", + ], srcs: [ "android_engine.cpp", "keystore2_engine.cpp", diff --git a/keystore2/test_utils/Android.bp b/keystore2/test_utils/Android.bp index c16aa124..e37ba607 100644 --- a/keystore2/test_utils/Android.bp +++ b/keystore2/test_utils/Android.bp @@ -43,13 +43,14 @@ rust_defaults { ], static_libs: [ "libkeystore2_ffi_test_utils", + "libkeystore-engine", ], shared_libs: [ + "android.system.keystore2-V3-ndk", "libbase", "libcrypto", "libkeymaster_portable", "libkeymint_support", - "libkeystore-engine", ], } @@ -75,17 +76,18 @@ cc_library_static { srcs: ["ffi_test_utils.cpp"], defaults: [ "keymint_use_latest_hal_aidl_ndk_shared", + "keystore2_use_latest_aidl_ndk_shared", ], generated_headers: [ "cxx-bridge-header", "libkeystore2_ffi_test_utils_bridge_header", ], generated_sources: ["libkeystore2_ffi_test_utils_bridge_code"], + static_libs: ["libkeystore-engine"], shared_libs: [ "libbase", "libcrypto", "libkeymaster_portable", - "libkeystore-engine", "libkeymint_support", ], }