summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tests.bzl
blob: 17a45ca4b2b0b42843d9039b0cb7b16555e0c1b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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 = []
        timeout = "moderate"
        if name.startswith("org_eclipse_jgit_"):
            package = name[len("org.eclipse.jgit_"):]
            if package.startswith("internal_storage_"):
                package = package[len("internal.storage_"):]
            index = package.find("_")
            if index > 0:
                labels.append(package[:index])
            else:
                labels.append(index)
        if "lib" not in labels:
            labels.append("lib")

        # TODO(http://eclip.se/534285): Make this test pass reliably
        # and remove the flaky attribute.
        flaky = src.endswith("CrissCrossMergeTest.java")

        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",
            ]
        if src.endswith("OpenSshConfigTest.java"):
            additional_deps = [
                "//lib:jsch",
            ]
        if src.endswith("JschConfigSessionFactoryTest.java"):
            additional_deps = [
                "//lib:jsch",
            ]
        if src.endswith("JSchSshTest.java"):
            additional_deps = [
                "//lib:jsch",
                "//lib:jzlib",
                "//lib:sshd-osgi",
                "//lib:sshd-sftp",
                ":sshd-helpers",
            ]
        if src.endswith("JDKHttpConnectionTest.java"):
            additional_deps = [
                "//lib:mockito",
            ]
        if src.endswith("TransportHttpTest.java"):
            additional_deps = [
                "//lib:mockito",
            ]
        heap_size = "-Xmx256m"
        if src.endswith("HugeCommitMessageTest.java"):
            heap_size = "-Xmx512m"
        if src.endswith("EolRepositoryTest.java") or src.endswith("GcCommitSelectionTest.java"):
            timeout = "long"

        junit_tests(
            name = name,
            tags = labels,
            srcs = [src],
            deps = additional_deps + [
                ":helpers",
                ":tst_rsrc",
                "//lib:javaewah",
                "//lib:junit",
                "//lib:slf4j-api",
                "//org.eclipse.jgit:jgit",
                "//org.eclipse.jgit.junit:junit",
                "//org.eclipse.jgit.lfs:jgit-lfs",
            ],
            flaky = flaky,
            jvm_flags = [heap_size, "-Dfile.encoding=UTF-8"],
            timeout = timeout,
        )