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 = [] 10487571e6SDavid Pursehouse if name.startswith("org_eclipse_jgit_"): 11487571e6SDavid Pursehouse l = name[len("org.eclipse.jgit_"):] 12487571e6SDavid Pursehouse if l.startswith("internal_storage_"): 13487571e6SDavid Pursehouse l = l[len("internal.storage_"):] 14487571e6SDavid Pursehouse i = l.find("_") 150f6ddb37SDavid Ostrovsky if i > 0: 160f6ddb37SDavid Ostrovsky labels.append(l[:i]) 170f6ddb37SDavid Ostrovsky else: 180f6ddb37SDavid Ostrovsky labels.append(i) 19487571e6SDavid Pursehouse if "lib" not in labels: 20487571e6SDavid Pursehouse 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 = [ 29487571e6SDavid Pursehouse "//org.eclipse.jgit.pgm:pgm", 30487571e6SDavid Pursehouse "//org.eclipse.jgit.ui:ui", 310f6ddb37SDavid Ostrovsky ] 320f6ddb37SDavid Ostrovsky if src.endswith("WalkEncryptionTest.java"): 330f6ddb37SDavid Ostrovsky additional_deps = [ 34487571e6SDavid Pursehouse "//org.eclipse.jgit:insecure_cipher_factory", 350f6ddb37SDavid Ostrovsky ] 36c506f8d2SThomas Wolf if src.endswith("OpenSshConfigTest.java"): 37c506f8d2SThomas Wolf additional_deps = [ 38a074203fSDavid Pursehouse "//lib:jsch", 39c506f8d2SThomas Wolf ] 4089110360SThomas Wolf if src.endswith("JschConfigSessionFactoryTest.java"): 4189110360SThomas Wolf additional_deps = [ 42a074203fSDavid Pursehouse "//lib:jsch", 4389110360SThomas Wolf ] 44*0aa8eca5SDavid Pursehouse if src.endswith("ArchiveCommandTest.java"): 45*0aa8eca5SDavid Pursehouse additional_deps = [ 46*0aa8eca5SDavid Pursehouse "//lib:commons-compress", 47*0aa8eca5SDavid Pursehouse "//lib:xz", 48*0aa8eca5SDavid Pursehouse "//org.eclipse.jgit.archive:jgit-archive", 49*0aa8eca5SDavid Pursehouse ] 500f6ddb37SDavid Ostrovsky 51621880bcSThomas Wolf heap_size = "-Xmx256m" 52621880bcSThomas Wolf if src.endswith("HugeCommitMessageTest.java"): 53621880bcSThomas Wolf heap_size = "-Xmx512m" 54621880bcSThomas Wolf 550f6ddb37SDavid Ostrovsky junit_tests( 560f6ddb37SDavid Ostrovsky name = name, 570f6ddb37SDavid Ostrovsky tags = labels, 580f6ddb37SDavid Ostrovsky srcs = [src], 590f6ddb37SDavid Ostrovsky deps = additional_deps + [ 60487571e6SDavid Pursehouse ":helpers", 61487571e6SDavid Pursehouse ":tst_rsrc", 62487571e6SDavid Pursehouse "//lib:javaewah", 63487571e6SDavid Pursehouse "//lib:junit", 64487571e6SDavid Pursehouse "//lib:slf4j-api", 65487571e6SDavid Pursehouse "//org.eclipse.jgit:jgit", 66487571e6SDavid Pursehouse "//org.eclipse.jgit.junit:junit", 67487571e6SDavid Pursehouse "//org.eclipse.jgit.lfs:jgit-lfs", 680f6ddb37SDavid Ostrovsky ], 696efedb41SJonathan Nieder flaky = flaky, 70621880bcSThomas Wolf jvm_flags = [heap_size, "-Dfile.encoding=UTF-8"], 710f6ddb37SDavid Ostrovsky ) 72