diff options
Diffstat (limited to 'libnativeloader/test')
22 files changed, 879 insertions, 199 deletions
diff --git a/libnativeloader/test/Android.bp b/libnativeloader/test/Android.bp index fb9ae0d9d3..b43a02ce4a 100644 --- a/libnativeloader/test/Android.bp +++ b/libnativeloader/test/Android.bp @@ -24,57 +24,114 @@ package { } cc_library { - name: "libfoo.oem1", - srcs: ["test.cpp"], - cflags: ["-DLIBNAME=\"libfoo.oem1.so\""], - shared_libs: [ - "libbase", - ], + name: "libnativeloader_testlib", + srcs: [], + stl: "none", } -cc_library { - name: "libbar.oem1", - srcs: ["test.cpp"], - cflags: ["-DLIBNAME=\"libbar.oem1.so\""], - shared_libs: [ - "libbase", - ], +// This app is just an intermediate container to be able to include the .so +// library in the host test. It's not actually installed or started. +android_test_helper_app { + name: "library_container_app", + defaults: ["art_module_source_build_java_defaults"], + manifest: "library_container_app_manifest.xml", + compile_multilib: "both", + jni_libs: ["libnativeloader_testlib"], } -cc_library { - name: "libfoo.oem2", - srcs: ["test.cpp"], - cflags: ["-DLIBNAME=\"libfoo.oem2.so\""], - shared_libs: [ - "libbase", +java_library { + name: "loadlibrarytest_test_utils", + static_libs: [ + "androidx.test.ext.junit", + "androidx.test.ext.truth", ], + srcs: ["src/android/test/lib/TestUtils.java"], } -cc_library { - name: "libbar.oem2", - srcs: ["test.cpp"], - cflags: ["-DLIBNAME=\"libbar.oem2.so\""], - shared_libs: [ - "libbase", - ], +// Test fixture that represents a shared library in /system/framework. +java_library { + name: "libnativeloader_system_shared_lib", + installable: true, + srcs: ["src/android/test/systemsharedlib/SystemSharedLib.java"], } -cc_library { - name: "libfoo.product1", - srcs: ["test.cpp"], - cflags: ["-DLIBNAME=\"libfoo.product1.so\""], - product_specific: true, - shared_libs: [ - "libbase", +java_defaults { + name: "loadlibrarytest_app_defaults", + defaults: ["art_module_source_build_java_defaults"], + static_libs: [ + "androidx.test.ext.junit", + "androidx.test.rules", + "loadlibrarytest_test_utils", ], + libs: ["libnativeloader_system_shared_lib"], } -cc_library { - name: "libbar.product1", - srcs: ["test.cpp"], - cflags: ["-DLIBNAME=\"libbar.product1.so\""], +android_test_helper_app { + name: "loadlibrarytest_system_priv_app", + defaults: ["loadlibrarytest_app_defaults"], + manifest: "loadlibrarytest_system_priv_app_manifest.xml", + // /system/priv-app currently reuses the same test as /system/app. + srcs: ["src/android/test/app/SystemAppTest.java"], +} + +android_test_helper_app { + name: "loadlibrarytest_system_app", + defaults: ["loadlibrarytest_app_defaults"], + manifest: "loadlibrarytest_system_app_manifest.xml", + srcs: ["src/android/test/app/SystemAppTest.java"], +} + +android_test_helper_app { + name: "loadlibrarytest_system_ext_app", + defaults: ["loadlibrarytest_app_defaults"], + system_ext_specific: true, + manifest: "loadlibrarytest_system_ext_app_manifest.xml", + // /system_ext should behave the same as /system, so use the same test class there. + srcs: ["src/android/test/app/SystemAppTest.java"], +} + +android_test_helper_app { + name: "loadlibrarytest_product_app", + defaults: ["loadlibrarytest_app_defaults"], product_specific: true, - shared_libs: [ - "libbase", + manifest: "loadlibrarytest_product_app_manifest.xml", + srcs: ["src/android/test/app/ProductAppTest.java"], +} + +android_test_helper_app { + name: "loadlibrarytest_vendor_app", + defaults: ["loadlibrarytest_app_defaults"], + vendor: true, + manifest: "loadlibrarytest_vendor_app_manifest.xml", + srcs: ["src/android/test/app/VendorAppTest.java"], +} + +// A normal app installed in /data. +android_test_helper_app { + name: "loadlibrarytest_data_app", + defaults: ["loadlibrarytest_app_defaults"], + manifest: "loadlibrarytest_data_app_manifest.xml", + srcs: ["src/android/test/app/DataAppTest.java"], +} + +java_test_host { + name: "libnativeloader_e2e_tests", + defaults: ["art_module_source_build_java_defaults"], + srcs: ["src/android/test/hostside/*.java"], + libs: [ + "compatibility-tradefed", + "tradefed", + ], + data: [ + ":library_container_app", + ":libnativeloader_system_shared_lib", + ":loadlibrarytest_system_priv_app", + ":loadlibrarytest_system_app", + ":loadlibrarytest_system_ext_app", + ":loadlibrarytest_product_app", + ":loadlibrarytest_vendor_app", + ":loadlibrarytest_data_app", ], + test_config: "libnativeloader_e2e_tests.xml", + test_suites: ["general-tests"], } diff --git a/libnativeloader/test/Android.mk b/libnativeloader/test/Android.mk deleted file mode 100644 index 95fa68af68..0000000000 --- a/libnativeloader/test/Android.mk +++ /dev/null @@ -1,72 +0,0 @@ -# -# Copyright (C) 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := public.libraries-oem1.txt -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE -LOCAL_SRC_FILES:= $(LOCAL_MODULE) -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT_ETC) -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) -LOCAL_MODULE := public.libraries-oem2.txt -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE -LOCAL_SRC_FILES:= $(LOCAL_MODULE) -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT_ETC) -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) -LOCAL_MODULE := public.libraries-product1.txt -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE -LOCAL_SRC_FILES:= $(LOCAL_MODULE) -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC) -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) -LOCAL_PACKAGE_NAME := oemlibrarytest-system -LOCAL_MODULE_TAGS := tests -LOCAL_MANIFEST_FILE := system/AndroidManifest.xml -LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_SDK_VERSION := current -LOCAL_PROGUARD_ENABLED := disabled -LOCAL_MODULE_PATH := $(TARGET_OUT_APPS) -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE -include $(BUILD_PACKAGE) - -include $(CLEAR_VARS) -LOCAL_PACKAGE_NAME := oemlibrarytest-vendor -LOCAL_MODULE_TAGS := tests -LOCAL_MANIFEST_FILE := vendor/AndroidManifest.xml -LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_SDK_VERSION := current -LOCAL_PROGUARD_ENABLED := disabled -LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_APPS) -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../NOTICE -include $(BUILD_PACKAGE) diff --git a/libnativeloader/test/libnativeloader_e2e_tests.xml b/libnativeloader/test/libnativeloader_e2e_tests.xml new file mode 100644 index 0000000000..b1333b0765 --- /dev/null +++ b/libnativeloader/test/libnativeloader_e2e_tests.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2021 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<configuration description="Config for libnativeloader e2e test cases"> + <option name="test-suite-tag" value="libnativeloader_e2e_tests" /> + <option name="test-suite-tag" value="apct" /> + + <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" /> + + <test class="com.android.tradefed.testtype.HostTest" > + <option name="jar" value="libnativeloader_e2e_tests.jar" /> + </test> + + <!-- Only run tests if the device under test is SDK version 31 (Android 12) or above. --> + <object type="module_controller" class="com.android.tradefed.testtype.suite.module.Sdk31ModuleController" /> +</configuration> diff --git a/libnativeloader/test/system/AndroidManifest.xml b/libnativeloader/test/library_container_app_manifest.xml index c3048891a8..20030de7eb 100644 --- a/libnativeloader/test/system/AndroidManifest.xml +++ b/libnativeloader/test/library_container_app_manifest.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - * Copyright (C) 2018 The Android Open Source Project + * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,5 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android.test.app.system"> - - <application> - <activity android:name="android.test.app.TestActivity" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> - + package="android.test.app.container"> </manifest> - diff --git a/libnativeloader/test/loadlibrarytest_data_app_manifest.xml b/libnativeloader/test/loadlibrarytest_data_app_manifest.xml new file mode 100644 index 0000000000..9b663e6d94 --- /dev/null +++ b/libnativeloader/test/loadlibrarytest_data_app_manifest.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.test.app.data"> + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="android.test.app.data" /> + <application> + <uses-library android:name="android.test.systemsharedlib" /> + <uses-native-library android:required="false" android:name="libfoo.oem1.so" /> + <uses-native-library android:required="false" android:name="libbar.oem1.so" /> + <uses-native-library android:required="false" android:name="libfoo.oem2.so" /> + <!--libbar.oem2.so is left out --> + <uses-native-library android:required="false" android:name="libfoo.product1.so" /> + <uses-native-library android:required="false" android:name="libbar.product1.so" /> + </application> +</manifest> + diff --git a/libnativeloader/test/loadlibrarytest_product_app_manifest.xml b/libnativeloader/test/loadlibrarytest_product_app_manifest.xml new file mode 100644 index 0000000000..c1d997aa70 --- /dev/null +++ b/libnativeloader/test/loadlibrarytest_product_app_manifest.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.test.app.product"> + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="android.test.app.product" /> + <application> + <uses-library android:name="android.test.systemsharedlib" /> + <uses-native-library android:required="false" android:name="libfoo.oem1.so" /> + <uses-native-library android:required="false" android:name="libbar.oem1.so" /> + <uses-native-library android:required="false" android:name="libfoo.oem2.so" /> + <!--libbar.oem2.so is left out --> + <uses-native-library android:required="false" android:name="libfoo.product1.so" /> + <uses-native-library android:required="false" android:name="libbar.product1.so" /> + </application> +</manifest> + diff --git a/libnativeloader/test/vendor/AndroidManifest.xml b/libnativeloader/test/loadlibrarytest_system_app_manifest.xml index c4c1a9c210..5c6af09031 100644 --- a/libnativeloader/test/vendor/AndroidManifest.xml +++ b/libnativeloader/test/loadlibrarytest_system_app_manifest.xml @@ -16,16 +16,15 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="android.test.app.vendor"> - + package="android.test.app.system"> + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="android.test.app.system" /> <application> - <activity android:name="android.test.app.TestActivity" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> + <uses-library android:name="android.test.systemsharedlib" /> + <!-- System apps get a shared classloader namespace, so they don't need + uses-native-library entries for anything in /system. --> + <uses-native-library android:required="false" android:name="libfoo.product1.so" /> + <uses-native-library android:required="false" android:name="libbar.product1.so" /> </application> - </manifest> diff --git a/libnativeloader/test/loadlibrarytest_system_ext_app_manifest.xml b/libnativeloader/test/loadlibrarytest_system_ext_app_manifest.xml new file mode 100644 index 0000000000..961f9ba389 --- /dev/null +++ b/libnativeloader/test/loadlibrarytest_system_ext_app_manifest.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.test.app.system_ext"> + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="android.test.app.system_ext" /> + <application> + <uses-library android:name="android.test.systemsharedlib" /> + <!-- System apps get a shared classloader namespace, so they don't need + uses-native-library entries for anything in /system. --> + <uses-native-library android:required="false" android:name="libfoo.product1.so" /> + <uses-native-library android:required="false" android:name="libbar.product1.so" /> + </application> +</manifest> + diff --git a/libnativeloader/test/loadlibrarytest_system_priv_app_manifest.xml b/libnativeloader/test/loadlibrarytest_system_priv_app_manifest.xml new file mode 100644 index 0000000000..f4bf3c094b --- /dev/null +++ b/libnativeloader/test/loadlibrarytest_system_priv_app_manifest.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.test.app.system_priv"> + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="android.test.app.system_priv" /> + <application> + <uses-library android:name="android.test.systemsharedlib" /> + <!-- System apps get a shared classloader namespace, so they don't need + uses-native-library entries for anything in /system. --> + <uses-native-library android:required="false" android:name="libfoo.product1.so" /> + <uses-native-library android:required="false" android:name="libbar.product1.so" /> + </application> +</manifest> + diff --git a/libnativeloader/test/loadlibrarytest_vendor_app_manifest.xml b/libnativeloader/test/loadlibrarytest_vendor_app_manifest.xml new file mode 100644 index 0000000000..1a8cbcc2a8 --- /dev/null +++ b/libnativeloader/test/loadlibrarytest_vendor_app_manifest.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="android.test.app.vendor"> + <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" + android:targetPackage="android.test.app.vendor" /> + <application> + <uses-library android:name="android.test.systemsharedlib" /> + <uses-native-library android:required="false" android:name="libfoo.oem1.so" /> + <uses-native-library android:required="false" android:name="libbar.oem1.so" /> + <uses-native-library android:required="false" android:name="libfoo.oem2.so" /> + <!--libbar.oem2.so is left out --> + <uses-native-library android:required="false" android:name="libfoo.product1.so" /> + <uses-native-library android:required="false" android:name="libbar.product1.so" /> + </application> +</manifest> + diff --git a/libnativeloader/test/public.libraries-oem1.txt b/libnativeloader/test/public.libraries-oem1.txt deleted file mode 100644 index f9433e2a04..0000000000 --- a/libnativeloader/test/public.libraries-oem1.txt +++ /dev/null @@ -1,2 +0,0 @@ -libfoo.oem1.so -libbar.oem1.so diff --git a/libnativeloader/test/public.libraries-oem2.txt b/libnativeloader/test/public.libraries-oem2.txt deleted file mode 100644 index de6bdb08e0..0000000000 --- a/libnativeloader/test/public.libraries-oem2.txt +++ /dev/null @@ -1,2 +0,0 @@ -libfoo.oem2.so -libbar.oem2.so diff --git a/libnativeloader/test/public.libraries-product1.txt b/libnativeloader/test/public.libraries-product1.txt deleted file mode 100644 index 358154c626..0000000000 --- a/libnativeloader/test/public.libraries-product1.txt +++ /dev/null @@ -1,2 +0,0 @@ -libfoo.product1.so -libbar.product1.so diff --git a/libnativeloader/test/runtest.sh b/libnativeloader/test/runtest.sh deleted file mode 100755 index 40beb5b4d5..0000000000 --- a/libnativeloader/test/runtest.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -adb root -adb remount -adb sync -adb shell stop -adb shell start -sleep 5 # wait until device reboots -adb logcat -c; -adb shell am start -n android.test.app.system/android.test.app.TestActivity -adb shell am start -n android.test.app.vendor/android.test.app.TestActivity -adb logcat | grep android.test.app diff --git a/libnativeloader/test/src/android/test/app/DataAppTest.java b/libnativeloader/test/src/android/test/app/DataAppTest.java new file mode 100644 index 0000000000..db97e8ddc0 --- /dev/null +++ b/libnativeloader/test/src/android/test/app/DataAppTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.test.app; + +import android.test.lib.TestUtils; +import android.test.systemsharedlib.SystemSharedLib; +import androidx.test.filters.SmallTest; +import androidx.test.runner.AndroidJUnit4; +import org.junit.Test; +import org.junit.runner.RunWith; + +@SmallTest +@RunWith(AndroidJUnit4.class) +public class DataAppTest { + @Test + public void testLoadExtendedPublicLibraries() { + System.loadLibrary("foo.oem1"); + System.loadLibrary("bar.oem1"); + System.loadLibrary("foo.oem2"); + TestUtils.assertLinkerNamespaceError( + () -> System.loadLibrary("bar.oem2")); // Missing <uses-native-library>. + System.loadLibrary("foo.product1"); + System.loadLibrary("bar.product1"); + } + + @Test + public void testLoadPrivateLibraries() { + TestUtils.assertLinkerNamespaceError(() -> System.loadLibrary("system_private1")); + TestUtils.assertLibraryNotFound(() -> System.loadLibrary("product_private1")); + TestUtils.assertLibraryNotFound(() -> System.loadLibrary("vendor_private1")); + } + + @Test + public void testLoadPrivateLibrariesViaSystemSharedLib() { + // TODO(b/237577392): Fix this use case. + TestUtils.assertLinkerNamespaceError(() -> SystemSharedLib.loadLibrary("system_private2")); + + TestUtils.assertLibraryNotFound(() -> SystemSharedLib.loadLibrary("product_private2")); + TestUtils.assertLibraryNotFound(() -> SystemSharedLib.loadLibrary("vendor_private2")); + } +} diff --git a/libnativeloader/test/src/android/test/app/ProductAppTest.java b/libnativeloader/test/src/android/test/app/ProductAppTest.java new file mode 100644 index 0000000000..a9b8697067 --- /dev/null +++ b/libnativeloader/test/src/android/test/app/ProductAppTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.test.app; + +import android.test.lib.TestUtils; +import android.test.systemsharedlib.SystemSharedLib; +import androidx.test.filters.SmallTest; +import androidx.test.runner.AndroidJUnit4; +import org.junit.Test; +import org.junit.runner.RunWith; + +@SmallTest +@RunWith(AndroidJUnit4.class) +public class ProductAppTest { + @Test + public void testLoadExtendedPublicLibraries() { + System.loadLibrary("foo.oem1"); + System.loadLibrary("bar.oem1"); + System.loadLibrary("foo.oem2"); + TestUtils.assertLinkerNamespaceError( + () -> System.loadLibrary("bar.oem2")); // Missing <uses-native-library>. + System.loadLibrary("foo.product1"); + System.loadLibrary("bar.product1"); + } + + @Test + public void testLoadPrivateLibraries() { + TestUtils.assertLinkerNamespaceError(() -> System.loadLibrary("system_private1")); + System.loadLibrary("product_private1"); + TestUtils.assertLibraryNotFound(() -> System.loadLibrary("vendor_private1")); + } + + @Test + public void testLoadPrivateLibrariesViaSystemSharedLib() { + // TODO(b/237577392): Fix this use case. + TestUtils.assertLinkerNamespaceError(() -> SystemSharedLib.loadLibrary("system_private2")); + + TestUtils.assertLibraryNotFound(() -> SystemSharedLib.loadLibrary("product_private2")); + TestUtils.assertLibraryNotFound(() -> SystemSharedLib.loadLibrary("vendor_private2")); + } +} diff --git a/libnativeloader/test/src/android/test/app/SystemAppTest.java b/libnativeloader/test/src/android/test/app/SystemAppTest.java new file mode 100644 index 0000000000..664447824c --- /dev/null +++ b/libnativeloader/test/src/android/test/app/SystemAppTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.test.app; + +import android.test.lib.TestUtils; +import android.test.systemsharedlib.SystemSharedLib; +import androidx.test.filters.SmallTest; +import androidx.test.runner.AndroidJUnit4; +import org.junit.Test; +import org.junit.runner.RunWith; + +// These tests are run from /system/app, /system/priv-app, and /system_ext/app. +@SmallTest +@RunWith(AndroidJUnit4.class) +public class SystemAppTest { + @Test + public void testLoadExtendedPublicLibraries() { + System.loadLibrary("foo.oem1"); + System.loadLibrary("bar.oem1"); + System.loadLibrary("foo.oem2"); + System.loadLibrary("bar.oem2"); + System.loadLibrary("foo.product1"); + System.loadLibrary("bar.product1"); + } + + @Test + public void testLoadPrivateLibraries() { + System.loadLibrary("system_private1"); + TestUtils.assertLibraryNotFound(() -> System.loadLibrary("product_private1")); + TestUtils.assertLibraryNotFound(() -> System.loadLibrary("vendor_private1")); + } + + @Test + public void testLoadPrivateLibrariesViaSystemSharedLib() { + SystemSharedLib.loadLibrary("system_private2"); + TestUtils.assertLibraryNotFound(() -> SystemSharedLib.loadLibrary("product_private2")); + TestUtils.assertLibraryNotFound(() -> SystemSharedLib.loadLibrary("vendor_private2")); + } +} diff --git a/libnativeloader/test/src/android/test/app/TestActivity.java b/libnativeloader/test/src/android/test/app/TestActivity.java deleted file mode 100644 index a7a455d33d..0000000000 --- a/libnativeloader/test/src/android/test/app/TestActivity.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.test.app; - -import android.app.Activity; -import android.os.Bundle; -import android.util.Log; - -public class TestActivity extends Activity { - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - tryLoadingLib("foo.oem1"); - tryLoadingLib("bar.oem1"); - tryLoadingLib("foo.oem2"); - tryLoadingLib("bar.oem2"); - tryLoadingLib("foo.product1"); - tryLoadingLib("bar.product1"); - } - - private void tryLoadingLib(String name) { - try { - System.loadLibrary(name); - Log.d(getPackageName(), "library " + name + " is successfully loaded"); - } catch (UnsatisfiedLinkError e) { - Log.d(getPackageName(), "failed to load libarary " + name, e); - } - } -} diff --git a/libnativeloader/test/src/android/test/app/VendorAppTest.java b/libnativeloader/test/src/android/test/app/VendorAppTest.java new file mode 100644 index 0000000000..5187ac8c20 --- /dev/null +++ b/libnativeloader/test/src/android/test/app/VendorAppTest.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.test.app; + +import android.test.lib.TestUtils; +import android.test.systemsharedlib.SystemSharedLib; +import androidx.test.filters.SmallTest; +import androidx.test.runner.AndroidJUnit4; +import org.junit.Test; +import org.junit.runner.RunWith; + +@SmallTest +@RunWith(AndroidJUnit4.class) +public class VendorAppTest { + @Test + public void testLoadExtendedPublicLibraries() { + TestUtils.assertLinkerNamespaceError(() -> System.loadLibrary("foo.oem1")); + TestUtils.assertLinkerNamespaceError(() -> System.loadLibrary("bar.oem1")); + TestUtils.assertLinkerNamespaceError(() -> System.loadLibrary("foo.oem2")); + TestUtils.assertLinkerNamespaceError(() -> System.loadLibrary("bar.oem2")); + System.loadLibrary("foo.product1"); + System.loadLibrary("bar.product1"); + } + + @Test + public void testLoadPrivateLibraries() { + TestUtils.assertLinkerNamespaceError(() -> System.loadLibrary("system_private1")); + TestUtils.assertLibraryNotFound(() -> System.loadLibrary("product_private1")); + // TODO(mast): The vendor app fails to load a private vendor library because it gets + // classified as untrusted_app in SELinux, which doesn't have access to vendor_file. Even an + // app in /vendor/priv-app, which gets classified as priv_app, still doesn't have access to + // vendor_file. Check that the test setup is correct and if this is WAI. + TestUtils.assertLibraryNotFound(() -> System.loadLibrary("vendor_private1")); + } + + @Test + public void testLoadPrivateLibrariesViaSystemSharedLib() { + // TODO(b/237577392): Fix this use case. + TestUtils.assertLinkerNamespaceError(() -> SystemSharedLib.loadLibrary("system_private2")); + + TestUtils.assertLibraryNotFound(() -> SystemSharedLib.loadLibrary("product_private2")); + TestUtils.assertLibraryNotFound(() -> SystemSharedLib.loadLibrary("vendor_private2")); + } +} diff --git a/libnativeloader/test/src/android/test/hostside/LibnativeloaderTest.java b/libnativeloader/test/src/android/test/hostside/LibnativeloaderTest.java new file mode 100644 index 0000000000..c908a492e2 --- /dev/null +++ b/libnativeloader/test/src/android/test/hostside/LibnativeloaderTest.java @@ -0,0 +1,328 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.test.hostside; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assertWithMessage; + +import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper; +import com.android.tradefed.build.IBuildInfo; +import com.android.tradefed.device.DeviceNotAvailableException; +import com.android.tradefed.device.ITestDevice; +import com.android.tradefed.invoker.IInvocationContext; +import com.android.tradefed.invoker.TestInformation; +import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; +import com.android.tradefed.testtype.IAbi; +import com.android.tradefed.testtype.junit4.AfterClassWithInfo; +import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; +import com.android.tradefed.testtype.junit4.BeforeClassWithInfo; +import com.android.tradefed.util.CommandResult; +import com.google.common.io.ByteStreams; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Test libnativeloader behavior for apps and libs in various partitions by overlaying them over + * the system partitions. Requires root. + */ +@RunWith(DeviceJUnit4ClassRunner.class) +public class LibnativeloaderTest extends BaseHostJUnit4Test { + private static final String TAG = "LibnativeloaderTest"; + private static final String CLEANUP_PATHS_KEY = TAG + ":CLEANUP_PATHS"; + private static final String LOG_FILE_NAME = "TestActivity.log"; + + @BeforeClassWithInfo + public static void beforeClassWithDevice(TestInformation testInfo) throws Exception { + DeviceContext ctx = new DeviceContext( + testInfo.getContext(), testInfo.getDevice(), testInfo.getBuildInfo()); + + // A soft reboot is slow, so do setup for all tests and reboot once. + + ctx.mDevice.remountSystemWritable(); + + File libContainerApk = ctx.mBuildHelper.getTestFile("library_container_app.apk"); + try (ZipFile libApk = new ZipFile(libContainerApk)) { + ctx.pushExtendedPublicSystemOemLibs(libApk); + ctx.pushExtendedPublicProductLibs(libApk); + ctx.pushPrivateLibs(libApk); + } + ctx.pushSystemSharedLib(); + + // "Install" apps in various partitions through plain adb push followed by a soft reboot. We + // need them in these locations to test library loading restrictions, so for all except + // loadlibrarytest_data_app we cannot use ITestDevice.installPackage for it since it only + // installs in /data. + + // For testSystemPrivApp + ctx.pushApk("loadlibrarytest_system_priv_app", "/system/priv-app"); + + // For testSystemApp + ctx.pushApk("loadlibrarytest_system_app", "/system/app"); + + // For testSystemExtApp + ctx.pushApk("loadlibrarytest_system_ext_app", "/system_ext/app"); + + // For testProductApp + ctx.pushApk("loadlibrarytest_product_app", "/product/app"); + + // For testVendorApp + ctx.pushApk("loadlibrarytest_vendor_app", "/vendor/app"); + + ctx.softReboot(); + + // For testDataApp. Install this the normal way after the system server restart. + ctx.installPackage("loadlibrarytest_data_app"); + + testInfo.properties().put(CLEANUP_PATHS_KEY, ctx.mCleanup.getPathList()); + } + + @AfterClassWithInfo + public static void afterClassWithDevice(TestInformation testInfo) throws Exception { + ITestDevice device = testInfo.getDevice(); + + // Uninstall loadlibrarytest_data_app. + device.uninstallPackage("android.test.app.data"); + + String cleanupPathList = testInfo.properties().get(CLEANUP_PATHS_KEY); + CleanupPaths cleanup = new CleanupPaths(device, cleanupPathList); + cleanup.cleanup(); + } + + @Test + public void testSystemPrivApp() throws Exception { + // There's currently no difference in the tests between /system/priv-app and /system/app, so + // let's reuse the same one. + runDeviceTests("android.test.app.system_priv", "android.test.app.SystemAppTest"); + } + + @Test + public void testSystemApp() throws Exception { + runDeviceTests("android.test.app.system", "android.test.app.SystemAppTest"); + } + + @Test + public void testSystemExtApp() throws Exception { + // /system_ext should behave the same as /system, so run the same test class there. + runDeviceTests("android.test.app.system_ext", "android.test.app.SystemAppTest"); + } + + @Test + public void testProductApp() throws Exception { + runDeviceTests("android.test.app.product", "android.test.app.ProductAppTest"); + } + + @Test + public void testVendorApp() throws Exception { + runDeviceTests("android.test.app.vendor", "android.test.app.VendorAppTest"); + } + + @Test + public void testDataApp() throws Exception { + runDeviceTests("android.test.app.data", "android.test.app.DataAppTest"); + } + + // Utility class that keeps track of a set of paths the need to be deleted after testing. + private static class CleanupPaths { + private ITestDevice mDevice; + private List<String> mCleanupPaths; + + CleanupPaths(ITestDevice device) { + mDevice = device; + mCleanupPaths = new ArrayList<String>(); + } + + CleanupPaths(ITestDevice device, String pathList) { + mDevice = device; + mCleanupPaths = Arrays.asList(pathList.split(":")); + } + + String getPathList() { return String.join(":", mCleanupPaths); } + + // Adds the given path, or its topmost nonexisting parent directory, to the list of paths to + // clean up. + void addPath(String devicePath) throws DeviceNotAvailableException { + File path = new File(devicePath); + while (true) { + File parentPath = path.getParentFile(); + if (parentPath == null || mDevice.doesFileExist(parentPath.toString())) { + break; + } + path = parentPath; + } + String nonExistingPath = path.toString(); + if (!mCleanupPaths.contains(nonExistingPath)) { + mCleanupPaths.add(nonExistingPath); + } + } + + void cleanup() throws DeviceNotAvailableException { + // Clean up in reverse order in case several pushed files were in the same nonexisting + // directory. + for (int i = mCleanupPaths.size() - 1; i >= 0; --i) { + mDevice.deleteFile(mCleanupPaths.get(i)); + } + } + } + + // Class for code that needs an ITestDevice. It is instantiated both in tests and in + // (Before|After)ClassWithInfo. + private static class DeviceContext implements AutoCloseable { + IInvocationContext mContext; + ITestDevice mDevice; + CompatibilityBuildHelper mBuildHelper; + CleanupPaths mCleanup; + private String mTestArch; + + DeviceContext(IInvocationContext context, ITestDevice device, IBuildInfo buildInfo) { + mContext = context; + mDevice = device; + mBuildHelper = new CompatibilityBuildHelper(buildInfo); + mCleanup = new CleanupPaths(mDevice); + } + + public void close() throws DeviceNotAvailableException { mCleanup.cleanup(); } + + void pushExtendedPublicSystemOemLibs(ZipFile libApk) throws Exception { + pushNativeTestLib(libApk, "/system/${LIB}/libfoo.oem1.so"); + pushNativeTestLib(libApk, "/system/${LIB}/libbar.oem1.so"); + pushString("libfoo.oem1.so\n" + + "libbar.oem1.so\n", + "/system/etc/public.libraries-oem1.txt"); + + pushNativeTestLib(libApk, "/system/${LIB}/libfoo.oem2.so"); + pushNativeTestLib(libApk, "/system/${LIB}/libbar.oem2.so"); + pushString("libfoo.oem2.so\n" + + "libbar.oem2.so\n", + "/system/etc/public.libraries-oem2.txt"); + } + + void pushExtendedPublicProductLibs(ZipFile libApk) throws Exception { + pushNativeTestLib(libApk, "/product/${LIB}/libfoo.product1.so"); + pushNativeTestLib(libApk, "/product/${LIB}/libbar.product1.so"); + pushString("libfoo.product1.so\n" + + "libbar.product1.so\n", + "/product/etc/public.libraries-product1.txt"); + } + + void pushPrivateLibs(ZipFile libApk) throws Exception { + // Push the libraries once for each test. Since we cannot unload them, we need a fresh + // never-before-loaded library in each loadLibrary call. + for (int i = 1; i <= 2; ++i) { + pushNativeTestLib(libApk, "/system/${LIB}/libsystem_private" + i + ".so"); + pushNativeTestLib(libApk, "/product/${LIB}/libproduct_private" + i + ".so"); + pushNativeTestLib(libApk, "/vendor/${LIB}/libvendor_private" + i + ".so"); + } + } + + void pushSystemSharedLib() throws Exception { + String packageName = "android.test.systemsharedlib"; + String path = "/system/framework/" + packageName + ".jar"; + pushFile("libnativeloader_system_shared_lib.jar", path); + pushString("<permissions>\n" + + "<library name=\"" + packageName + "\" file=\"" + path + "\" />\n" + + "</permissions>\n", + "system/etc/permissions/" + packageName + ".xml"); + } + + void softReboot() throws DeviceNotAvailableException { + assertCommandSucceeds("setprop dev.bootcomplete 0"); + assertCommandSucceeds("stop"); + assertCommandSucceeds("start"); + mDevice.waitForDeviceAvailable(); + } + + String getTestArch() throws DeviceNotAvailableException { + if (mTestArch == null) { + IAbi abi = mContext.getConfigurationDescriptor().getAbi(); + mTestArch = abi != null ? abi.getName() + : assertCommandSucceeds("getprop ro.bionic.arch"); + } + return mTestArch; + } + + // Pushes the given file contents to the device at the given destination path. destPath is + // assumed to have no risk of overlapping with existing files, and is deleted in tearDown(), + // along with any directory levels that had to be created. + void pushString(String fileContents, String destPath) throws DeviceNotAvailableException { + mCleanup.addPath(destPath); + assertThat(mDevice.pushString(fileContents, destPath)).isTrue(); + } + + // Like pushString, but pushes a data file included in the host test. + void pushFile(String fileName, String destPath) throws Exception { + mCleanup.addPath(destPath); + assertThat(mDevice.pushFile(mBuildHelper.getTestFile(fileName), destPath)).isTrue(); + } + + void pushApk(String apkBaseName, String destPath) throws Exception { + pushFile(apkBaseName + ".apk", + destPath + "/" + apkBaseName + "/" + apkBaseName + ".apk"); + } + + // Like pushString, but extracts libnativeloader_testlib.so from the library_container_app + // APK and pushes it to destPath. "${LIB}" is replaced with "lib" or "lib64" as appropriate. + void pushNativeTestLib(ZipFile libApk, String destPath) throws Exception { + String libApkPath = "lib/" + getTestArch() + "/libnativeloader_testlib.so"; + ZipEntry entry = libApk.getEntry(libApkPath); + assertWithMessage("Failed to find " + libApkPath + " in library_container_app.apk") + .that(entry) + .isNotNull(); + + File libraryTempFile; + try (InputStream inStream = libApk.getInputStream(entry)) { + libraryTempFile = writeStreamToTempFile("libnativeloader_testlib.so", inStream); + } + + String libDir = getTestArch().contains("64") ? "lib64" : "lib"; + destPath = destPath.replace("${LIB}", libDir); + + mCleanup.addPath(destPath); + assertThat(mDevice.pushFile(libraryTempFile, destPath)).isTrue(); + } + + void installPackage(String apkBaseName) throws Exception { + assertThat(mDevice.installPackage(mBuildHelper.getTestFile(apkBaseName + ".apk"), + false /* reinstall */)) + .isNull(); + } + + String assertCommandSucceeds(String command) throws DeviceNotAvailableException { + CommandResult result = mDevice.executeShellV2Command(command); + assertWithMessage(result.toString()).that(result.getExitCode()).isEqualTo(0); + // Remove trailing \n's. + return result.getStdout().trim(); + } + } + + static private File writeStreamToTempFile(String tempFileBaseName, InputStream inStream) + throws Exception { + File hostTempFile = File.createTempFile(tempFileBaseName, null); + try (FileOutputStream outStream = new FileOutputStream(hostTempFile)) { + ByteStreams.copy(inStream, outStream); + } + return hostTempFile; + } +} diff --git a/libnativeloader/test/src/android/test/lib/TestUtils.java b/libnativeloader/test/src/android/test/lib/TestUtils.java new file mode 100644 index 0000000000..eda9993a7f --- /dev/null +++ b/libnativeloader/test/src/android/test/lib/TestUtils.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.test.lib; + +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertThrows; + +import org.junit.function.ThrowingRunnable; + +public final class TestUtils { + public static void assertLibraryNotFound(ThrowingRunnable loadLibrary) { + Throwable t = assertThrows(UnsatisfiedLinkError.class, loadLibrary); + assertThat(t.getMessage()).containsMatch("dlopen failed: library .* not found"); + } + + public static void assertLinkerNamespaceError(ThrowingRunnable loadLibrary) { + Throwable t = assertThrows(UnsatisfiedLinkError.class, loadLibrary); + assertThat(t.getMessage()) + .containsMatch("dlopen failed: .* is not accessible for the namespace"); + } +} diff --git a/libnativeloader/test/test.cpp b/libnativeloader/test/src/android/test/systemsharedlib/SystemSharedLib.java index b166928f0e..8e2af9f79c 100644 --- a/libnativeloader/test/test.cpp +++ b/libnativeloader/test/src/android/test/systemsharedlib/SystemSharedLib.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "oemlib" -#include <android-base/logging.h> -static __attribute__((constructor)) void test_lib_init() { - LOG(DEBUG) << LIBNAME << " loaded"; +package android.test.systemsharedlib; + +public final class SystemSharedLib { + public static void loadLibrary(String name) { System.loadLibrary(name); } } |