xref: /JGit/org.eclipse.jgit.test/tests.bzl (revision 8d2d683655e2de17cf465fa46af10e0e56b3aaed)
10f6ddb37SDavid Ostrovskyload(
20f6ddb37SDavid Ostrovsky    "@com_googlesource_gerrit_bazlets//tools:junit.bzl",
30f6ddb37SDavid Ostrovsky    "junit_tests",
40f6ddb37SDavid Ostrovsky)
50f6ddb37SDavid Ostrovsky
60f6ddb37SDavid Ostrovskydef tests(tests):
70f6ddb37SDavid Ostrovsky    for src in tests:
8487571e6SDavid Pursehouse        name = src[len("tst/"):len(src) - len(".java")].replace("/", "_")
90f6ddb37SDavid Ostrovsky        labels = []
10d8429d27SMatthias Sohn        timeout = "moderate"
11487571e6SDavid Pursehouse        if name.startswith("org_eclipse_jgit_"):
12bbef67e8SDavid Ostrovsky            package = name[len("org.eclipse.jgit_"):]
13bbef67e8SDavid Ostrovsky            if package.startswith("internal_storage_"):
14bbef67e8SDavid Ostrovsky                package = package[len("internal.storage_"):]
15bbef67e8SDavid Ostrovsky            index = package.find("_")
16bbef67e8SDavid Ostrovsky            if index > 0:
17bbef67e8SDavid Ostrovsky                labels.append(package[:index])
180f6ddb37SDavid Ostrovsky            else:
19bbef67e8SDavid Ostrovsky                labels.append(index)
20487571e6SDavid Pursehouse        if "lib" not in labels:
21487571e6SDavid Pursehouse            labels.append("lib")
220f6ddb37SDavid Ostrovsky
236efedb41SJonathan Nieder        # TODO(http://eclip.se/534285): Make this test pass reliably
246efedb41SJonathan Nieder        # and remove the flaky attribute.
256efedb41SJonathan Nieder        flaky = src.endswith("CrissCrossMergeTest.java")
266efedb41SJonathan Nieder
270f6ddb37SDavid Ostrovsky        additional_deps = []
280f6ddb37SDavid Ostrovsky        if src.endswith("RootLocaleTest.java"):
290f6ddb37SDavid Ostrovsky            additional_deps = [
30487571e6SDavid Pursehouse                "//org.eclipse.jgit.pgm:pgm",
31487571e6SDavid Pursehouse                "//org.eclipse.jgit.ui:ui",
320f6ddb37SDavid Ostrovsky            ]
330f6ddb37SDavid Ostrovsky        if src.endswith("WalkEncryptionTest.java"):
340f6ddb37SDavid Ostrovsky            additional_deps = [
35487571e6SDavid Pursehouse                "//org.eclipse.jgit:insecure_cipher_factory",
360f6ddb37SDavid Ostrovsky            ]
37*9b2f8cedSDavid Ostrovsky        if src.endswith("SecurityManagerMissingPermissionsTest.java"):
38*9b2f8cedSDavid Ostrovsky            additional_deps = [
39*9b2f8cedSDavid Ostrovsky                "//lib:log4j",
40*9b2f8cedSDavid Ostrovsky            ]
412532fa74SMatthias Sohn        if src.endswith("JDKHttpConnectionTest.java"):
422532fa74SMatthias Sohn            additional_deps = [
432532fa74SMatthias Sohn                "//lib:mockito",
442532fa74SMatthias Sohn            ]
459f696567SDavid Pursehouse        if src.endswith("TransportHttpTest.java"):
469f696567SDavid Pursehouse            additional_deps = [
479f696567SDavid Pursehouse                "//lib:mockito",
489f696567SDavid Pursehouse            ]
490aa8eca5SDavid Pursehouse        if src.endswith("ArchiveCommandTest.java"):
500aa8eca5SDavid Pursehouse            additional_deps = [
510aa8eca5SDavid Pursehouse                "//lib:commons-compress",
520aa8eca5SDavid Pursehouse                "//lib:xz",
530aa8eca5SDavid Pursehouse                "//org.eclipse.jgit.archive:jgit-archive",
540aa8eca5SDavid Pursehouse            ]
55621880bcSThomas Wolf        heap_size = "-Xmx256m"
56621880bcSThomas Wolf        if src.endswith("HugeCommitMessageTest.java"):
57621880bcSThomas Wolf            heap_size = "-Xmx512m"
58d8429d27SMatthias Sohn        if src.endswith("EolRepositoryTest.java") or src.endswith("GcCommitSelectionTest.java"):
59d8429d27SMatthias Sohn            timeout = "long"
60621880bcSThomas Wolf
610f6ddb37SDavid Ostrovsky        junit_tests(
620f6ddb37SDavid Ostrovsky            name = name,
630f6ddb37SDavid Ostrovsky            tags = labels,
640f6ddb37SDavid Ostrovsky            srcs = [src],
650f6ddb37SDavid Ostrovsky            deps = additional_deps + [
66487571e6SDavid Pursehouse                ":helpers",
67487571e6SDavid Pursehouse                ":tst_rsrc",
68487571e6SDavid Pursehouse                "//lib:javaewah",
69487571e6SDavid Pursehouse                "//lib:junit",
70487571e6SDavid Pursehouse                "//lib:slf4j-api",
71487571e6SDavid Pursehouse                "//org.eclipse.jgit:jgit",
72487571e6SDavid Pursehouse                "//org.eclipse.jgit.junit:junit",
73487571e6SDavid Pursehouse                "//org.eclipse.jgit.lfs:jgit-lfs",
740f6ddb37SDavid Ostrovsky            ],
756efedb41SJonathan Nieder            flaky = flaky,
76621880bcSThomas Wolf            jvm_flags = [heap_size, "-Dfile.encoding=UTF-8"],
77d8429d27SMatthias Sohn            timeout = timeout,
780f6ddb37SDavid Ostrovsky        )
79