Automated rollback of commit 69f0e6483d2be51f7bf6ad5ac549f1ec089ce0e2.

*** Reason for rollback ***

It's blocking blaze nightly.

*** Original change description ***

Remove unused tests.

PiperOrigin-RevId: 453316447
Change-Id: I0e587214cb6839f95dab18e5751bb36db3f31458
diff --git a/src/test/java/com/google/devtools/build/lib/BUILD b/src/test/java/com/google/devtools/build/lib/BUILD
index 8c6f153..e162a66 100644
--- a/src/test/java/com/google/devtools/build/lib/BUILD
+++ b/src/test/java/com/google/devtools/build/lib/BUILD
@@ -65,6 +65,7 @@
         "//src/test/java/com/google/devtools/build/lib/testing/common:srcs",
         "//src/test/java/com/google/devtools/build/lib/testutil:srcs",
         "//src/test/java/com/google/devtools/build/lib/view/cpp:srcs",
+        "//src/test/java/com/google/devtools/build/lib/view/go:srcs",
         "//src/test/java/com/google/devtools/build/lib/view/java:srcs",
         "//src/test/java/com/google/devtools/build/lib/view/util:srcs",
         "//src/test/java/com/google/devtools/build/lib/windows:srcs",
diff --git a/src/test/java/com/google/devtools/build/lib/view/go/BUILD b/src/test/java/com/google/devtools/build/lib/view/go/BUILD
new file mode 100644
index 0000000..c96cf9c
--- /dev/null
+++ b/src/test/java/com/google/devtools/build/lib/view/go/BUILD
@@ -0,0 +1,43 @@
+# TODO(steinman): Go view test cases.
+load("@rules_java//java:defs.bzl", "java_test")
+
+package(
+    default_testonly = 1,
+    default_visibility = ["//src:__subpackages__"],
+)
+
+licenses(["notice"])
+
+filegroup(
+    name = "srcs",
+    testonly = 0,
+    srcs = glob(["*"]),
+    visibility = ["//src:__subpackages__"],
+)
+
+java_test(
+    name = "GoStarlarkApiTest",
+    srcs = ["GoStarlarkApiTest.java"],
+    tags = ["manual"],
+    runtime_deps = ["//src/test/java/com/google/devtools/build/lib/analysis/util"],
+    deps = [
+        "//src/main/java/com/google/devtools/build/lib/analysis:configured_target",
+        "//src/test/java/com/google/devtools/build/lib/analysis/util",
+        "//src/test/java/com/google/devtools/build/lib/packages:testutil",
+        "//third_party:junit4",
+        "//third_party:truth",
+    ],
+)
+
+java_test(
+    name = "GoCompileOnlyTest",
+    srcs = ["GoCompileOnlyTest.java"],
+    tags = ["manual"],
+    runtime_deps = ["//src/test/java/com/google/devtools/build/lib/analysis/util"],
+    deps = [
+        "//src/main/java/com/google/devtools/build/lib/analysis:configured_target",
+        "//src/test/java/com/google/devtools/build/lib/analysis/util",
+        "//third_party:junit4",
+        "//third_party:truth",
+    ],
+)
diff --git a/src/test/java/com/google/devtools/build/lib/view/go/GoCompileOnlyTest.java b/src/test/java/com/google/devtools/build/lib/view/go/GoCompileOnlyTest.java
new file mode 100644
index 0000000..c61910c
--- /dev/null
+++ b/src/test/java/com/google/devtools/build/lib/view/go/GoCompileOnlyTest.java
@@ -0,0 +1,83 @@
+// Copyright 2022 The Bazel Authors. 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.
+package com.google.devtools.build.lib.view.go;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.google.devtools.build.lib.analysis.ConfiguredTarget;
+import com.google.devtools.build.lib.analysis.util.CompileOnlyTestCase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Unit tests that validate --compile_only behavior. */
+@RunWith(JUnit4.class)
+public class GoCompileOnlyTest extends CompileOnlyTestCase {
+
+  @Test
+  public void testGoCompileOnly() throws Exception {
+    scratch.file(
+        "go_test/main/BUILD",
+        "go_binary(",
+        "    name = 'main',",
+        "    deps = ['//go_test/hello'],",
+        "    srcs = ['main.go'],",
+        ")");
+    scratch.file(
+        "go_test/hello/BUILD",
+        "go_test(",
+        "    name = 'hello_test',",
+        "    srcs = [",
+        "        'hello_test.go'",
+        "    ],",
+        "    library = ':hello'",
+        ")",
+        "go_library(",
+        "    name = 'hello',",
+        "    srcs = [",
+        "        'hello.go'",
+        "    ],",
+        ")");
+    scratch.file(
+        "go_test/main/main.go",
+        "package main",
+        "import \"go_test/hello/hello\"",
+        "func main() {",
+        "  hello.Hello();",
+        "}");
+    scratch.file(
+        "go/hello/hello.go",
+        "package hello;",
+        "",
+        "func Hello() {",
+        "  fmt.Println(`Hello!`)",
+        "}");
+    scratch.file(
+        "go_test/hello/hello_test.go",
+        "package hello_test",
+        "import \"testing\"",
+        "func TestHello(t *testing.T) {}");
+
+    ConfiguredTarget binaryTarget = getConfiguredTarget("//go_test/main:main");
+    // Check that only the package been compiled and not the linked binary.
+    assertThat(getArtifactByExecPathSuffix(binaryTarget, "/main.a")).isNotNull();
+    assertThat(getArtifactByExecPathSuffix(binaryTarget, "/main")).isNull();
+
+    ConfiguredTarget libTarget = getConfiguredTarget("//go_test/hello:hello");
+    assertThat(getArtifactByExecPathSuffix(libTarget, "/hello.a")).isNotNull();
+
+    ConfiguredTarget testTarget = getConfiguredTarget("//go_test/hello:hello_test");
+    assertThat(getArtifactByExecPathSuffix(testTarget, "/hello_test_testlib.a")).isNotNull();
+  }
+}
diff --git a/src/test/java/com/google/devtools/build/lib/view/go/GoStarlarkApiTest.java b/src/test/java/com/google/devtools/build/lib/view/go/GoStarlarkApiTest.java
new file mode 100644
index 0000000..bf4d0bb
--- /dev/null
+++ b/src/test/java/com/google/devtools/build/lib/view/go/GoStarlarkApiTest.java
@@ -0,0 +1,72 @@
+// Copyright 2022 The Bazel Authors. 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.
+package com.google.devtools.build.lib.view.go;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.google.devtools.build.lib.analysis.ConfiguredTarget;
+import com.google.devtools.build.lib.analysis.util.BuildViewTestCase;
+import com.google.devtools.build.lib.packages.util.MockProtoSupport;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests Starlark API for Go rules. */
+@RunWith(JUnit4.class)
+public class GoStarlarkApiTest extends BuildViewTestCase {
+
+  /**
+   * Tests that go_proto_library's aspect exposes a Starlark provider "aspect_proto_go_api_info".
+   */
+  @Test
+  public void testGoProtoLibraryAspectProviders() throws Exception {
+    MockProtoSupport.setup(mockToolsConfig);
+    scratch.file(
+        "x/aspect.bzl",
+        "def _foo_aspect_impl(target,ctx):",
+        "  proto_found = hasattr(target, 'aspect_proto_go_api_info')",
+        "  if hasattr(ctx.rule.attr, 'deps'):",
+        "    for dep in ctx.rule.attr.deps:",
+        "      proto_found = proto_found or dep.proto_found",
+        "  return struct(proto_found = proto_found)",
+        "foo_aspect = aspect(",
+        "    _foo_aspect_impl,",
+        "    attr_aspects = ['deps'],",
+        "    required_aspect_providers=['aspect_proto_go_api_info'])",
+        "def _rule_impl(ctx):",
+        "  return struct(result = ctx.attr.dep.proto_found)",
+        "foo_rule = rule(_rule_impl, attrs = {'dep' : attr.label(aspects = [foo_aspect])})");
+    scratch.file(
+        "x/BUILD",
+        "load(':aspect.bzl', 'foo_rule')",
+        "go_proto_library(",
+        "    name = 'foo_go_proto',",
+        "    deps = ['foo_proto'],",
+        ")",
+        "proto_library(",
+        "    name = 'foo_proto',",
+        "    srcs = ['foo.proto'],",
+        ")",
+        "foo_rule(",
+        "    name = 'foo_rule',",
+        "    dep = 'foo_go_proto',",
+        ")");
+    ConfiguredTarget target = getConfiguredTarget("//x:foo_rule");
+    Boolean result = (Boolean) target.get("result");
+
+    // 'result' is true iff "aspect_proto_go_api_info" was found on the proto_library +
+    // go_proto_library aspect.
+    assertThat(result).isTrue();
+  }
+}