60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
# 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.
|
|
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
|
|
load(":java_system_modules.bzl", "SystemInfo", "java_system_modules")
|
|
load(":rules.bzl", "java_import")
|
|
|
|
def _java_system_modules_test_impl(ctx):
|
|
env = analysistest.begin(ctx)
|
|
java_system_modules_target = analysistest.target_under_test(env)
|
|
|
|
asserts.true(
|
|
env,
|
|
java_system_modules_target[SystemInfo].system.is_directory,
|
|
"java_system_modules output should be a directory.",
|
|
)
|
|
return analysistest.end(env)
|
|
|
|
java_system_modules_test = analysistest.make(
|
|
_java_system_modules_test_impl,
|
|
)
|
|
|
|
def test_java_system_modules_provider():
|
|
name = "test_java_system_modules_provider"
|
|
import_target = ":" + name + "_import"
|
|
java_system_modules(
|
|
name = name + "_target",
|
|
deps = [import_target],
|
|
tags = ["manual"],
|
|
)
|
|
java_system_modules_test(
|
|
name = name,
|
|
target_under_test = name + "_target",
|
|
)
|
|
|
|
java_import(
|
|
name = import_target[1:],
|
|
jars = ["some_jar.jar"],
|
|
tags = ["manual"],
|
|
)
|
|
return name
|
|
|
|
def java_system_modules_test_suite(name):
|
|
native.test_suite(
|
|
name = name,
|
|
tests = [
|
|
test_java_system_modules_provider(),
|
|
],
|
|
)
|