From ba01e6c570550c16538ab031bac302b916ec1c20 Mon Sep 17 00:00:00 2001 From: Chenbo Feng Date: Fri, 5 Apr 2019 14:14:55 -0700 Subject: [PATCH] Add smoke test for jni library Since the Framework net test require jni library libnetworkstatsfactorytestjni, but the test fails to load that library unless *all* the dependencies of that library are explicitly listed in jni_libs, whenever any of the dependencies changes the framework net test will start failing and it might not be catched since the change might not related to frameworks/base. And this smoke test is aimed to spot those native library changes and it should be stable enough to put in global presubmit. Bug: 124764595 Test: FrameworksNetSmokeTests Change-Id: Id24e7f0558b5643e4ad7393e85f1f0a2bd875615 --- tests/net/Android.bp | 1 - tests/net/smoketest/Android.bp | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/net/smoketest/Android.bp diff --git a/tests/net/Android.bp b/tests/net/Android.bp index c8ef82ec9a..9098f90fd7 100644 --- a/tests/net/Android.bp +++ b/tests/net/Android.bp @@ -49,7 +49,6 @@ java_defaults { "libselinux", "libui", "libutils", - "libvintf", "libvndksupport", "libtinyxml2", "libunwindstack", diff --git a/tests/net/smoketest/Android.bp b/tests/net/smoketest/Android.bp new file mode 100644 index 0000000000..ef1ad2cba8 --- /dev/null +++ b/tests/net/smoketest/Android.bp @@ -0,0 +1,17 @@ +// This test exists only because the jni_libs list for these tests is difficult to +// maintain: the test itself only depends on libnetworkstatsfactorytestjni, but the test +// fails to load that library unless *all* the dependencies of that library are explicitly +// listed in jni_libs. This means that whenever any of the dependencies changes the test +// starts failing and breaking presubmits in frameworks/base. We cannot easily put +// FrameworksNetTests into global presubmit because they are at times flaky, but this +// test is effectively empty beyond validating that the libraries load correctly, and +// thus should be stable enough to put in global presubmit. +// +// TODO: remove this hack when there is a better solution for jni_libs that includes +// dependent libraries. +android_test { + name: "FrameworksNetSmokeTests", + defaults: ["FrameworksNetTests-jni-defaults"], + srcs: ["java/SmokeTest.java"], + test_suites: ["device-tests"], +}