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

Commit d92d1e4c authored by Azhara Assanova's avatar Azhara Assanova
Browse files

Enable Android Lint tests for AndroidFrameworkLintChecker

Create AndroidFrameworkLintCheckerTest module and add
.allowMissingSdk(true) to all tests to enable tests running on gerrit.

"unit_test: true" marks the module as a unit test target which runs it
on the host without a device and it automatically gets onboarded in the
presubmit.

Bug: 157626959
Test: atest AndroidFrameworkLintCheckerTest --host
Change-Id: I66c6e331e72dfca45d341a49eb43fbd73ccd28ff
parent 8afcc7d5
Loading
Loading
Loading
Loading
+13 −13
Original line number Original line Diff line number Diff line
@@ -31,16 +31,16 @@ java_library_host {
    ],
    ],
}
}


// TODO: (b/162368644) Implement these (working in gradle) Kotlin Tests to run on Soong
java_test_host {
//java_test_host {
    name: "AndroidFrameworkLintCheckerTest",
//    name: "AndroidFrameworkLintCheckerTest",
    srcs: ["checks/src/test/java/**/*.kt"],
//    srcs: [
    static_libs: [
//     "checks/src/test/java/**/*.kt",
        "AndroidFrameworkLintChecker",
//     "checks/src/main/java/**/*.kt",
        "junit",
//    ],
        "lint",
//    plugins: ["auto_service_plugin"],
        "lint_tests",
//    static_libs: [
    ],
//        "auto_service_annotations",
    test_options: {
//        "lint_api",
        unit_test: true,
//    ],
    },
//}
}
+3 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.google.android.lint


import com.android.tools.lint.checks.infrastructure.LintDetectorTest
import com.android.tools.lint.checks.infrastructure.LintDetectorTest
import com.android.tools.lint.checks.infrastructure.TestFile
import com.android.tools.lint.checks.infrastructure.TestFile
import com.android.tools.lint.checks.infrastructure.TestLintTask
import com.android.tools.lint.detector.api.Detector
import com.android.tools.lint.detector.api.Detector
import com.android.tools.lint.detector.api.Issue
import com.android.tools.lint.detector.api.Issue


@@ -34,6 +35,8 @@ class CallingIdentityTokenDetectorTest : LintDetectorTest() {
            CallingIdentityTokenDetector.ISSUE_CLEAR_IDENTITY_CALL_NOT_FOLLOWED_BY_TRY_FINALLY
            CallingIdentityTokenDetector.ISSUE_CLEAR_IDENTITY_CALL_NOT_FOLLOWED_BY_TRY_FINALLY
    )
    )


    override fun lint(): TestLintTask = super.lint().allowMissingSdk(true)

    /** No issue scenario */
    /** No issue scenario */


    fun testDoesNotDetectIssuesInCorrectScenario() {
    fun testDoesNotDetectIssuesInCorrectScenario() {