xref: /JGit/org.eclipse.jgit.test/tests.bzl (revision 8d2d683655e2de17cf465fa46af10e0e56b3aaed)
1load(
2    "@com_googlesource_gerrit_bazlets//tools:junit.bzl",
3    "junit_tests",
4)
5
6def tests(tests):
7    for src in tests:
8        name = src[len("tst/"):len(src) - len(".java")].replace("/", "_")
9        labels = []
10        timeout = "moderate"
11        if name.startswith("org_eclipse_jgit_"):
12            package = name[len("org.eclipse.jgit_"):]
13            if package.startswith("internal_storage_"):
14                package = package[len("internal.storage_"):]
15            index = package.find("_")
16            if index > 0:
17                labels.append(package[:index])
18            else:
19                labels.append(index)
20        if "lib" not in labels:
21            labels.append("lib")
22
23        # TODO(http://eclip.se/534285): Make this test pass reliably
24        # and remove the flaky attribute.
25        flaky = src.endswith("CrissCrossMergeTest.java")
26
27        additional_deps = []
28        if src.endswith("RootLocaleTest.java"):
29            additional_deps = [
30                "//org.eclipse.jgit.pgm:pgm",
31                "//org.eclipse.jgit.ui:ui",
32            ]
33        if src.endswith("WalkEncryptionTest.java"):
34            additional_deps = [
35                "//org.eclipse.jgit:insecure_cipher_factory",
36            ]
37        if src.endswith("SecurityManagerMissingPermissionsTest.java"):
38            additional_deps = [
39                "//lib:log4j",
40            ]
41        if src.endswith("JDKHttpConnectionTest.java"):
42            additional_deps = [
43                "//lib:mockito",
44            ]
45        if src.endswith("TransportHttpTest.java"):
46            additional_deps = [
47                "//lib:mockito",
48            ]
49        if src.endswith("ArchiveCommandTest.java"):
50            additional_deps = [
51                "//lib:commons-compress",
52                "//lib:xz",
53                "//org.eclipse.jgit.archive:jgit-archive",
54            ]
55        heap_size = "-Xmx256m"
56        if src.endswith("HugeCommitMessageTest.java"):
57            heap_size = "-Xmx512m"
58        if src.endswith("EolRepositoryTest.java") or src.endswith("GcCommitSelectionTest.java"):
59            timeout = "long"
60
61        junit_tests(
62            name = name,
63            tags = labels,
64            srcs = [src],
65            deps = additional_deps + [
66                ":helpers",
67                ":tst_rsrc",
68                "//lib:javaewah",
69                "//lib:junit",
70                "//lib:slf4j-api",
71                "//org.eclipse.jgit:jgit",
72                "//org.eclipse.jgit.junit:junit",
73                "//org.eclipse.jgit.lfs:jgit-lfs",
74            ],
75            flaky = flaky,
76            jvm_flags = [heap_size, "-Dfile.encoding=UTF-8"],
77            timeout = timeout,
78        )
79