Move some analysis tests to tests/jvm/analysis

PiperOrigin-RevId: 572686226
diff --git a/tests/analysis/BUILD b/tests/analysis/BUILD
index 0533e13..5a90903 100644
--- a/tests/analysis/BUILD
+++ b/tests/analysis/BUILD
@@ -16,13 +16,13 @@
 
 load("//tests/analysis:jvm_compile_test.bzl", jvm_compile_test_suite = "test_suite")
 load("//tests/analysis:jvm_import_test.bzl", jvm_import_test_suite = "test_suite")
-load("//tests/analysis:jvm_library_test.bzl", jvm_library_test_suite = "test_suite")
+load("//tests/analysis:jvm_library_test.bzl", kt_jvm_library_analysis_test_suite = "test_suite")
 load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
 
 licenses(["notice"])
 
 jvm_compile_test_suite(name = "jvm_compile_tests")
 
-jvm_library_test_suite(name = "jvm_library_tests")
+kt_jvm_library_analysis_test_suite(name = "kt_jvm_library_analysis_tests")
 
 jvm_import_test_suite(name = "jvm_import_tests")
diff --git a/tests/analysis/jvm_library/deps/Foo.java b/tests/analysis/jvm_library/deps/Foo.java
deleted file mode 100644
index e675bc1..0000000
--- a/tests/analysis/jvm_library/deps/Foo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * * Copyright 2022 Google LLC. All rights reserved.
- *
- * 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.
- */
-
diff --git a/tests/analysis/jvm_library/deps/Input.kt b/tests/analysis/jvm_library/deps/Input.kt
deleted file mode 100644
index e675bc1..0000000
--- a/tests/analysis/jvm_library/deps/Input.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * * Copyright 2022 Google LLC. All rights reserved.
- *
- * 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.
- */
-
diff --git a/tests/analysis/jvm_library/no_java_srcs/BUILD b/tests/analysis/jvm_library/no_java_srcs/BUILD
deleted file mode 100644
index 66f6fdc..0000000
--- a/tests/analysis/jvm_library/no_java_srcs/BUILD
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2022 Google LLC. All rights reserved.
-#
-# 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("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
-
-package(
-    default_testonly = True,
-)
-
-licenses(["notice"])
-
-jvm_library_test(
-    name = "no_java_srcs_test",
-    target_under_test = kt_for_analysis.kt_jvm_library(
-        name = "no_java_srcs",
-        srcs = [
-            "Input.kt",
-        ],
-    ),
-)
diff --git a/tests/analysis/jvm_library/no_java_srcs/Input.kt b/tests/analysis/jvm_library/no_java_srcs/Input.kt
deleted file mode 100644
index e675bc1..0000000
--- a/tests/analysis/jvm_library/no_java_srcs/Input.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * * Copyright 2022 Google LLC. All rights reserved.
- *
- * 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.
- */
-
diff --git a/tests/analysis/jvm_library/no_kt_srcs/BUILD b/tests/analysis/jvm_library/no_kt_srcs/BUILD
deleted file mode 100644
index 201b669..0000000
--- a/tests/analysis/jvm_library/no_kt_srcs/BUILD
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2022 Google LLC. All rights reserved.
-#
-# 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("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
-
-package(
-    default_testonly = True,
-)
-
-licenses(["notice"])
-
-jvm_library_test(
-    name = "no_kt_srcs_test",
-    target_under_test = kt_for_analysis.kt_jvm_library(
-        name = "no_kt_srcs",
-        srcs = [
-            "Input.java",
-        ],
-    ),
-)
diff --git a/tests/analysis/jvm_library/nodeps/BUILD b/tests/analysis/jvm_library/nodeps/BUILD
deleted file mode 100644
index 90c88a5..0000000
--- a/tests/analysis/jvm_library/nodeps/BUILD
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2022 Google LLC. All rights reserved.
-#
-# 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("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
-
-package(
-    default_testonly = True,
-)
-
-licenses(["notice"])
-
-jvm_library_test(
-    name = "nodeps_test",
-    target_under_test = kt_for_analysis.kt_jvm_library(
-        name = "nodeps",
-        srcs = [
-            "Input.java",
-            "Input.kt",
-        ],
-    ),
-)
diff --git a/tests/analysis/jvm_library/nodeps/Input.java b/tests/analysis/jvm_library/nodeps/Input.java
deleted file mode 100644
index e675bc1..0000000
--- a/tests/analysis/jvm_library/nodeps/Input.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * * Copyright 2022 Google LLC. All rights reserved.
- *
- * 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.
- */
-
diff --git a/tests/analysis/jvm_library/nodeps/Input.kt b/tests/analysis/jvm_library/nodeps/Input.kt
deleted file mode 100644
index e675bc1..0000000
--- a/tests/analysis/jvm_library/nodeps/Input.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * * Copyright 2022 Google LLC. All rights reserved.
- *
- * 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.
- */
-
diff --git a/tests/analysis/jvm_library/only_common_srcs/Input.kt b/tests/analysis/jvm_library/only_common_srcs/Input.kt
deleted file mode 100644
index e675bc1..0000000
--- a/tests/analysis/jvm_library/only_common_srcs/Input.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * * Copyright 2022 Google LLC. All rights reserved.
- *
- * 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.
- */
-
diff --git a/tests/analysis/jvm_library/runtime_deps/Input.kt b/tests/analysis/jvm_library/runtime_deps/Input.kt
deleted file mode 100644
index e675bc1..0000000
--- a/tests/analysis/jvm_library/runtime_deps/Input.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * * Copyright 2022 Google LLC. All rights reserved.
- *
- * 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.
- */
-
diff --git a/tests/analysis/jvm_library/treeartifacts_srcs/Input.kt b/tests/analysis/jvm_library/treeartifacts_srcs/Input.kt
deleted file mode 100644
index e675bc1..0000000
--- a/tests/analysis/jvm_library/treeartifacts_srcs/Input.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * * Copyright 2022 Google LLC. All rights reserved.
- *
- * 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.
- */
-
diff --git a/tests/analysis/jvm_library_test.bzl b/tests/analysis/jvm_library_test.bzl
index e68afd5..3fe1b75 100644
--- a/tests/analysis/jvm_library_test.bzl
+++ b/tests/analysis/jvm_library_test.bzl
@@ -22,8 +22,6 @@
 
 visibility(RULES_KOTLIN)
 
-jvm_library_test = kt_jvm_library_analysis_test
-
 def _coverage_test_impl(ctx):
     env = analysistest.begin(ctx)
     target_under_test = analysistest.target_under_test(env)
diff --git a/tests/analysis/jvm_library/data/BUILD b/tests/jvm/analysis/jvm_library/data/BUILD
similarity index 86%
rename from tests/analysis/jvm_library/data/BUILD
rename to tests/jvm/analysis/jvm_library/data/BUILD
index ecc2760..92350c0 100644
--- a/tests/analysis/jvm_library/data/BUILD
+++ b/tests/jvm/analysis/jvm_library/data/BUILD
@@ -13,15 +13,16 @@
 # limitations under the License.
 
 load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
+load("//kotlin/jvm/testing:jvm_library_analysis_test.bzl", "kt_jvm_library_analysis_test")
 
 package(
+    default_applicable_licenses = ["//:license"],
     default_testonly = True,
 )
 
 licenses(["notice"])
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "data_test",
     expected_runfile_names = [
         "data.txt",
diff --git a/tests/analysis/jvm_library/data/Input.kt b/tests/jvm/analysis/jvm_library/data/Input.kt
similarity index 99%
rename from tests/analysis/jvm_library/data/Input.kt
rename to tests/jvm/analysis/jvm_library/data/Input.kt
index e675bc1..963d749 100644
--- a/tests/analysis/jvm_library/data/Input.kt
+++ b/tests/jvm/analysis/jvm_library/data/Input.kt
@@ -14,3 +14,4 @@
  * limitations under the License.
  */
 
+
diff --git a/tests/analysis/jvm_library/data/data.txt b/tests/jvm/analysis/jvm_library/data/data.txt
similarity index 100%
rename from tests/analysis/jvm_library/data/data.txt
rename to tests/jvm/analysis/jvm_library/data/data.txt
diff --git a/tests/analysis/jvm_library/deps/BUILD b/tests/jvm/analysis/jvm_library/deps/BUILD
similarity index 73%
rename from tests/analysis/jvm_library/deps/BUILD
rename to tests/jvm/analysis/jvm_library/deps/BUILD
index d733b84..fb01c01 100644
--- a/tests/analysis/jvm_library/deps/BUILD
+++ b/tests/jvm/analysis/jvm_library/deps/BUILD
@@ -13,14 +13,40 @@
 # limitations under the License.
 
 load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
+load("//kotlin/jvm/testing:jvm_library_analysis_test.bzl", "kt_jvm_library_analysis_test")
 
 package(
+    default_applicable_licenses = ["//:license"],
     default_testonly = True,
 )
 
 licenses(["notice"])
 
+kt_jvm_library_analysis_test(
+    name = "no_deps_test",
+    target_under_test = kt_for_analysis.kt_jvm_library(
+        name = "no_deps",
+        srcs = [
+            "Input.java",
+            "Input.kt",
+        ],
+    ),
+)
+
+kt_jvm_library_analysis_test(
+    name = "deps_test",
+    target_under_test = kt_for_analysis.kt_jvm_library(
+        name = "deps",
+        srcs = [
+            "Input.java",
+        ],
+        deps = [
+            ":deps_test_java_dep",
+            ":deps_test_kt_dep",
+        ],
+    ),
+)
+
 kt_for_analysis.kt_jvm_library(
     name = "deps_test_kt_dep",
     srcs = [
@@ -34,17 +60,3 @@
         "Input.java",
     ],
 )
-
-jvm_library_test(
-    name = "deps_test",
-    target_under_test = kt_for_analysis.kt_jvm_library(
-        name = "deps",
-        srcs = [
-            "Foo.java",
-        ],
-        deps = [
-            ":deps_test_java_dep",
-            ":deps_test_kt_dep",
-        ],
-    ),
-)
diff --git a/tests/analysis/jvm_library/deps/Input.java b/tests/jvm/analysis/jvm_library/deps/Input.java
similarity index 100%
rename from tests/analysis/jvm_library/deps/Input.java
rename to tests/jvm/analysis/jvm_library/deps/Input.java
diff --git a/tests/analysis/jvm_library/data/Input.kt b/tests/jvm/analysis/jvm_library/deps/Input.kt
similarity index 99%
copy from tests/analysis/jvm_library/data/Input.kt
copy to tests/jvm/analysis/jvm_library/deps/Input.kt
index e675bc1..963d749 100644
--- a/tests/analysis/jvm_library/data/Input.kt
+++ b/tests/jvm/analysis/jvm_library/deps/Input.kt
@@ -14,3 +14,4 @@
  * limitations under the License.
  */
 
+
diff --git a/tests/analysis/jvm_library/friends/BUILD b/tests/jvm/analysis/jvm_library/friends/BUILD
similarity index 66%
rename from tests/analysis/jvm_library/friends/BUILD
rename to tests/jvm/analysis/jvm_library/friends/BUILD
index aac0ad5..f2454f4 100644
--- a/tests/analysis/jvm_library/friends/BUILD
+++ b/tests/jvm/analysis/jvm_library/friends/BUILD
@@ -12,103 +12,99 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-load("//kotlin:rules.bzl", "kt_jvm_library")
-load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
-load("//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS")
+load("//kotlin/jvm/testing:for_analysis.bzl", ktfa = "kt_for_analysis")
+load("//kotlin/jvm/testing:jvm_library_analysis_test.bzl", "kt_jvm_library_analysis_test")
 
 package(
+    default_applicable_licenses = ["//:license"],
     default_testonly = True,
-    default_visibility = ["//tests/analysis/jvm_library/friends:__subpackages__"],
+    default_visibility = ["//tests/jvm/analysis/jvm_library/friends:__subpackages__"],
 )
 
 licenses(["notice"])
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "no_kt_exported_friend_cross_package_test",
     expected_friend_jar_names = [],
-    target_under_test = kt_for_analysis.kt_jvm_library(
+    target_under_test = ktfa.kt_jvm_library(
         name = "no_kt_exported_friend_cross_package",
         srcs = ["Input.kt"],
         deps = [
             # Exports :friend from this package
-            "//tests/analysis/jvm_library/friends/sub:kt_exports_friend",
+            "//tests/jvm/analysis/jvm_library/friends/sub:kt_exports_friend",
         ],
     ),
 )
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "has_java_exported_friend_in_package_test",
     expected_friend_jar_names = [
         "libjava_exports_friend-hjar.jar",
         "libfriend-compile.jar",
     ],
-    target_under_test = kt_for_analysis.kt_jvm_library(
+    target_under_test = ktfa.kt_jvm_library(
         name = "has_java_exported_friend_in_package",
         srcs = ["Input.kt"],
         deps = [":java_exports_friend"],
     ),
 )
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "has_kt_exported_friend_in_package_test",
     expected_friend_jar_names = [
         "libkt_exports_friend-compile.jar",
         "libfriend-compile.jar",
     ],
-    target_under_test = kt_for_analysis.kt_jvm_library(
+    target_under_test = ktfa.kt_jvm_library(
         name = "has_kt_exported_friend_in_package",
         srcs = ["Input.kt"],
         deps = [":kt_exports_friend"],
     ),
 )
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "no_direct_friend_testing_package_test",
     expected_friend_jar_names = [],
-    target_under_test = kt_for_analysis.kt_jvm_library(
+    target_under_test = ktfa.kt_jvm_library(
         name = "no_direct_friend_testing_package",
         srcs = ["Input.kt"],
-        deps = ["//tests/analysis/jvm_library/friends/testing:testingfriend"],
+        deps = ["//tests/jvm/analysis/jvm_library/friends/testing:testingfriend"],
     ),
 )
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "no_direct_friend_subpackage_test",
     expected_friend_jar_names = [],
-    target_under_test = kt_for_analysis.kt_jvm_library(
+    target_under_test = ktfa.kt_jvm_library(
         name = "no_direct_friend_subpackage",
         srcs = ["Input.kt"],
-        deps = ["//tests/analysis/jvm_library/friends/sub:subfriend"],
+        deps = ["//tests/jvm/analysis/jvm_library/friends/sub:subfriend"],
     ),
 )
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "has_direct_friend_in_package_test",
     expected_friend_jar_names = ["libfriend-compile.jar"],
-    target_under_test = kt_for_analysis.kt_jvm_library(
+    target_under_test = ktfa.kt_jvm_library(
         name = "has_direct_friend_in_package",
         srcs = ["Input.kt"],
         deps = [":friend"],
     ),
 )
 
-java_library(
+ktfa.java_library(
     name = "java_exports_friend",
     srcs = ["Input.java"],
-    tags = ONLY_FOR_ANALYSIS_TEST_TAGS,
     exports = [":friend"],
 )
 
-kt_jvm_library(
+ktfa.kt_jvm_library(
     name = "kt_exports_friend",
     srcs = ["Input.kt"],
-    tags = ONLY_FOR_ANALYSIS_TEST_TAGS,
     exports = [":friend"],
 )
 
-kt_jvm_library(
+ktfa.kt_jvm_library(
     name = "friend",
     srcs = ["Input.kt"],
-    tags = ONLY_FOR_ANALYSIS_TEST_TAGS,
 )
diff --git a/tests/analysis/jvm_library/friends/Input.java b/tests/jvm/analysis/jvm_library/friends/Input.java
similarity index 100%
rename from tests/analysis/jvm_library/friends/Input.java
rename to tests/jvm/analysis/jvm_library/friends/Input.java
diff --git a/tests/analysis/jvm_library/friends/Input.kt b/tests/jvm/analysis/jvm_library/friends/Input.kt
similarity index 100%
rename from tests/analysis/jvm_library/friends/Input.kt
rename to tests/jvm/analysis/jvm_library/friends/Input.kt
diff --git a/tests/analysis/jvm_library/friends/sub/BUILD b/tests/jvm/analysis/jvm_library/friends/sub/BUILD
similarity index 79%
rename from tests/analysis/jvm_library/friends/sub/BUILD
rename to tests/jvm/analysis/jvm_library/friends/sub/BUILD
index d009501..d71eb2b 100644
--- a/tests/analysis/jvm_library/friends/sub/BUILD
+++ b/tests/jvm/analysis/jvm_library/friends/sub/BUILD
@@ -14,17 +14,18 @@
 
 load("//kotlin:rules.bzl", "kt_jvm_library")
 load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
+load("//kotlin/jvm/testing:jvm_library_analysis_test.bzl", "kt_jvm_library_analysis_test")
 load("//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS")
 
 package(
+    default_applicable_licenses = ["//:license"],
     default_testonly = True,
-    default_visibility = ["//tests/analysis/jvm_library/friends:__subpackages__"],
+    default_visibility = ["//tests/jvm/analysis/jvm_library/friends:__subpackages__"],
 )
 
 licenses(["notice"])
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "no_kt_exported_friend_cross_package_test",
     expected_friend_jar_names = [
         "libkt_exports_friend-compile.jar",
@@ -37,13 +38,13 @@
     ),
 )
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "no_direct_friend_cross_package_test",
     expected_friend_jar_names = [],
     target_under_test = kt_for_analysis.kt_jvm_library(
         name = "no_direct_friend_cross_package",
         srcs = ["Input.kt"],
-        deps = ["//tests/analysis/jvm_library/friends:friend"],
+        deps = ["//tests/jvm/analysis/jvm_library/friends:friend"],
     ),
 )
 
@@ -51,7 +52,7 @@
     name = "kt_exports_friend",
     srcs = ["Input.kt"],
     tags = ONLY_FOR_ANALYSIS_TEST_TAGS,
-    exports = ["//tests/analysis/jvm_library/friends:friend"],
+    exports = ["//tests/jvm/analysis/jvm_library/friends:friend"],
 )
 
 kt_jvm_library(
diff --git a/tests/analysis/jvm_library/friends/sub/Input.kt b/tests/jvm/analysis/jvm_library/friends/sub/Input.kt
similarity index 100%
rename from tests/analysis/jvm_library/friends/sub/Input.kt
rename to tests/jvm/analysis/jvm_library/friends/sub/Input.kt
diff --git a/tests/analysis/jvm_library/friends/testing/BUILD b/tests/jvm/analysis/jvm_library/friends/testing/BUILD
similarity index 79%
rename from tests/analysis/jvm_library/friends/testing/BUILD
rename to tests/jvm/analysis/jvm_library/friends/testing/BUILD
index 71ce0bc..cd93965 100644
--- a/tests/analysis/jvm_library/friends/testing/BUILD
+++ b/tests/jvm/analysis/jvm_library/friends/testing/BUILD
@@ -14,17 +14,18 @@
 
 load("//kotlin:rules.bzl", "kt_jvm_library")
 load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
+load("//kotlin/jvm/testing:jvm_library_analysis_test.bzl", "kt_jvm_library_analysis_test")
 load("//tests/analysis:util.bzl", "ONLY_FOR_ANALYSIS_TEST_TAGS")
 
 package(
+    default_applicable_licenses = ["//:license"],
     default_testonly = True,
-    default_visibility = ["//tests/analysis/jvm_library/friends:__subpackages__"],
+    default_visibility = ["//tests/jvm/analysis/jvm_library/friends:__subpackages__"],
 )
 
 licenses(["notice"])
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "has_kt_exported_friend_impl_package_test",
     expected_friend_jar_names = [
         "libkt_exports_friend-compile.jar",
@@ -37,7 +38,7 @@
     ),
 )
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "has_direct_friend_impl_package_test",
     expected_friend_jar_names = [
         "libfriend-compile.jar",
@@ -45,11 +46,11 @@
     target_under_test = kt_for_analysis.kt_jvm_library(
         name = "has_direct_friend_impl_package",
         srcs = ["Input.kt"],
-        deps = ["//tests/analysis/jvm_library/friends:friend"],
+        deps = ["//tests/jvm/analysis/jvm_library/friends:friend"],
     ),
 )
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "no_kt_exported_friend_sibling_package_test",
     expected_friend_jar_names = [
         "libkt_exports_subfriend-compile.jar",
@@ -62,13 +63,13 @@
     ),
 )
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "no_direct_friend_sibling_package_test",
     expected_friend_jar_names = [],
     target_under_test = kt_for_analysis.kt_jvm_library(
         name = "no_direct_friend_sibling_package",
         srcs = ["Input.kt"],
-        deps = ["//tests/analysis/jvm_library/friends/sub:subfriend"],
+        deps = ["//tests/jvm/analysis/jvm_library/friends/sub:subfriend"],
     ),
 )
 
@@ -76,14 +77,14 @@
     name = "kt_exports_subfriend",
     srcs = ["Input.kt"],
     tags = ONLY_FOR_ANALYSIS_TEST_TAGS,
-    exports = ["//tests/analysis/jvm_library/friends/sub:subfriend"],
+    exports = ["//tests/jvm/analysis/jvm_library/friends/sub:subfriend"],
 )
 
 kt_jvm_library(
     name = "kt_exports_friend",
     srcs = ["Input.kt"],
     tags = ONLY_FOR_ANALYSIS_TEST_TAGS,
-    exports = ["//tests/analysis/jvm_library/friends:friend"],
+    exports = ["//tests/jvm/analysis/jvm_library/friends:friend"],
 )
 
 kt_jvm_library(
diff --git a/tests/analysis/jvm_library/friends/testing/Input.kt b/tests/jvm/analysis/jvm_library/friends/testing/Input.kt
similarity index 100%
rename from tests/analysis/jvm_library/friends/testing/Input.kt
rename to tests/jvm/analysis/jvm_library/friends/testing/Input.kt
diff --git a/tests/jvm/analysis/jvm_library/no_srcs/BUILD b/tests/jvm/analysis/jvm_library/no_srcs/BUILD
new file mode 100644
index 0000000..f0a3a30
--- /dev/null
+++ b/tests/jvm/analysis/jvm_library/no_srcs/BUILD
@@ -0,0 +1,53 @@
+# Copyright 2022 Google LLC. All rights reserved.
+#
+# 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("//kotlin/common/testing:testing_rules.bzl", "kt_testing_rules")
+load("//kotlin/jvm/testing:for_analysis.bzl", ktfa = "kt_for_analysis")
+load("//kotlin/jvm/testing:jvm_library_analysis_test.bzl", "kt_jvm_library_analysis_test")
+
+package(
+    default_applicable_licenses = ["//:license"],
+    default_testonly = True,
+)
+
+licenses(["notice"])
+
+kt_testing_rules.assert_failure_test(
+    name = "no_srcs_test",
+    msg_contains = "Expected a source-bearing or an export-oriented target",
+    target_under_test = ktfa.kt_jvm_library(
+        name = "no_srcs",
+        srcs = [],
+    ),
+)
+
+kt_jvm_library_analysis_test(
+    name = "only_kt_srcs_test",
+    target_under_test = ktfa.kt_jvm_library(
+        name = "only_kt_srcs",
+        srcs = [
+            "Input.kt",
+        ],
+    ),
+)
+
+kt_jvm_library_analysis_test(
+    name = "only_java_srcs_test",
+    target_under_test = ktfa.kt_jvm_library(
+        name = "only_java_srcs",
+        srcs = [
+            "Input.java",
+        ],
+    ),
+)
diff --git a/tests/analysis/jvm_library/no_kt_srcs/Input.java b/tests/jvm/analysis/jvm_library/no_srcs/Input.java
similarity index 100%
rename from tests/analysis/jvm_library/no_kt_srcs/Input.java
rename to tests/jvm/analysis/jvm_library/no_srcs/Input.java
diff --git a/tests/analysis/jvm_library/data/Input.kt b/tests/jvm/analysis/jvm_library/no_srcs/Input.kt
similarity index 99%
copy from tests/analysis/jvm_library/data/Input.kt
copy to tests/jvm/analysis/jvm_library/no_srcs/Input.kt
index e675bc1..963d749 100644
--- a/tests/analysis/jvm_library/data/Input.kt
+++ b/tests/jvm/analysis/jvm_library/no_srcs/Input.kt
@@ -14,3 +14,4 @@
  * limitations under the License.
  */
 
+
diff --git a/tests/analysis/jvm_library/only_common_srcs/BUILD b/tests/jvm/analysis/jvm_library/only_common_srcs/BUILD
similarity index 84%
rename from tests/analysis/jvm_library/only_common_srcs/BUILD
rename to tests/jvm/analysis/jvm_library/only_common_srcs/BUILD
index c26bcee..a91cff7 100644
--- a/tests/analysis/jvm_library/only_common_srcs/BUILD
+++ b/tests/jvm/analysis/jvm_library/only_common_srcs/BUILD
@@ -13,15 +13,16 @@
 # limitations under the License.
 
 load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
+load("//kotlin/jvm/testing:jvm_library_analysis_test.bzl", "kt_jvm_library_analysis_test")
 
 package(
+    default_applicable_licenses = ["//:license"],
     default_testonly = True,
 )
 
 licenses(["notice"])
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "only_common_srcs_test",
     target_under_test = kt_for_analysis.kt_jvm_library(
         name = "only_common_srcs",
diff --git a/tests/analysis/jvm_library/data/Input.kt b/tests/jvm/analysis/jvm_library/only_common_srcs/Input.kt
similarity index 99%
copy from tests/analysis/jvm_library/data/Input.kt
copy to tests/jvm/analysis/jvm_library/only_common_srcs/Input.kt
index e675bc1..963d749 100644
--- a/tests/analysis/jvm_library/data/Input.kt
+++ b/tests/jvm/analysis/jvm_library/only_common_srcs/Input.kt
@@ -14,3 +14,4 @@
  * limitations under the License.
  */
 
+
diff --git a/tests/analysis/jvm_library/runtime_deps/BUILD b/tests/jvm/analysis/jvm_library/runtime_deps/BUILD
similarity index 85%
rename from tests/analysis/jvm_library/runtime_deps/BUILD
rename to tests/jvm/analysis/jvm_library/runtime_deps/BUILD
index 5e17e71..aaea117 100644
--- a/tests/analysis/jvm_library/runtime_deps/BUILD
+++ b/tests/jvm/analysis/jvm_library/runtime_deps/BUILD
@@ -13,9 +13,10 @@
 # limitations under the License.
 
 load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
+load("//kotlin/jvm/testing:jvm_library_analysis_test.bzl", "kt_jvm_library_analysis_test")
 
 package(
+    default_applicable_licenses = ["//:license"],
     default_testonly = True,
 )
 
@@ -26,7 +27,7 @@
     srcs = [],
 )
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "runtime_deps_test",
     target_under_test = kt_for_analysis.kt_jvm_library(
         name = "runtime_deps",
diff --git a/tests/analysis/jvm_library/runtime_deps/Input.java b/tests/jvm/analysis/jvm_library/runtime_deps/Input.java
similarity index 100%
rename from tests/analysis/jvm_library/runtime_deps/Input.java
rename to tests/jvm/analysis/jvm_library/runtime_deps/Input.java
diff --git a/tests/analysis/jvm_library/data/Input.kt b/tests/jvm/analysis/jvm_library/runtime_deps/Input.kt
similarity index 99%
copy from tests/analysis/jvm_library/data/Input.kt
copy to tests/jvm/analysis/jvm_library/runtime_deps/Input.kt
index e675bc1..963d749 100644
--- a/tests/analysis/jvm_library/data/Input.kt
+++ b/tests/jvm/analysis/jvm_library/runtime_deps/Input.kt
@@ -14,3 +14,4 @@
  * limitations under the License.
  */
 
+
diff --git a/tests/analysis/jvm_library/treeartifacts_srcs/BUILD b/tests/jvm/analysis/jvm_library/treeartifacts_srcs/BUILD
similarity index 100%
rename from tests/analysis/jvm_library/treeartifacts_srcs/BUILD
rename to tests/jvm/analysis/jvm_library/treeartifacts_srcs/BUILD
diff --git a/tests/analysis/jvm_library/treeartifacts_srcs/Input.java b/tests/jvm/analysis/jvm_library/treeartifacts_srcs/Input.java
similarity index 100%
rename from tests/analysis/jvm_library/treeartifacts_srcs/Input.java
rename to tests/jvm/analysis/jvm_library/treeartifacts_srcs/Input.java
diff --git a/tests/analysis/jvm_library/data/Input.kt b/tests/jvm/analysis/jvm_library/treeartifacts_srcs/Input.kt
similarity index 99%
copy from tests/analysis/jvm_library/data/Input.kt
copy to tests/jvm/analysis/jvm_library/treeartifacts_srcs/Input.kt
index e675bc1..963d749 100644
--- a/tests/analysis/jvm_library/data/Input.kt
+++ b/tests/jvm/analysis/jvm_library/treeartifacts_srcs/Input.kt
@@ -14,3 +14,4 @@
  * limitations under the License.
  */
 
+
diff --git a/tests/jvm/java/neverlink/BUILD b/tests/jvm/java/neverlink/BUILD
index 9053ec8..a25ac73 100644
--- a/tests/jvm/java/neverlink/BUILD
+++ b/tests/jvm/java/neverlink/BUILD
@@ -13,11 +13,11 @@
 # limitations under the License.
 
 load("//kotlin/jvm/testing:for_analysis.bzl", "kt_for_analysis")
-load("//tests/analysis:jvm_library_test.bzl", "jvm_library_test")
+load("//kotlin/jvm/testing:jvm_library_analysis_test.bzl", "kt_jvm_library_analysis_test")
 
 licenses(["notice"])
 
-jvm_library_test(
+kt_jvm_library_analysis_test(
     name = "neverlinked_input_library_test",
     expect_neverlink = True,
     target_under_test = kt_for_analysis.kt_jvm_library(