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 22*6efedb41SJonathan Nieder # TODO(http://eclip.se/534285): Make this test pass reliably 23*6efedb41SJonathan Nieder # and remove the flaky attribute. 24*6efedb41SJonathan Nieder flaky = src.endswith("CrissCrossMergeTest.java") 25*6efedb41SJonathan 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 450f6ddb37SDavid Ostrovsky junit_tests( 460f6ddb37SDavid Ostrovsky name = name, 470f6ddb37SDavid Ostrovsky tags = labels, 480f6ddb37SDavid Ostrovsky srcs = [src], 490f6ddb37SDavid Ostrovsky deps = additional_deps + [ 500f6ddb37SDavid Ostrovsky ':helpers', 510f6ddb37SDavid Ostrovsky ':tst_rsrc', 52fa2851ceSDavid Ostrovsky '//lib:javaewah', 53fa2851ceSDavid Ostrovsky '//lib:junit', 54fa2851ceSDavid Ostrovsky '//lib:slf4j-api', 550f6ddb37SDavid Ostrovsky '//org.eclipse.jgit:jgit', 560f6ddb37SDavid Ostrovsky '//org.eclipse.jgit.junit:junit', 570f6ddb37SDavid Ostrovsky '//org.eclipse.jgit.lfs:jgit-lfs', 580f6ddb37SDavid Ostrovsky ], 59*6efedb41SJonathan Nieder flaky = flaky, 600f6ddb37SDavid Ostrovsky jvm_flags = ["-Xmx256m", "-Dfile.encoding=UTF-8"], 610f6ddb37SDavid Ostrovsky ) 62