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_"): 11*bbef67e8SDavid Ostrovsky package = name[len("org.eclipse.jgit_"):] 12*bbef67e8SDavid Ostrovsky if package.startswith("internal_storage_"): 13*bbef67e8SDavid Ostrovsky package = package[len("internal.storage_"):] 14*bbef67e8SDavid Ostrovsky index = package.find("_") 15*bbef67e8SDavid Ostrovsky if index > 0: 16*bbef67e8SDavid Ostrovsky labels.append(package[:index]) 170f6ddb37SDavid Ostrovsky else: 18*bbef67e8SDavid Ostrovsky labels.append(index) 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 ] 440aa8eca5SDavid Pursehouse if src.endswith("ArchiveCommandTest.java"): 450aa8eca5SDavid Pursehouse additional_deps = [ 460aa8eca5SDavid Pursehouse "//lib:commons-compress", 470aa8eca5SDavid Pursehouse "//lib:xz", 480aa8eca5SDavid Pursehouse "//org.eclipse.jgit.archive:jgit-archive", 490aa8eca5SDavid 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