aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/ijar/test
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2016-12-21 18:29:04 +0100
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-12-21 18:29:04 +0100
commitf1ce35f4691fa5cd8849bf8944d1a4bdd2393690 (patch)
tree8687d77030d82048b53612e0bce816555dd46dd2 /third_party/ijar/test
parentb649428620711c12ba18f7f1477d36742f267a31 (diff)
Commit 6d31cb was an internal reorganization of google repository that should have resulted in no change. Due to a bug in our export process it deleted several files in third_party.
Diffstat (limited to 'third_party/ijar/test')
-rw-r--r--third_party/ijar/test/BUILD211
-rwxr-xr-xthird_party/ijar/test/testenv.sh38
2 files changed, 249 insertions, 0 deletions
diff --git a/third_party/ijar/test/BUILD b/third_party/ijar/test/BUILD
new file mode 100644
index 0000000000..2687888c52
--- /dev/null
+++ b/third_party/ijar/test/BUILD
@@ -0,0 +1,211 @@
+package(default_visibility = ["//visibility:__pkg__"])
+
+licenses(["notice"]) # Apache License 2.0
+
+exports_files(["LICENSE"])
+
+sh_test(
+ name = "ijar_test",
+ size = "enormous",
+ srcs = ["ijar_test.sh"],
+ args = [
+ "../local_jdk/bin/javac",
+ "../local_jdk/bin/java",
+ "../local_jdk/bin/jar",
+ "../local_jdk/bin/javap",
+ "$(location //third_party/ijar)",
+ "$(location //tools/jdk:langtools)",
+ # We assume unzip and zip to be on the path
+ "unzip",
+ "zip",
+ "$(location :zip_count)",
+ ],
+ data = [
+ "testenv.sh",
+ "//src/test/shell:bashunit",
+ "//third_party/ijar",
+ "A.java",
+ "B.java",
+ "Object.java",
+ "WellCompressed1.java",
+ "WellCompressed2.java",
+ ":libtypeannotations2.jar",
+ ":libmethodparameters.jar",
+ ":source_debug_extension.jar",
+ ":largest_regular.jar",
+ ":smallest_zip64.jar",
+ ":definitely_zip64.jar",
+ ":zip_count",
+ "TypeAnnotationTest2.java",
+ ":libinvokedynamic.jar",
+ # Intentionally bad test JAR: file count in central directory
+ # wrong.
+ "libwrongcentraldir.jar",
+ "//tools/defaults:jdk",
+ "//tools/jdk:langtools",
+ ],
+ shard_count = 5,
+ tags = [
+ "jdk8",
+ "zip",
+ ],
+)
+
+sh_test(
+ name = "zip_test",
+ size = "large",
+ srcs = ["zip_test.sh"],
+ args = [
+ "$(location //third_party/ijar:zipper)",
+ # We assume unzip and zip to be on the path
+ "unzip",
+ "zip",
+ ],
+ data = [
+ "testenv.sh",
+ "//src/test/shell:bashunit",
+ "//third_party/ijar:zipper",
+ ],
+ tags = ["zip"],
+)
+
+java_library(
+ name = "invokedynamic",
+ testonly = 1,
+ srcs = ["invokedynamic/ClassWithLambda.java"],
+ tags = ["jdk8"],
+)
+
+# For testing purposes: a class which exposes a private nested class in
+# public API, classes with annotations and a class with different forms of
+# deprecations markers
+java_library(
+ name = "ijar_testlib",
+ srcs = [
+ "AnnotatedClass.java",
+ "Annotations.java",
+ "DeprecatedParts.java",
+ "DumbClass.java",
+ "EnclosingMethod.java",
+ "PrivateMembersClass.java",
+ ],
+)
+
+# For testing purposes: an interface jar (ijar) which includes the
+# interface view of the various test class from above.
+genrule(
+ name = "interface_ijar_testlib",
+ srcs = [":ijar_testlib"],
+ outs = ["interface_ijar_testlib.jar"],
+ cmd = "$(location //third_party/ijar) $< $@",
+ tools = ["//third_party/ijar"],
+)
+
+java_library(
+ name = "typeannotations2",
+ srcs = glob(["typeannotations2/**/*.java"]),
+ tags = ["jdk8"],
+)
+
+java_library(
+ name = "methodparameters",
+ srcs = ["methodparameters/Test.java"],
+ javacopts = ["-parameters"],
+ tags = ["jdk8"],
+)
+
+java_binary(
+ name = "gen_source_debug_extension",
+ srcs = ["GenSourceDebugExtension.java"],
+ main_class = "test.GenSourceDebugExtension",
+ deps = ["//third_party:asm"],
+)
+
+genrule(
+ name = "gen_source_debug_extension_jar",
+ srcs = [],
+ outs = ["source_debug_extension.jar"],
+ cmd = "$(location :gen_source_debug_extension) $@",
+ tools = ["gen_source_debug_extension"],
+)
+
+java_library(
+ name = "local_and_anonymous_lib",
+ srcs = ["LocalAndAnonymous.java"],
+)
+
+genrule(
+ name = "local_and_anonymous_interface",
+ srcs = [":liblocal_and_anonymous_lib.jar"],
+ outs = ["local_and_anonymous-interface.jar"],
+ cmd = "$(location //third_party/ijar) $< $@",
+ tools = ["//third_party/ijar"],
+)
+
+java_test(
+ name = "IjarTests",
+ size = "small",
+ srcs = [
+ "IjarTests.java",
+ "StripVerifyingVisitor.java",
+ ],
+ data = [
+ "PrivateNestedClass.java",
+ "UseDeprecatedParts.java",
+ "UseRestrictedAnnotation.java",
+ "package-info.java",
+ ":interface_ijar_testlib",
+ ":liblocal_and_anonymous_lib.jar",
+ ":local_and_anonymous-interface.jar",
+ ],
+ tags = ["zip"],
+ test_class = "IjarTests",
+ deps = [
+ "//src/java_tools/buildjar:BazelJavaCompiler",
+ "//third_party:asm",
+ "//third_party:guava",
+ "//third_party:junit4",
+ "//third_party:truth",
+ ],
+)
+
+test_suite(
+ name = "all_tests",
+ testonly = 1,
+ visibility = ["//visibility:public"],
+)
+
+java_binary(
+ name = "gen_zip_with_entries",
+ srcs = ["GenZipWithEntries.java"],
+ jvm_flags = ["-Djdk.util.zip.inhibitZip64=false"],
+ main_class = "test.GenZipWithEntries",
+ deps = ["//third_party:asm"],
+)
+
+[
+ genrule(
+ name = name,
+ outs = [name + ".jar"],
+ cmd = "$(location :gen_zip_with_entries) %s $@" % entries,
+ tools = [":gen_zip_with_entries"],
+ )
+ for name, entries in [
+ ("largest_regular", 65535),
+ ("smallest_zip64", 65536),
+ ("definitely_zip64", 70000),
+ ]
+]
+
+java_binary(
+ name = "zip_count",
+ srcs = ["ZipCount.java"],
+ jvm_flags = ["-Djdk.util.zip.inhibitZip64=false"],
+ main_class = "test.ZipCount",
+)
+
+filegroup(
+ name = "srcs",
+ srcs = glob(["**"]),
+ visibility = ["//third_party/ijar:__pkg__"],
+)
diff --git a/third_party/ijar/test/testenv.sh b/third_party/ijar/test/testenv.sh
new file mode 100755
index 0000000000..235f2c5948
--- /dev/null
+++ b/third_party/ijar/test/testenv.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+#
+# Copyright 2015 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.
+#
+# Setting up the environment for Bazel integration tests.
+#
+
+[ -z "$TEST_SRCDIR" ] && { echo "TEST_SRCDIR not set!" >&2; exit 1; }
+
+# Load the unit-testing framework
+source "${TEST_SRCDIR}/io_bazel/src/test/shell/unittest.bash" || \
+ { echo "Failed to source unittest.bash" >&2; exit 1; }
+
+## OSX/BSD stat and MD5
+PLATFORM="$(uname -s | tr 'A-Z' 'a-z')"
+if [[ "$PLATFORM" = "linux" ]]; then
+ function statfmt() {
+ stat -c "%s" $1
+ }
+ MD5SUM=md5sum
+else
+ function statfmt() {
+ stat -f "%z" $1
+ }
+ MD5SUM=/sbin/md5
+fi