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 ] 4408b0a863SThomas Wolf if src.endswith("JSchSshTest.java"): 4508b0a863SThomas Wolf additional_deps = [ 4608b0a863SThomas Wolf "//lib:jsch", 4708b0a863SThomas Wolf "//lib:jzlib", 4808b0a863SThomas Wolf "//lib:sshd-core", 4908b0a863SThomas Wolf "//lib:sshd-sftp", 50488d9557SThomas Wolf ":sshd-helpers", 5108b0a863SThomas Wolf ] 52*2532fa74SMatthias Sohn if src.endswith("JDKHttpConnectionTest.java"): 53*2532fa74SMatthias Sohn additional_deps = [ 54*2532fa74SMatthias Sohn "//lib:mockito", 55*2532fa74SMatthias Sohn ] 56621880bcSThomas Wolf heap_size = "-Xmx256m" 57621880bcSThomas Wolf if src.endswith("HugeCommitMessageTest.java"): 58621880bcSThomas Wolf heap_size = "-Xmx512m" 59621880bcSThomas Wolf 600f6ddb37SDavid Ostrovsky junit_tests( 610f6ddb37SDavid Ostrovsky name = name, 620f6ddb37SDavid Ostrovsky tags = labels, 630f6ddb37SDavid Ostrovsky srcs = [src], 640f6ddb37SDavid Ostrovsky deps = additional_deps + [ 65487571e6SDavid Pursehouse ":helpers", 66487571e6SDavid Pursehouse ":tst_rsrc", 67487571e6SDavid Pursehouse "//lib:javaewah", 68487571e6SDavid Pursehouse "//lib:junit", 69487571e6SDavid Pursehouse "//lib:slf4j-api", 70487571e6SDavid Pursehouse "//org.eclipse.jgit:jgit", 71487571e6SDavid Pursehouse "//org.eclipse.jgit.junit:junit", 72487571e6SDavid Pursehouse "//org.eclipse.jgit.lfs:jgit-lfs", 730f6ddb37SDavid Ostrovsky ], 746efedb41SJonathan Nieder flaky = flaky, 75621880bcSThomas Wolf jvm_flags = [heap_size, "-Dfile.encoding=UTF-8"], 760f6ddb37SDavid Ostrovsky ) 77