summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2017-03-18 16:13:26 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2017-03-21 09:24:12 +0100
commit0f6ddb372bc24a010c85849dfc80f72fc8cd604d (patch)
tree9b25cdc0b3e54803902559b7c3eeb82627fb0513 /org.eclipse.jgit.test
parentcee9d444e97858d441b5de0f4c357bccbe4952f2 (diff)
downloadjgit-0f6ddb372bc24a010c85849dfc80f72fc8cd604d.tar.gz
jgit-0f6ddb372bc24a010c85849dfc80f72fc8cd604d.zip
Add remaining parts of the bazel build
Add bazel build for ui and junit.http, and the test packages. A number of different test labels are supported: api attributes dfs diff http lfs lfs-server nls notes pack patch pgm reftree revplot revwalk storage submodule symlinks transport treewalk util To run all tests: bazel test //... To run specific tests, using labels: bazel test --test_tag_filters=api,dfs,revplot,treewalk //... Change-Id: Ic41b05a79d855212e67b1b4707e9c6b4dc9ea70d Signed-off-by: David Ostrovsky <david@ostrovsky.org> Signed-off-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/BUILD61
-rw-r--r--org.eclipse.jgit.test/tests.bzl51
2 files changed, 112 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/BUILD b/org.eclipse.jgit.test/BUILD
new file mode 100644
index 0000000000..ae6f24223c
--- /dev/null
+++ b/org.eclipse.jgit.test/BUILD
@@ -0,0 +1,61 @@
+load(":tests.bzl", "tests")
+load(
+ "@com_googlesource_gerrit_bazlets//tools:genrule2.bzl",
+ "genrule2",
+)
+
+PKG = "tst/org/eclipse/jgit/"
+
+HELPERS = glob(["src/**/*.java"]) + [PKG + c for c in [
+ "api/AbstractRemoteCommandTest.java",
+ "diff/AbstractDiffTestCase.java",
+ "internal/storage/file/GcTestCase.java",
+ "internal/storage/file/PackIndexTestCase.java",
+ "internal/storage/file/XInputStream.java",
+ "nls/GermanTranslatedBundle.java",
+ "nls/MissingPropertyBundle.java",
+ "nls/NoPropertiesBundle.java",
+ "nls/NonTranslatedBundle.java",
+ "revwalk/RevQueueTestCase.java",
+ "revwalk/RevWalkTestCase.java",
+ "transport/SpiTransport.java",
+ "treewalk/FileTreeIteratorWithTimeControl.java",
+ "treewalk/filter/AlwaysCloneTreeFilter.java",
+ "test/resources/SampleDataRepositoryTestCase.java",
+ "util/CPUTimeStopWatch.java",
+ "util/io/Strings.java",
+]]
+
+DATA = [
+ PKG + "lib/empty.gitindex.dat",
+ PKG + "lib/sorttest.gitindex.dat",
+]
+
+tests(glob(
+ ["tst/**/*.java"],
+ exclude = HELPERS + DATA
+))
+
+java_library(
+ name = "helpers",
+ testonly = 1,
+ srcs = HELPERS,
+ resources = DATA,
+ deps = [
+ "//lib:junit",
+ "//org.eclipse.jgit:jgit",
+ "//org.eclipse.jgit.junit:junit",
+ ],
+)
+
+java_import(
+ name = "tst_rsrc",
+ jars = [":tst_rsrc_jar"],
+)
+
+genrule2(
+ name = 'tst_rsrc_jar',
+ cmd = 'o=$$PWD/$@ && tar cf - $(SRCS) | tar -C $$TMP --strip-components=2 -xf - && cd $$TMP && zip -qr $$o .',
+ srcs = glob(['tst-rsrc/**']),
+ outs = ['tst_rsrc.jar',],
+)
diff --git a/org.eclipse.jgit.test/tests.bzl b/org.eclipse.jgit.test/tests.bzl
new file mode 100644
index 0000000000..d5cc2c9868
--- /dev/null
+++ b/org.eclipse.jgit.test/tests.bzl
@@ -0,0 +1,51 @@
+load(
+ "@com_googlesource_gerrit_bazlets//tools:junit.bzl",
+ "junit_tests",
+)
+
+def tests(tests):
+ for src in tests:
+ name = src[len('tst/'):len(src)-len('.java')].replace('/', '_')
+ labels = []
+ if name.startswith('org_eclipse_jgit_'):
+ l = name[len('org.eclipse.jgit_'):]
+ if l.startswith('internal_storage_'):
+ l = l[len('internal.storage_'):]
+ i = l.find('_')
+ if i > 0:
+ labels.append(l[:i])
+ else:
+ labels.append(i)
+ if 'lib' not in labels:
+ labels.append('lib')
+
+ additional_deps = []
+ if src.endswith("RootLocaleTest.java"):
+ additional_deps = [
+ '//org.eclipse.jgit.pgm:pgm',
+ '//org.eclipse.jgit.ui:ui',
+ ]
+ if src.endswith("WalkEncryptionTest.java"):
+ additional_deps = [
+ '//org.eclipse.jgit:insecure_cipher_factory',
+ ]
+
+ junit_tests(
+ name = name,
+ tags = labels,
+ srcs = [src],
+ deps = additional_deps + [
+ ':helpers',
+ ':tst_rsrc',
+ '//org.eclipse.jgit:jgit',
+ '//org.eclipse.jgit.junit:junit',
+ '//org.eclipse.jgit.lfs:jgit-lfs',
+ '@hamcrest_core//jar',
+ '@hamcrest_library//jar',
+ '@javaewah//jar',
+ '@junit//jar',
+ '@log_api//jar',
+ '@slf4j_simple//jar',
+ ],
+ jvm_flags = ["-Xmx256m", "-Dfile.encoding=UTF-8"],
+ )