xref: /JGit/org.eclipse.jgit.test/tests.bzl (revision 621880bc9cafe547596bbd3c863a3a08780b13e4)
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:
80f6ddb37SDavid Ostrovsky    name = src[len('tst/'):len(src)-len('.java')].replace('/', '_')
90f6ddb37SDavid Ostrovsky    labels = []
100f6ddb37SDavid Ostrovsky    if name.startswith('org_eclipse_jgit_'):
110f6ddb37SDavid Ostrovsky      l = name[len('org.eclipse.jgit_'):]
120f6ddb37SDavid Ostrovsky      if l.startswith('internal_storage_'):
130f6ddb37SDavid Ostrovsky        l = l[len('internal.storage_'):]
140f6ddb37SDavid Ostrovsky      i = l.find('_')
150f6ddb37SDavid Ostrovsky      if i > 0:
160f6ddb37SDavid Ostrovsky        labels.append(l[:i])
170f6ddb37SDavid Ostrovsky      else:
180f6ddb37SDavid Ostrovsky        labels.append(i)
190f6ddb37SDavid Ostrovsky    if 'lib' not in labels:
200f6ddb37SDavid Ostrovsky      labels.append('lib')
210f6ddb37SDavid Ostrovsky
226efedb41SJonathan Nieder    # TODO(http://eclip.se/534285): Make this test pass reliably
236efedb41SJonathan Nieder    # and remove the flaky attribute.
246efedb41SJonathan Nieder    flaky = src.endswith("CrissCrossMergeTest.java")
256efedb41SJonathan Nieder
260f6ddb37SDavid Ostrovsky    additional_deps = []
270f6ddb37SDavid Ostrovsky    if src.endswith("RootLocaleTest.java"):
280f6ddb37SDavid Ostrovsky      additional_deps = [
290f6ddb37SDavid Ostrovsky        '//org.eclipse.jgit.pgm:pgm',
300f6ddb37SDavid Ostrovsky        '//org.eclipse.jgit.ui:ui',
310f6ddb37SDavid Ostrovsky      ]
320f6ddb37SDavid Ostrovsky    if src.endswith("WalkEncryptionTest.java"):
330f6ddb37SDavid Ostrovsky      additional_deps = [
340f6ddb37SDavid Ostrovsky        '//org.eclipse.jgit:insecure_cipher_factory',
350f6ddb37SDavid Ostrovsky      ]
36c506f8d2SThomas Wolf    if src.endswith("OpenSshConfigTest.java"):
37c506f8d2SThomas Wolf      additional_deps = [
38c506f8d2SThomas Wolf        '//lib:jsch',
39c506f8d2SThomas Wolf      ]
4089110360SThomas Wolf    if src.endswith("JschConfigSessionFactoryTest.java"):
4189110360SThomas Wolf      additional_deps = [
4289110360SThomas Wolf        '//lib:jsch',
4389110360SThomas Wolf      ]
440f6ddb37SDavid Ostrovsky
45*621880bcSThomas Wolf    heap_size = "-Xmx256m"
46*621880bcSThomas Wolf    if src.endswith("HugeCommitMessageTest.java"):
47*621880bcSThomas Wolf      heap_size = "-Xmx512m"
48*621880bcSThomas Wolf
490f6ddb37SDavid Ostrovsky    junit_tests(
500f6ddb37SDavid Ostrovsky      name = name,
510f6ddb37SDavid Ostrovsky      tags = labels,
520f6ddb37SDavid Ostrovsky      srcs = [src],
530f6ddb37SDavid Ostrovsky      deps = additional_deps + [
540f6ddb37SDavid Ostrovsky        ':helpers',
550f6ddb37SDavid Ostrovsky        ':tst_rsrc',
56fa2851ceSDavid Ostrovsky        '//lib:javaewah',
57fa2851ceSDavid Ostrovsky        '//lib:junit',
58fa2851ceSDavid Ostrovsky        '//lib:slf4j-api',
590f6ddb37SDavid Ostrovsky        '//org.eclipse.jgit:jgit',
600f6ddb37SDavid Ostrovsky        '//org.eclipse.jgit.junit:junit',
610f6ddb37SDavid Ostrovsky        '//org.eclipse.jgit.lfs:jgit-lfs',
620f6ddb37SDavid Ostrovsky      ],
636efedb41SJonathan Nieder      flaky = flaky,
64*621880bcSThomas Wolf      jvm_flags = [heap_size, "-Dfile.encoding=UTF-8"],
650f6ddb37SDavid Ostrovsky    )
66