Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a9b888b authored by Chenbo Feng's avatar Chenbo Feng Committed by android-build-merger
Browse files

Merge "Add smoke test for jni library"

am: b0b16605

Change-Id: Iedb44739539f63090b067c1a25d4e83c333caddb
parents 3b4698c3 b0b16605
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ java_defaults {
        "libselinux",
        "libui",
        "libutils",
        "libvintf",
        "libvndksupport",
        "libtinyxml2",
        "libunwindstack",
+17 −0
Original line number Diff line number Diff line
// 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"],
}
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 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="com.android.frameworks.tests.net.smoketest">
    <application>
        <uses-library android:name="android.test.runner" />
    </application>

    <instrumentation
        android:name="androidx.test.runner.AndroidJUnitRunner"
        android:targetPackage="com.android.frameworks.tests.net.smoketest"
        android:label="Frameworks Networking Smoke Tests" />
</manifest>
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 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="Runs Frameworks Networking Smoke Tests.">
    <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
        <option name="test-file-name" value="FrameworksNetSmokeTests.apk" />
    </target_preparer>

    <option name="test-suite-tag" value="apct" />
    <option name="test-tag" value="FrameworksNetSmokeTests" />
    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="com.android.frameworks.tests.net.smoketest" />
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
        <option name="hidden-api-checks" value="false"/>
    </test>
</configuration>
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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 com.android.server.net;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public final class SmokeTest {

    @Test
    public void testLoadJni() {
        System.loadLibrary("networkstatsfactorytestjni");
        assertEquals(0, 0x00);
    }
}