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 ] 37c506f8d2SThomas Wolf if src.endswith("OpenSshConfigTest.java"): 38c506f8d2SThomas Wolf additional_deps = [ 39a074203fSDavid Pursehouse "//lib:jsch", 40c506f8d2SThomas Wolf ] 4189110360SThomas Wolf if src.endswith("JschConfigSessionFactoryTest.java"): 4289110360SThomas Wolf additional_deps = [ 43a074203fSDavid Pursehouse "//lib:jsch", 4489110360SThomas Wolf ] 45*9b2f8cedSDavid Ostrovsky if src.endswith("SecurityManagerMissingPermissionsTest.java"): 46*9b2f8cedSDavid Ostrovsky additional_deps = [ 47*9b2f8cedSDavid Ostrovsky "//lib:log4j", 48*9b2f8cedSDavid Ostrovsky ] 4908b0a863SThomas Wolf if src.endswith("JSchSshTest.java"): 5008b0a863SThomas Wolf additional_deps = [ 5108b0a863SThomas Wolf "//lib:jsch", 5208b0a863SThomas Wolf "//lib:jzlib", 5386cee68eSThomas Wolf "//lib:sshd-osgi", 5408b0a863SThomas Wolf "//lib:sshd-sftp", 55488d9557SThomas Wolf ":sshd-helpers", 5608b0a863SThomas Wolf ] 572532fa74SMatthias Sohn if src.endswith("JDKHttpConnectionTest.java"): 582532fa74SMatthias Sohn additional_deps = [ 592532fa74SMatthias Sohn "//lib:mockito", 602532fa74SMatthias Sohn ] 619f696567SDavid Pursehouse if src.endswith("TransportHttpTest.java"): 629f696567SDavid Pursehouse additional_deps = [ 639f696567SDavid Pursehouse "//lib:mockito", 649f696567SDavid Pursehouse ] 650aa8eca5SDavid Pursehouse if src.endswith("ArchiveCommandTest.java"): 660aa8eca5SDavid Pursehouse additional_deps = [ 670aa8eca5SDavid Pursehouse "//lib:commons-compress", 680aa8eca5SDavid Pursehouse "//lib:xz", 690aa8eca5SDavid Pursehouse "//org.eclipse.jgit.archive:jgit-archive", 700aa8eca5SDavid Pursehouse ] 71621880bcSThomas Wolf heap_size = "-Xmx256m" 72621880bcSThomas Wolf if src.endswith("HugeCommitMessageTest.java"): 73621880bcSThomas Wolf heap_size = "-Xmx512m" 74d8429d27SMatthias Sohn if src.endswith("EolRepositoryTest.java") or src.endswith("GcCommitSelectionTest.java"): 75d8429d27SMatthias Sohn timeout = "long" 76621880bcSThomas Wolf 770f6ddb37SDavid Ostrovsky junit_tests( 780f6ddb37SDavid Ostrovsky name = name, 790f6ddb37SDavid Ostrovsky tags = labels, 800f6ddb37SDavid Ostrovsky srcs = [src], 810f6ddb37SDavid Ostrovsky deps = additional_deps + [ 82487571e6SDavid Pursehouse ":helpers", 83487571e6SDavid Pursehouse ":tst_rsrc", 84487571e6SDavid Pursehouse "//lib:javaewah", 85487571e6SDavid Pursehouse "//lib:junit", 86487571e6SDavid Pursehouse "//lib:slf4j-api", 87487571e6SDavid Pursehouse "//org.eclipse.jgit:jgit", 88487571e6SDavid Pursehouse "//org.eclipse.jgit.junit:junit", 89487571e6SDavid Pursehouse "//org.eclipse.jgit.lfs:jgit-lfs", 900f6ddb37SDavid Ostrovsky ], 916efedb41SJonathan Nieder flaky = flaky, 92621880bcSThomas Wolf jvm_flags = [heap_size, "-Dfile.encoding=UTF-8"], 93d8429d27SMatthias Sohn timeout = timeout, 940f6ddb37SDavid Ostrovsky ) 95